cancel
Showing results for 
Search instead for 
Did you mean: 

Challenges in having 8 SPI slaves on single SPI bus?

YVerm
Associate II

Hello all,

In my application I am supposed to use 8 similar SPI slaves on single SPI bus with master as (STM32L452RCT6) with different chip select lines for each slave.

Also, please let me know if it is necessary to configure the CS lines on same Register bank pin-port of MCU where we have configured SPI bus?

Please let me know if this is fine. If not, kindly let me know about the challenges that I may face.

Thanks a lot in advance.

Best Regards,

Yash

5 REPLIES 5
BCoch
Senior

Should be fine. You will drive the CS lines independently from the SPI, so it doesn't matter which ports you use.

They don't need the same GPIO bank. You could also do with a 3-to-8 decoder/multiplexor chip (equivalent to old 74LS138) to reduce the required pin count to 4 pins

Make sure the devices share MISO properly.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal

Got 1 STM32 master and up to 12 Slaves (SPI with plug and play functionality).

First, enable EXTI interrupt on all Slave NSS.

Second, use DMA with circular incoming buffer.

Implement the SPI circular loop mode as external SPI ADC or DAC chipsets are being implemented. (cascaded)

Imagine each slave expect to send and receive 1kbyte payload per transaction.

Use the SAME NSS for all slaves. Falling edge to start their DMA buffers (RX/TX), Rising edge to process the data exchanged with the master.

Master pushes 8x1kbyte and receive 8x1kbyte simultaneously. Fixed payload length. Use the first 2 bytes to get the real payload length, for example.

There is something even more efficient, to be discussed later.

YVerm
Associate II

Hello all,

Thanks for the replies and information!

I have one more question: Will SPI port from the mentioned MCU support 8 slaves without any problem of bus loading or something like that?

The SPI configuration is a typical one as mentioned in picture below (but with 8 slaves) and not daisy chain:-

0690X00000AAJ2DQAX.png

Thanks in advance,

Best Regards,

Yash

Check the slave's datasheets.

When you communicate with one slave any time, the others are supposedly only a capacitive load.

Non-seselected slaves shouldn't pull any significant current.