2019-08-26 02:00 AM
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
2019-08-26 08:41 AM
Should be fine. You will drive the CS lines independently from the SPI, so it doesn't matter which ports you use.
2019-08-26 08:53 AM
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.
2019-08-26 10:53 AM
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.
2019-08-26 10:02 PM
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:-
Thanks in advance,
Best Regards,
Yash
2019-08-26 10:35 PM
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.