Skip to main content
January 29, 2021
Solved

STM32L4 USB BCD Bug

  • January 29, 2021
  • 2 replies
  • 1438 views

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.
Best answer by Houda GHABRI

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
February 2, 2021

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
July 25, 2021

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.