Possible stm32G0 cube mx generation Error for usb
While setting up a project using cubeMx for a stm32G0, I stumbled across a possible error on the USB_device files. This error resulted in the usb reset handler stalling the machine. My project specifies the USB as full speed and looking in the generated usbd_conf.c, I found the following lines in HAL_PCD_ResetCallback
USBD_SpeedTypeDef speed = USBD_SPEED_FULL;
if (( hpcd->Init.speed != USB_DRD_SPEED_FS) || (hpcd->Init.speed != USB_DRD_SPEED_LS))
{
Error_Handler();
}
/* Set Speed. */
USBD_LL_SetSpeed((USBD_HandleTypeDef*)hpcd->pData, speed);
/* Reset Device. */
USBD_LL_Reset((USBD_HandleTypeDef*)hpcd->pData);In that case the line 2 test will always result in the Error_handler being called as we are indeed FS (and thus not LS). Using thins condition instead solved the usb issue :
if( hpcd->Init.speed != USB_DRD_SPEED_FS){
Error_Handler();
}Could this be an oversight in the cubeMX generation or is it that I missed something blatantly obvious ?
