AnsweredAssumed Answered

Potential Bug in STM32Cube SPI routine

Question asked by lee.sungjune.001 on Jun 5, 2016
Latest reply on Jun 9, 2016 by obid.matic
Hello,

In my senario, a SPI eeprom is connected to a STM32F051, whose SPI module was set to a full duplex master mode. My original code to read a block of data from the eeprom was like this:

29.png

The problem of this code is that the HAL_SPI_Transmit() leaves data on the RX buffer by default, so that when HAL_SPI_Receive() was executed, 3 bytes of garbage data was introduced at the beginning of the read buffer while the same amount of data was missing at the end.

So, I have to flush the Rx buffer before every HAL_SPI_Receive() call.

49.png

where

16.png

Thanks,

Outcomes