2026-03-02 6:40 AM
Heyho,
I have an application with an STM32H7x3, which might be talking to some other STM32 (type TBD, probably something <= G4) on another stacked PCB.
This is only a control interface, so no data streaming with a minimum data rate.
I am looking for the "best" interface, with that I mean "highest speed at lowest complexity".
Hardware limits:
So, I2C or SPI - or anything else ?
For reliability I like the I2C's acknowledge, SPI is surely faster and has no address "overhead".
Thanks in advance for your input!
2026-03-04 7:21 AM
Good point, I have these extra lines in the existing system - and wanted to keep them.
Currently each slave has an extra interrupt line, plus one spare line (which is used for something completely different now than intended).
2026-03-04 10:34 AM
I once experimented with an SPI "ring" - data output of one mcu goes to input of other, common clock, common slave select, one master and all other slaves. DMA took care of shoveling data from input to output wihin the mcu; I don't remember how was the "injection" of given mcu's data solved, but maybe another DMA triggered by the slave select. Such scheme is efficient only if there is a need to dispatch the same amount of information amongst (or from) N slaves, but this is often the case. I don't say it's better or worse than any other scheme, just wanted to throw in one more idea to the pool.
JW
2026-03-04 11:38 PM
This will be a modular system where some "in-between" module slots may not be occupied, so a daisy chain / ring would be broken - unless some jumper would be set.
I think I'd prefer "broadcasting" to several modules by simply pulling down multiple CS/SS pins.
Or would that be some "forbidden" action for SPI?
Until now I have used SPI mostly only with a single device connected.
2026-03-05 1:32 AM
That indeed disqualifies immediately any idea of ring (not that it would be unimaginable, but it makes it quite impractical). Also, if there's often a need to "broadcast", this would be a wasteful scheme.
I personally would go for single-wire UART (used much like the ubiquitous RS485), although ~0.5MBaud may require some care.
JW
2026-03-05 2:42 AM
@LCE wrote:I think I'd prefer "broadcasting" to several modules by simply pulling down multiple CS/SS pins.
Or would that be some "forbidden" action for SPI?
The problem there is that you'll enable multiple MISO outputs at the same time onto the one MISO line ...
2026-03-05 3:43 AM - edited 2026-03-05 3:44 AM
Darn, I forgot... is that automatic that the CS immediately switches the MISO to output and shifts out the input from MOSI?
I just find that I mostly used I2C over the recent years...
Edit: but I would have no problem with some manual slave output control, like turn on output only when requested by master.
2026-03-05 4:11 AM
@LCE wrote:is that automatic that the CS immediately switches the MISO to output and shifts out the input from MOSI?
The whole point of CS (aka SS) is that it selects the particular slave to be Active - which means that its outputs will be active.
The shifting is still controlled by SCK.
I guess you could fiddle with the STM32 configuration to turn off MISO, but that would add more complexity & overheads - which you said you were trying to ignore ... ?
Maybe you can have the GPIO in open-drain mode - I don't know ...