2021-03-10 06:25 AM
Affected driver libraries: STM32Cube_FW_L5_V1.4.0, STM32Cube_FW_L4_V1.16.0, STM32Cube_FW_L0_V1.11.2 and possibly other device driver libraries based on the same SPI peripheral
File: stm32yyxx_ll_spi.h (Replace yy by L5, L4, F0, ...)
Functions affected: LL_SPI_ReceiveData8
Bug: Current implementation performs a 16bit read access to DR register and then casts the result to 8 bits. This leads to unexpected behavior. For example STM32L5 supports data packing, when SPI data frame size is less than or equal to 8 bits and 16 bits are read. In this case, the current implementation of LL_SPI_ReceiveData8 reads two (packed) bytes from DR register and discards the second one when casting the read result to 8 bits.
Correct implementation: Cast pointer to DR register to uint8_t before access.
__STATIC_INLINE uint8_t LL_SPI_ReceiveData8(SPI_TypeDef *SPIx)
{
return *((__IO uint8_t *)&SPIx->DR)
}
Solved! Go to Solution.
2021-03-24 11:22 PM
Hi @Imen DAHMEN
Thank you.
As you can see in the corresponding git repository for STM32CubeF0 firmware package this issue is still present in STM32CubeF0 V1.11.2.
Best regards,
Sebastian
2021-03-10 09:49 AM
Hello @SOfne.1 and welcome to the STM32 Community :)
Thanks for pointing out this issue.
I am checking it internally and I will come back to you with details about corrective actions we will take, or explanation if needed.
Imen
2021-03-18 07:20 AM
Hi @SOfne.1 ,
This issue will be fixed in the coming release of STM32CubeL5 MCU package.
Thanks for your contribution.
Imen
2021-03-22 12:07 AM
Hi @Imen DAHMEN
Thanks for your fast response. Will this issue be fixed in the next releases of STM32CubeF0 and STM32CubeL4 MCU package, too?
Best regards,
Sebastian
2021-03-23 12:07 PM
Hi @SOfne.1 ,
I think this is already fixed in the release of STM32CubeF0 V1.11.0.
I reported this issue internally to check and fix all impacted series.
Thanks for your feedback.
Imen
2021-03-24 11:22 PM
Hi @Imen DAHMEN
Thank you.
As you can see in the corresponding git repository for STM32CubeF0 firmware package this issue is still present in STM32CubeF0 V1.11.2.
Best regards,
Sebastian
2021-03-25 02:49 AM
Hi @SOfne.1,
You are right, only LL_SPI_TransmitData8() is correct in the latest CubeF0. I've escalated this issue to correct LL_SPI_ReceiveData8() API.
The same correction will be performed for all impacted series.
Imen