problems with EZ430-RF2500 SPI

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

Moderator: phalanx

Post Reply
bbob4891
Posts: 2
Joined: Wed Oct 02, 2013 7:02 pm

problems with EZ430-RF2500 SPI

Post by bbob4891 » Wed Oct 02, 2013 7:14 pm

Hello,

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
UCB0CTL1 |= UCSSEL_2; // SMCLK
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

UhClem
Posts: 413
Joined: Sun Aug 03, 2008 6:11 pm

Re: problems with EZ430-RF2500 SPI

Post by UhClem » Thu Oct 03, 2013 5:25 pm

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.

bbob4891
Posts: 2
Joined: Wed Oct 02, 2013 7:02 pm

Re: problems with EZ430-RF2500 SPI

Post by bbob4891 » Thu Oct 03, 2013 7:32 pm

Thank you. I added the reset and now I can see SPI working... but i need to make more adjustments.

Post Reply