cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 HAL SPI NSS won't work with baudrates below 1 MBaud

Nils F
Associate
Posted on February 11, 2017 at 19:50

Hi,

I'm trying to set up a SPI connection for an AS5311 sensor on my STM32F I want to use the hardware controlled NSS signal, which is working pretty well - but only for high baudrates.

I am using CubeMX to configure my clocks and peripherals. If I set the baudrate above 1 MBaud and read the sensor data with the

HAL_SPI_Receive_IT(...)

function the NSS signal is used properly. But if I change it to a baudrate below 1 MBaud, NSS is not working anymore. I do not change anything on my source code. I olny use the prescaler setting for SPI in CubeMX.

Does anyone know the reason for this? Unfortunatly the sensor does not support baudrates above 1 MBaud. See the pictures below to comprehend my problem

#hal #cubemx #baudrate #nss #nss-cs #spi
2 REPLIES 2
Posted on February 12, 2017 at 01:35

You are supposed to drive the chipselect pin  'manually' from a GPIO output.

The NSS in 'F40x master mode is not intended to frame the communication, it only indicates that SPI is working as master (if SSOE = 1, see Slave select (NSS) pin management chapter in RM0090) - as also your waveform shows, after the communication ends, the 'library' probably disables SPI which tri-states the NSS pin rather than sets it at one.

JW

Posted on February 13, 2017 at 14:48

Thank you very much! Using a GPIO is the solution of course

Still a strange effect that is was working for baudrates higher than 1 MBaud. Anyway, thank's again. I really appreciate your help! (Y)