AnsweredAssumed Answered

Bug in STM32L4xx_HAL_Driver (SPI Transmit)

Question asked by kurilovich.vladi.001 on Mar 21, 2016
Latest reply on Jan 23, 2017 by Amel N
Component: STM32L4xx_HAL_Driver
File: stm32l4xx_hal_spi.c
Function: HAL_SPI_Transmit
Line number: 519
Description:
SPI RX FIFO not empty after transmit.
Solution:
Remove
{
  __HAL_SPI_CLEAR_OVRFLAG(hspi);
}
Insert
{
  __IO uint32_t tmpreg;
  tmpreg = hspi->Instance->DR;
 
  while((hspi->Instance->SR & SPI_FLAG_RXNE) == SPI_FLAG_RXNE)
  {
    tmpreg = hspi->Instance->DR; /* read the received data */
  }
  tmpreg = hspi->Instance->SR;
  UNUSED(tmpreg);
}
Note:
please review all SPI code, it may contain similar bugs.

Outcomes