cancel
Showing results for 
Search instead for 
Did you mean: 

Unknown type name errors in usb device libraries when building basic project for STM32F429ZIT6

jchang98
Associate II

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:

  1. I created the project via File -> New -> STM Project
  2. I selected the STM32F429ZIT6 Board and generated the ioc file
  3. I changed a few things in the ioc file:
    1. I added 2 address bits at PD11 and PD12
    2. 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
    3. I changed USB_OTG_HS, Internal FS Phy -> Device Only, and enabled USB_DEVICE (Class for HS IP to Virtual Port Com)
  4. 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.

6 REPLIES 6
Ghofrane GSOURI
ST Employee

Hello @jchang98 

I would like to thank you for posting.

Currently, I am investigating the issue mentioned above.

It would be great if you could share your IOC so that I can check your configuration. 

THX

Ghofrane

Ghofrane GSOURI
ST Employee

Hello @jchang98 

When I followed the steps mentioned above :

Using PD11 and PD12 as address bits will cause a conflict with the FMC_NE3 (Flexible Memory Controller Chip Select 3) signal. This conflict will result in the FMC becoming partially disabled, limiting the maximum number of address bits you can use to 16 bits instead of the intended 18 bits

GhofraneGSOURI_0-1739352506666.png

To avoid this issue, I recommend selecting different GPIO pins for the address bits, such as PC13 and PC14. This will ensure that the FMC functionality remains fully operational.

 Additionally,  the usbd_cdc.h file  have been  successfully included in my project, and the project was built with 0 errors and 0 warnings. Here is the IOC configuration for your reference.

 

Hi Ghofrane,

Here is my .ioc file. For PD11 and PD12, I had them assigned as FMC_A16 and FMC_A17, respectively. I thought these were address bits but I could be wrong. 

I downloaded and imported the ioc file that you have given, but I still get the same problem when I include "usbd_cdc.h" in main.h. Maybe it's a problem with my setup?

 

 

 

Merged into the original thread - please don't start multiple threads on the same topic.


Hello,

I had a previous post about this issue but it was not resolved. The proposed ioc file solution did not work when I ran it on my system.

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:

  1. I created the project via File -> New -> STM Project
  2. I selected the STM32F429ZIT6 Board and generated the ioc file
  3. I changed a few things in the ioc file:
    1. I added 2 address bits at PD11 and PD12
    2. 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
    3. I changed USB_OTG_HS, Internal FS Phy -> Device Only, and enabled USB_DEVICE (Class for HS IP to Virtual Port Com)
  4. 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 as well as my ioc file.


@jchang98 wrote:

4. After saving and generating code, I included usbd_cdc.h to my main.h header. Building it generates 308 errors


Where, exactly, did you include it?

Maybe the order matters?

Perhaps get a preprocessor listing to see what the compiler's seeing?

 


@Ghofrane GSOURI wrote:

 Additionally,  the usbd_cdc.h file  have been  successfully included in my project, and the project was built with 0 errors and 0 warnings.


@Ghofrane GSOURI perhaps you could also share where, exactly, did you include it?

jchang98
Associate II

I included it where there are comments saying where user private includes should be written. Is this wrong? 

Screenshot 2025-03-12 144135.png

As far as I know, the other included file does not depend on usbd_cdc.h, and vice versa.