Question
STMCube USB Host code not working
Posted on April 08, 2014 at 11:51
Hi,
I can't get the USB Host code generated by STMCube to work. When I connect a device, none of the interrupts get triggered - the software doesn't seem to recognize it at all. The peripheral clock is enabled and the interrupts are getting set, I see this function get called in usbh_conf.c in the debugger:void
HAL_HCD_MspInit(HCD_HandleTypeDef* hhcd){
GPIO_InitTypeDef GPIO_InitStruct;
if
(hhcd->Instance==USB_OTG_FS)
{
/* Peripheral clock enable */
__USB_OTG_FS_CLK_ENABLE();
/**USB_OTG_FS GPIO Configuration
PA11 ------> USB_OTG_FS_DM
PA12 ------> USB_OTG_FS_DP
*/
GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* Peripheral interrupt init*/
/* Sets the priority grouping field */
HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);
HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(OTG_FS_IRQn);
}
}
But I never see the interrupt routines run or the user callback functions get called. My device is definitely receiving power from the bus. Is there anything obvious I'm missing?
Thanks
Bert
#stm32f4 #usb #stm32cubemx-bug-hsi-usb-48mhz