Skip to main content
rwils.1
Associate III
November 6, 2023
Question

STM32L471RGT6 32 bit SPI

  • November 6, 2023
  • 5 replies
  • 1266 views

Hi is it possible to communicate 32 bit data over the SPI bus? Using IOC to set up the SPI port 2 , I seem to be limited to 16 bits.

Thanks a lot 

 

Richard

 

 

This topic has been closed for replies.

5 replies

Tesla DeLorean
Guru
November 6, 2023

As a pair of 16-bit words, or as 4-bytes, in a consecutive fashion, and arranged to suit whatever MSB-LSB and endian form you need.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Pavel A.
November 6, 2023

Of course. Send 16-bits, twice. Newer STM32s can send 32 bits in one write to the SPI data register, but L4 is limited to 16 bits at once.

 

rwils.1
rwils.1Author
Associate III
November 7, 2023

Thank you Pavel, I was going to use NSS but I was thinking that that won't work as comms will shutdown after the first 16 bytes. I guess I will just have to manually control NSS. 
Cheers

Richard

 

 

Tesla DeLorean
Guru
November 7, 2023

You pretty much always have to manually control NSS, as it's gated by the SPI Enable, not by individual words or byte transacted via the data register. Most just use a GPIO as it's less trouble.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
rwils.1
rwils.1Author
Associate III
November 7, 2023

Thanks for the information!