Skip to main content
Associate
December 19, 2025
Question

Nucleo-L4R5Zi-P: SPI_NSS_HARD_OUTPUT

  • December 19, 2025
  • 2 replies
  • 248 views

Hi all,

I am working on firmware that involves SPI communication using a Nucleo board (Nucleo-L4R5ZI-P) with an STM32L4ZIT6 microcontroller.

I am trying to establish communication with an SPI slave device. The chip select (NSS) signal is expected to be controlled by hardware, so I enabled the hardware chip-select configuration as shown below.(screenshots attached)

When I switch to software control, I am able to read from and write to the slave registers by manually toggling the chip-select pin in software. However, when I change the mode to SPI_NSS_HARD_OUTPUT, the SPI read/write communication stops working.

What could be the issue?

 

_godsonthomas_1-1766158531876.png
_godsonthomas_2-1766158589344.png









 

2 replies

TDK
Super User
December 19, 2025

NSS is low as long as the peripheral is enabled. It doesn't just go low for the transaction. This is typically not what you want and the "hardware NSS" setting on this chip is often not useful.

TDK_0-1766160374101.png

The best way to handle this is to initialize the pin as a GPIO output and control it manually.

 

"If you feel a post has answered your question, please click ""Accept as Solution""."
MasterT
Lead II
December 19, 2025

Set pulse enable

hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;