Skip to main content
Muzahir Hussain
Associate III
February 17, 2018
Question

Setting nss_soft in Master (SPI)

  • February 17, 2018
  • 7 replies
  • 5184 views
Posted on February 17, 2018 at 23:00

I want to set NSS pin to software mode in master using STM32F103RB. But I've few questions?

In reference manual, they say,

In NSS Software mode, set the SSM and SSI bits in the SPI_CR1 register. If the NSS pin is required in output mode, the SSOE bit only should be set.

Now,

Why do we need to set SSI bit with SSM?

What is the purpose of SSOE bit?

#spi #stm32f103rb
This topic has been closed for replies.

7 replies

Bogdan Golab
Lead
February 17, 2018
Posted on February 17, 2018 at 23:17

Out of my experience: I used the STM32L152RE + CubeMX to generate the app skeleton and had SPI HW NSS disabled (hardware NSS handling).

To set/clear the NSS (software way) I simply used HAL GPIO function:

HAL_GPIO_WritePin(GPIOB, PinXX, GPIO_PIN_SET) / HAL_GPIO_WritePin(GPIOB, PinXX, GPIO_PIN_RESET)

Muzahir Hussain
Associate III
February 18, 2018
Posted on February 18, 2018 at 18:40

Thanks for the reply.

I am not using any library however, therefore if you could answer my question and tell me the purpose of SSI and SSOE bit and which bit should I set along with SSM for software Nss, I'll be grateful.

Bogdan Golab
Lead
February 18, 2018
Posted on February 18, 2018 at 19:17

I wanted to say that I change NSS state manually using GPIO. You do not need any library - just change pin state at the register level (set pin as output, and change the output register value). This pin is connected to the SPI chip - CS (Chip Select pin). This allows you to select the device on the SPI bus.