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
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:
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/
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.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.