Skip to main content
Jan 29, 2021 1:15 PM UTC
Solved

STM32L4 USB BCD Bug

Hello,

I use SensorTile.box with Stm32L4R9 MCU, CubeMx 6.1.1, Cube FW L4 V1.16.0

I want to configure USB like a Virtual Com Port and it work's nice.

But, when I set USB_OTG_FS->Parameter Settings->Battery Charging to Enabled CubeMX generate's such code:

/**
 * @brief Handle USB VBUS detection upon external interrupt
 * @param GPIO_Pin
 */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
 HAL_PCDEx_BCD_VBUSDetect(&hpcd_USB_OTG_FS);
}

And it doesn't check any pin, so all the GPIO callbacks run this code.

I also tried to enable VBus pin, but it's still the same .

Tell me please if I am doing something wrong or it's a bug.

Thank you,

Anton

This topic has been closed for replies.
Houda GHABRI
Houda GHABRIBest answer
ST Employee
Feb 2, 2021 4:30 PM UTC

Hi @qqAnton​ ,

I confirm ,the check on the pin name is missing in the HAL_GPIO_EXTI_Callback function.

The issue is reported internally and will be fixed.

Thanks for raising this issue.

Houda

2 replies

Houda GHABRI
Houda GHABRIBest answer
ST Employee
Feb 2, 2021 4:30 PM UTC

Hi @qqAnton​ ,

I confirm ,the check on the pin name is missing in the HAL_GPIO_EXTI_Callback function.

The issue is reported internally and will be fixed.

Thanks for raising this issue.

Houda

Rob.Riggs
Senior
Jul 25, 2021 10:15 PM UTC

There is an even worse problem lurking here. HAL_PCDEx_BCD_VBUSDetect() calls HAL_Delay() from within an interrupt context. This causes any interrupt that has a lower priority than the GPIO interrupt to not get called while BCD is running.

Please provide a way for the user to disable the generation of this function.