AnsweredAssumed Answered

Bug in STM32cube HID code for STM32F103

Question asked by HenryL on Feb 1, 2015
Latest reply on Feb 5, 2015 by STM32Cube-T
I just started playing with the USB code for the stm32f103c8.  I found it quite impressive.  It was the only tool I tried so far that was able to produce working code for a HID device that enumerated properly.  However, I found a bug in the usb wake up interrupt handler.  The code did not clear the EXTI 18 interrupt flag, resulting in a non stop repetition of the interrupt.  This was not apparent until I tried to send a mouse report message.  I fixed it by adding the highlighted line to the user section.

void USBWakeUp_IRQHandler(void)
{
  /* USER CODE BEGIN USBWakeUp_IRQn 0 */
  __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG();    /

  /* USER CODE END USBWakeUp_IRQn 0 */
  HAL_PCD_IRQHandler(&hpcd_USB_FS);
  /* USER CODE BEGIN USBWakeUp_IRQn 1 */

  /* USER CODE END USBWakeUp_IRQn 1 */
}

Outcomes