![Smile :)](./images/smilies/icon_e_smile.gif)
I have changed the USB port configuration in /stmhal/usbd_conf.c for the USB_OTG_FS.
My Question is, in which file will set the variable ``hpcd->Instance``?
Or is decided by the driver, whether HighSpeed or FullSpeed?
thanks
Code: Select all
#define USE_USB_FS
Code: Select all
if(hpcd->Instance == USB_OTG_FS)
{
/* Configure USB FS GPIOs */
__GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_14 | GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* Configure VBUS Pin */
#if defined(MICROPY_HW_USB_VBUS_DETECT_PIN)
// USB VBUS detect pin is B13
GPIO_InitStruct.Pin = GPIO_PIN_13;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
#endif
#if defined(MICROPY_HW_USB_OTG_ID_PIN)
// USB ID pin is B12
GPIO_InitStruct.Pin = GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF12_OTG_HS_FS;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
#endif
/* Enable USB HS Clocks */
__USB_OTG_HS_CLK_ENABLE();
/* Set USBHS Interrupt priority */
HAL_NVIC_SetPriority(OTG_HS_IRQn, 6, 0);
/* Enable USBHS Interrupt */
HAL_NVIC_EnableIRQ(OTG_HS_IRQn);
}