2025-01-22 11:30 AM
I have the main MCU serving as the master in the spi communication whose primary job is to transmit data over SPI lines to two slaves. If I choose hardware NSS signal configuration the IOC file assigns a default pin as the NSS signal for that SPIx peripheral. I have a basic doubt as to whether it is better for me to do Software or Hardware NSS signal? If I choose hardware NSS signal the default pin can serve as CS for just one slave, how can I have multiple CS working with SPI bus, should I just GPIOs as the NSS signal lines? Or do it with Software NSS signals if so how is it done? I have not yet worked with SPI on STM32, only with Arduino so have no idea what is happening? The manual is a bit intimidating rn.
2025-01-22 03:00 PM
You are correct with using two separate signals for each CS and not using the hardware NSS line option (built into the SPI hardware) So, you will be using a software command to turn on the CS -- do the SPI transfer -- then a software command to turn off the CS. It would be something like this: