Skip to main content
Associate III
January 16, 2025
Question

Do any STM32 devices support 20-bit SPI?

  • January 16, 2025
  • 15 replies
  • 1793 views

..

This topic has been closed for replies.

15 replies

AScha.3
Super User
January 16, 2025

H7 series, like H743, has SPI with data size 4....32 bit frame.

If you feel a post has answered your question, please click on " Best Answer ".
SoCalJimAuthor
Associate III
January 16, 2025

This says 4-16 bit frames. Are bigger frames available in software?

 

SoCalJim_1-1737066629952.png

 

 

Lead II
January 17, 2025

Separate between "word size" and "frame size".
SPI can support "word size" as 4, 8, ... bits per word (up to 32bit).

So, 20bit as "word size" should be possible. If not directly, consider it as sending a 16bit word plus a 4bit word.

"Frame Size" is independent of it: if you can send any "word" (as 20bit) - any number of words can be transmitted (limitation is potentially on a 64K word size boundary, e.g. due to DMA addresses).

Any "frame size" is possible in SW.

gbm
Super User
January 17, 2025

If an MCU supports 10-bit frames, 20-bit data may be sent/received as 2 10-bit frames.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Uwe Bonnes
Chief
January 17, 2025

U5 has also 32 bit SPI.

Lead II
January 17, 2025

U5 has 4..32bit!

reference manual, page 2888, 68.2:
"From 4- up to 32-bit data size selection or fixed to 8-bit multiples"

page 2904:

tjaekel_0-1737154503875.png

tjaekel_1-1737154673521.png

As I understand:

  • 20bit should be directly possible (or even as 5x 4bit, 2x 10bit)
  • Just: not all SPIs are "full feature"

tjaekel_2-1737154778927.png

 

Lead II
January 17, 2025

BTW:

even SPI would not support 20bit word size - but MCU would provide a QSPI - the 20bit is possible via QSPI - but just as transmit only ("half-duplex"):

Configure a QSPI as 4-bit-lane but you use just one lane (only DIO0 = MOSI, for instance, is connected). Now you have two clocks per one byte. But you send all bits properly encoded in bytes (e.g. bit 0 and bit 4 Tx containing data bit 0, bit 1, etc.).

Now you have Nx 2 clocks (2 bits) you can send.

Just: such a QSPI is not full-SPI: it cannot run in "full-duplex" mode (MOSI and MISO at the same time). As long you need just a SPI Tx - you can use also a QSPI peripheral.
(but I think you need SPI in "full-duplex", Rx when Tx - so, find MCU with 4..32bit SPI and configure it properly)