cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 USB BCD Bug

qqAnton
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions
Houda GHABRI
ST Employee

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

View solution in original post

2 REPLIES 2
Houda GHABRI
ST Employee

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

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.