cancel
Showing results for 
Search instead for 
Did you mean: 

Differentiation between USB_OTG_HS and USB_OTG_FS in STM32F4xx

nagahimanshu7
Associate

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

2 REPLIES 2
FBL
ST Employee

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 Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!
TDK
Guru

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".