Hi there,
I'm gonna use SPI module in MSP430F5418A to accomplish full duplex SPI communication with CPLD. Do I have to write the TX function and RX function together?
And there is a register named modulation control in SPI module. What does it mean? And how to use it? Do I have to set the value of this register when I use SPI
module?
Thanks
Nick
Hi Nick,
You should write one function for TX and a second function for RX. If you're a master, please note that for RX you should send NULL bytes (0x00 or 0xFF depending your configuration) in order to put the clock signal for getting the slave data.
MSP430 UART has 2 registers for its configuration: divider and modulation, combining these two registers you will set your baud rate. This is done following the next equation:
http://www.javierlongares.com/arte-en-8-bits/wp-content/uploads/2011/10/baud-rate-MSP430.jpg
But don't worry about the math, TI proposes in its datasheets a complete combination of values for the typical baud rates. So, use it!
I've written a MSP430 guide in spanish and may be it will be usefull for you: http://www.javierlongares.com/arte-en-8-bits/msp430-una-guia-de-referencia-en-castellano/
Best regards,
Javier
---
www.javierlongares.com
http://www.javierlongares.com/arte-en-8-bits
Arte8bits When technology becomes artMSP430 UART has 2 registers for its configuration: divider and modulation
So if your clock (e.g. SMCLK) is 8MHz and you want a frequency above 1MHz and below 5MHz, you can use a divider of 8, 4 or 2 for 1, 2 or 4MHz SPI clock. But from a clock of 8MHz, you cannot get 5MHz SPI clock. Only integer fractions of the base frequency. But as I said, it is rather unimportant, since the master generates one clock signal for each bit on teh transfer. So the clock can even change in the middle of a byte transfer without any negative effect.
_____________________________________Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.