SPI periodically receiving wrong data
Hello,
I have a custom board with a STM32L010C6 MCU, which periodically reads 3 bytes (24 bit array) from an external component through SPI.
I only need SCLK and MISO since the frame resets using a timeout.
I configured the SPI as Only-Receiving Master, which didn't work OK. Now I am using the SPI peripheral as a Full-Duplex Master with software NSS and I perform data reads by polling function HAL_SPI_Receive().
It seems to work OK, with some delay between bytes.
![]()
The problem is that I periodically get bad data in the MCU. I identified that this happens when the SPI clock is not divided by 8-bit packets.

When this happens, the data transmitted by the external sensor is OK but the MCU doesn't read the correct value. In addition, I don't get any error state from the function, so I don't have a way to skip wrong values.
I tried reinitializing the SPI peripheral every time I want to perform a reading, but the problem persists.
Is there any reason which leads to this behaviour?
