Unknown type name errors in usb device libraries
- February 10, 2025
- 3 replies
- 3921 views
Hello,
I am trying to create a project using the STM32F429ZIT6 board, but whenever I activate and try to use the usbd libraries, I get countless "error: unknown type name 'USBD_ClassTypeDef'" and similar errors. For some reason, the library usbd_def.h is not "seen" by the other usbd libraries, and all the definitions aren't being imported despite all the header files including usbd_def.h, whether directly or indirectly. I have tried changing the header files to only directly include usbd_def.h, but there's always one file that doesn't seem to want to work; for me, it is usbd_cdc.h. Am I missing something obvious when setting up the project?
I am using STM32CubeIDE 1.17 and the firmware is "STM32Cube_FW_F4_V1.28.1", which should be the latest firmware. The steps I took to create these errors are:
- I created the project via File -> New -> STM Project
- I selected the STM32F429ZIT6 Board and generated the ioc file
- I changed a few things in the ioc file:
- I added 2 address bits at PD11 and PD12
- I changed PG10 to FMC_NE3 and enabled NOR Flash/PSRAM/SRAM/ROM/LCD 1, to chip select -> NE3, 18 Address bits, and 16 data bits, and enabled write operation
- I changed USB_OTG_HS, Internal FS Phy -> Device Only, and enabled USB_DEVICE (Class for HS IP to Virtual Port Com)
- After saving and generating code, I included usbd_cdc.h to my main.h header. Building it generates 308 errors
After fiddling with the code for some time, I can reduce the errors to around 43 or so when I remove some circular dependencies between the usbd libraries. Still, there shouldn't be any errors with the generated code in the first place, which makes me wonder what I'm doing wrong. I saw that there was one forum post in the past that was similar, but the problem they had was outdated firmware. Attached is the console output for the errors.
