SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By bbob4891

I'm at the moment building a small project using the MSP430 to control lights wirelessly. Because this is my first time, I chose existing system from TI EZ430-RF2500 because it already works
But, I am not sure what is happening with SPI. I want to understand how SPI talks to CC2500 radio.
I found this MSP430 Tutorial on SPI. It is good because it talks about very basic things. It talks about SPI setup but I still don't understand because code is not complete

Here is code that I have for configuring SPI on UCB0:

UCB0CTL0 |= UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI mstr, MSB 1st
UCB0BR0 = 0x02;
UCB0BR1 = 0;
UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**

How do I configure clock speed for SPI? What does it mean by SMCLK? Should I use 3-pin? I see 4 pins in the schematic.

Thank you very much
By UhClem
You have set the SPI clock rate by setting UCB0BR0 and UCB0BR1.

SMCLK is the sub main clock and is divided off the main clock (MCLK) which should be set when you configure your clock. If you do nothing it will be the same as the default DCO clock.

You need 4 wire if you want to be a slave device. Since you are a master, 3 wire is fine. But you do need to use another pin for the CS signal to the slave.

Your code has trouble because all of the writes to the control registers should happen while UCSWRST is set. It should start with UCB0CTL1 = UCSWRST.

All of this is covered in the family user guide.