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.

Using 32bit transfers on SPI



Hi,

I have an SPI device that only uses 32 bit transfers while communicating. From what I see TI-RTOS' SPI driver only allows transfers up to 16 bits.

Is there a way to transfer 32bit word in one transaction?

Thank you very much in advance.

  • Peter,

    What device are you using? There are different SPI controllers and their behavior is slightly different.

    The basic issue here is that you need the master to issue two 16-bit transfers but make it look to the slave like one 32-bit transfer. The chip select signal plays an important role. If the chip select can be asserted for the two 16-bit transfers, then the slave will see it as one 32-bit transfer. 

    For example, on Tiva devices, using the Freescale SPI Frame Format with SPO=0 and SPH=1, the chip select line is asserted for successive data words. So, this mode might work for you. However, using SPO=0 and SPH=0 would not work because the chip select line is pulsed between each data word.

    If your particular device does not have such a mode as above, then your next option is to manage the chip select line yourself using a GPIO pin. In this case, do not connect the SPI chip select line but use a GPIO pin instead. In your code, you would assert (usually active low) the GPIO pin just before the SPI_transfer call and de-assert the GPIO pin after the SPI_transfer call returns. Configure your transfer as two 16-bit words.

    ~Ramsey

  • Hi Ramsey,

    Thank you for your response. I am using tiva TM129C and Freescale might be what I am looking for. I will give it a try.

    Thank you,

    Peter A.

  • Hi Ramsey,

    Controlling chip select line manually as GPIO pin did the trick.

    Thank you for your help,
    Peter A.
  • Great. Thank you for letting us know.