NSS setting in STM32 master and slave mode
In this article, let’s understand about slave select pin management or NSS pin management.
There are two scenarios.
- Slave mode
- Master mode
When the device in slave mode, the NSS pin works as standard “chip select” input and lets the slave communicates with the master.
When the device is in master mode, the NSS pin either used as input or output. So as an input pin, NSS will avoid multi-master bus collision. That means when the device is in master mode, the multi-master collision capability can achieve by using the NSS pin as an input. That means, the SPI can have multiple masters.
But in standard communication, when the device is in master mode, always keep the NSS pin as an output. When the NSS pin is in output mode, it can drive a slave select signal of the single slave.
From Figure 1. Let’s assume that the slave is an STM32 microcontroller which is in slave mode. The master is an STM32 microcontroller, which is in master mode. Here, no need to use the NSS pin. But, if you want to use that pin, then make it as input in the slave side and output on the master side. From the slave side, it just acts like a standard slave select pin.
In the following article, let’s see Hardware and software slave managements.
FastBit Embedded Brain Academy Courses
Click here: https://fastbitlab.com/course1