This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5438A: 16-bit SPI communication using DMA

Part Number: MSP430F5438A

Hello, I have developed a wireless sensing device.

As TI-MSP430F5438A MCU doesn't offer 16-bit SPI communication mode, but only 8-bit or 7-bit SPI communication mode,

I have used a 16-bit SPI protocol sensor chip with the MCU

by directly controlling the CS pin followed by GPIO protocol.

After getting the 16-bit SPI data, the MCU would send to a bluetooth chip by UART protocol.

That worked well.

But, I want to increase the throughput.

So I changed to control UART by operating DMA in the MCU.

However, SPI protocol in the MCU is based on 8-bit communication,

so it is hard to adjust DMA on making 16-bit SPI protocol.

I have no idea on making this protocol.

How can I make the MCU to process 16-SPI protocol by using DMA?

I need to add a data processing algorithm,

so I need to use DMA to reduce burden on CPU.

Can you suggest any idea?

p.s. the 16-bit SPI communicating sensor chip (slave) only reply SPI protocol when CS pin is passing falling edge.

so when the MCU - CS pin is always pin-down, the sensor chip won't never reply.

  • DONGHYEON ROH said:

    Part Number: MSP430F5438A

    After getting the 16-bit SPI data, the MCU would send to a bluetooth chip by UART protocol.

    That worked well.

    But, I want to increase the throughput. 

    So I changed to control UART by operating DMA in the MCU.

    Maybe you are going in the right direction, but my experience is different. I spent significant time to find solution for fastest UART throughput, for my dual CDC - UART bridge, and at the end I gave up of using DMA.

    http://forum.43oh.com/topic/2972-sbw-msp430f550x-based-programmer/?do=findComment&comment=53730

     Both bridges are working in parallel, full-duplex, on 1 Mbps without problems.

  • Hmm... it looks weird.

    In the MSP430F550x series datasheet,page 34,  the maximum UART baud rate is 1MHz, but to the following  your assembly code in the linked page, you said it can be set as 4 KHz just by setting BR=4 at 16 MHz system clock. Only to do this, is it possible to make the result throughput 1Mbps?

    P.S. What does it mean 1Mbps? Throughput? Or proper baud rate?

    P.S.2 what is CDC?

  • I'm worried about over-setting. Have you ever experienced any problems? If not, it looks good, because the maximum UART baud rate of Bluetooth chip is 4 MHz SO I can try then.
  • I done UART benchmark... http://forum.43oh.com/topic/3413-msp430-uart-benchmark/

    And in datasheet there is...

    slau144 MSP430x2xx Family User's Guide   18.2.6 USART Baud Rate Generation
    The maximum USART baud rate is one-third the UART source clock frequency BRCLK.

    slau208 MSP430x5xx MSP430x6xx Family User's Guide   32.3.9.1 Low-Frequency Baud-Rate Generation
    In this mode, the maximum USCI baud rate is one-third the UART source clock frequency BRCLK.

    1 Mbps is baud rate. At attached picture you can see that both bridges (connected to 2xx UART's) in Win CLI are open with -br (baudrate) 4000000 (4 Mbps). But at this example two 2xx devices are only sending data by UART (and bridge is sending this data to PC by USB = CDC), not in full-duplex.

  • I read your posts(2013 Feb. ~ May). And now I understand what you mean about the word, 'one-third'.
    If I understand correctly, I can try to set higher baud rate as much as 8 Mbps because the maximum system frequency is 25 MHz.
    Thanks for advising how to increase throughput! I will try and say the result!

    ----------------------------------------------------------------------------------------------------------------------------------------------------------
    Anyway, my actual interests were not about UART but SPI. (the reasons are in below.)
    I want to come back the origin issue about SPI.

    I compressed data immediately after receiving SPI data,
    and after using DMA on UART, there is no need to increase UART performance
    because we only need to check whether bulk data transmission was finished or not.

    so the throughout limitation is not from low speed in UART, but from SPI burden on CPU checking and data processing burden (compression techniques).

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------
    My idea is simple. In order to concentrate on data processing(=compression) for CPU in MCU,
    I want to operate DMAs not only to UART but also 16-bit SPI communication.
    Is there any ides on 16-bit SPI communication using DMA?
    I need someone's help.
  • Hello, zrno.
    I tested to increase UART baud rate of the MCU to 5 MHz.
    - Test MCU : MSP430F5438A
    - Internal voltage : maximum state for the highest internal frequency.
    - Test baud rate : 921.6 kbps (default), 1.25 Mbps, 1.5 Mbps, 2 Mbps, 2.5 Mbps, 4 Mbps, 5 Mbps
    -> Result : 921.6 kbps (success), 1.25 Mbps (success), others (fail)
    I was curious because a TM4C MCU which is one of my MCUs could communicate with the same Bluetooth device to 2.5Mbps.
    By following the above results, I considered for the MSP430 MCU that cannot be in the Maximum internal frequency mode (25MHz).
    Because I used Bluetooth stack codes (from TI), I thought the problem must be in the stack code, and I found there was a curious condition.
    'Maximum frequency = 22.8 MHz'
    I don't know why the MCU cannot be set as 25MHz in the Bluetooth stack code.
    To the following datasheets, internal frequency could be set to 25MHz.
    Maybe TI's Bluetooth team knows that reason.

    Anyway, I could try to higher baud rate by following your suggestion and the system could increased throughput.

    Thanks for your help.

    Now I should solve how to operate 16-bit SPI protocol more efficiently.
  • *Correct something.
    *In the Bluetooth stack code, there was the maximum frequency setting as 22.1184MHz

**Attention** This is a public forum