AnsweredAssumed Answered

Duplicated code in stm32l0xx_hal_pcd.c V1.8.0

Question asked by atanasov.daniel on Jan 22, 2017
Latest reply on Mar 16, 2018 by Darius B

Hello,

I just started a mini project using USB CDC with STM32CubeMX and while trying to figure out how to use CDC driver i found this piece of code.

I think there is code duplication (copy-paste) in STM32Cube_FW_L0_V1.8.0/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pcd.c

In function PCD_EP_ISR_Handler(),

In section /* Decode and service non control endpoints interrupt  */ for Correct Transfer for transmission,
from /* IN double Buffering*/ to /*multi-packet on the NON control OUT endpoint*/.

 

Code in above described section wrongly writes data to PMA memory.

The later call to HAL_PCD_EP_Transmit() writes right data to PMA memory and sends it.

 

Possible side effect with duplicated code in PCD_EP_ISR_Handler() can be a calling of function PCD_FreeUserBuffer() twice in case of ep->doublebuffer != 0U.

Outcomes