cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L4R5Zi-P: SPI_NSS_HARD_OUTPUT

_godsonthomas
Associate II

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 2
TDK
Super User

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

Set pulse enable

hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;