2023-11-06 01:44 PM
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
2023-11-06 01:56 PM
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.
2023-11-06 01:58 PM - edited 2023-11-06 02:00 PM
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.
2023-11-07 09:29 AM
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
2023-11-07 10:04 AM
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.
2023-11-07 10:19 AM
Thanks for the information!