cancel
Showing results for 
Search instead for 
Did you mean: 

USE_USB_FS define in v1.25.0 not generated in Makefile

paradajz
Associate

Firmware package v1.25.0 introduced new define for USB stack called USE_USB_FS. This isn't generated anywhere even when USB speed in CubeMX is set to "Device Full Speed 12MBit/s". Previously, the following defines have been used (and they still are!):

DEVICE_FS=0

DEVICE_HS=1

So you could pass to USBD_Init as last argument either DEVICE_FS (0) or DEVICE_HS (1) which worked fine. However, USBD_RegisterClass now has the following code block:

#ifdef USE_USB_FS

pdev->pConfDesc = (void *)pdev->pClass->GetFSConfigDescriptor(&len);

#else /* USE_USB_HS */

pdev->pConfDesc = (void *)pdev->pClass->GetHSConfigDescriptor(&len);

#endif /* USE_USB_FS */

Since I define my own ConfigDescriptors, I've set HS descriptor to NULL. Now, guess what happens since USE_USB_FS isn't defined anywhere? The program crashes - null pointer is accessed obviously.

Solution: If "Device Full Speed 12MBit/s" is checked in CubeMX, CubeMX should add USE_USB_FS to the list of defines.

3 REPLIES 3
LSalv.1
Associate

Hi. I have the same problem with custom MIDI class. I tried adding the #define manually in several places and it didn't work. Could you make it run?

JMD
Associate II

Hello, I have the same problem with custom HID class. And #define doesn't work but if I comment #ifdef USE_USB_FS and keep only pdev->pConfDesc = (void *)pdev->pClass->GetFSConfigDescriptor(&len); for example in my case It seems to be work.

JMD
Associate II

You need to add USE_USB_FS Define symbols in your project.