2017-02-11 10:50 AM
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 #spi2017-02-11 04:35 PM
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
2017-02-13 06:48 AM
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)