Skip to main content
Associate
September 20, 2024
Question

Differentiation between USB_OTG_HS and USB_OTG_FS in STM32F4xx

Hi,

I am working on USB CDC on STM32F469NI. For USB_OTG_FS and USB_OTG_HS, the auto generated USB handles are

 
USBD_HandleTypeDef hUsbDeviceFS;
USBD_HandleTypeDef hUsbDeviceHS;

Is there any macro in HAL or while auto generation, that I can get to know which of the USB_OTG_xx is being used, so that I can extern the proper variable into my firmware?

Thanks,

Himanshu

This topic has been closed for replies.

2 replies

ST Technical Moderator
September 20, 2024

Hi @nagahimanshu7 

You can define your own macros, PCD Speed is defined in HAL and you should select one of these predefined constants:
#define PCD_SPEED_HIGH USBD_HS_SPEED
#define PCD_SPEED_HIGH_IN_FULL USBD_HSINFS_SPEED
#define PCD_SPEED_FULL USBD_FS_SPEED

Using CubeMX you can select which instance to be used.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
TDK
September 20, 2024

There isn't a macro, but the choice is based on the peripheral you've configured in CubeMX. It shouldn't be a mystery. Similar to if you used I2C1 or I2C2.

"If you feel a post has answered your question, please click ""Accept as Solution""."