code for SPI test for MSP430

Jul 03, 2008 2 Replies

can anybody guide me to write SPI communication test code for MSP430?


You'll need to tell us if this is homework or a commercial project, as the consultancy rates will vary.

The Force is dark on one side, light on the other and holds the world together. Hmmm, just like Gaffer Tape then.

The examples can be downloaded at msp430.com, in the Code Examples tab.

However, using the MSP430 as a spi master: I have found it best to onl use the RX ISR, and leave the transmit interrupt off. SPI always transmits a byte when it receives a byte, so when you get a R interrupt it means both the transmit register is ready for another byte and the receiver buf has a byte ready for you to read out. And in thi case its best to start the transfer by writing to the TXBUFx. The transfe ends when the RX ISR doesnt put another byte into the TXBUFx.

You also need to consider whether your slave needs a chipselect to toggl states after every byte, or every 16bits or whatever. So the code to driv the SPI depends heavily on what the other side needs.

The example code on msp430.com website is a good basic start.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required