cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F412Cx USB CDC: HAL_GPIO_EXTI_Callback() generated in usbd_conf.c

fronders
Senior

The bug has been reported to CubeF4 github back on Jan 21 2021, but only on 26 Apr 2021 I got the feedback this is out of scope for them and asking to repost here. https://github.com/STMicroelectronics/STM32CubeF4/issues/57

Duplicating text below:

I am using CubeMX v6.1.1 with CubeF4 v1.25.2 to generate code for STM32F412CGUx with STM32CubeIDE.

The app generates usbd_conf.c with following function included:

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

This causes linkage errors when there is a user-implemented EXTI Callback.

The issue happens regardless of VBUS Sensing setting in CubeMX - even when it is off, the callback still gets generated (not saying it should be generated that way when VBUS Sensing is on, because it is messing up the use of callback by user).

This was reproducible with STM32F412RE but NOT with STM32F446RE or STM32F411CEUx

Please see generated files attached.

USB Peripheral and Middleware settings used:

0693W00000AMW3HQAX.png0693W00000AMWPRQA5.png

1 REPLY 1

Hello @fronders​ ,

Thanks for your feedback and for raising this issue, you're right HAL_GPIO_EXTI_Callback() is generated in the usbd_conf.c file regardless of VBUS Sensing setting in CubeMX.

This problem was already reported to our development team to be fixed as soon as possible. I'll surely keep you posted with updates.

Sorry for any inconvenience that this may cause.

Thanks a lot for you contribution.

Khouloud.