AnsweredAssumed Answered

Which USB parameter in CubeMX cause generetion of HAL_GPIO_EXTI_Callback?

Question asked by Lambert.Julie on Feb 24, 2017
Latest reply on Nov 24, 2017 by Nils Zottmann



I have created a project in CubeMX 4.19.0 for the STM32L476JGY (Firmware package 1.6.0) in which I have a USB device in CDC mode. The code was generated for SW4STM32. Communication with a PC works fine for both RX and TX.


Now I added a GPIO in interrupt mode to my design and implemented HAL_GPIO_EXTI_Callback in my user code. Oups... The compiler says I have multiple definition of 'HAL_GPIO_EXTI_Callback'.


I found that CubeMX has generated some code for HAL_GPIO_EXTI_Callback in usbd_conf.c even though VBUS sensing parameter is set to DISABLED and no GPIO_PIN_9 is defined in my design. Here is the code generated by CubeMX:

  * @brief  GPIO EXTI Callback function
  *         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);


Which USB parameter setting should I change in CubeMX so that the HAL_GPIO_EXTI_Callback function is not generated in usbd_conf.c?