waclawek.jan

[OTG + Cube] Wrong constants used for checking endpoint disabled in USB_DeactivateEndpoint()

Discussion created by waclawek.jan on Sep 29, 2017
Latest reply on Sep 29, 2017 by waclawek.jan

In [STM32Cube_FW_F4_V1.16.0]\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.c USB_DeactivateEndpoint(), endpoint is disabled and then a wait for this disable to come active is performed by

    while ((USBx_INEP(ep->num)->DIEPINT & USB_OTG_DIEPCTL_EPDIS) == USB_OTG_DIEPCTL_EPDIS);

and

    while ((USBx_OUTEP(ep->num)->DOEPINT & USB_OTG_DOEPINT_OTEPDIS) == USB_OTG_DOEPINT_OTEPDIS);

for IN and OUT endpoints, respectively.

 

Both are wrong.

 

USB_OTG_DIEPINT_EPDISD and USB_OTG_DOEPINT_EPDISD should be used as the mask for IN and OUT, respectively.

 

JW

Outcomes