2019-04-29 01:29 AM
Hello!
I have project created with CubeMX. I coded a lot there and then I wanted to add a USB CDC device with CubeMX. After code generation I compiled the project and I got an error message:
../Inc/usb_device.h:61:22: fatal error: usbd_def.h: No such file or directory
I did some research and some had the problem that the path name hat spaces in it. That was not the case with my path. I thought my path was too long maybe, so I changed the name of the folder created by CubeMX "STM32_USB_Device_Library" to "STM32_USB". Then this error message disapeared but another one appeared.
../Inc/usbd_audio_if.h:59:68: fatal error: ../Middlewares/ST/STM32_USB/Class/AUDIO/Inc/usbd_audio.h: No such file or directory
I don´t know what to do anymore and why is this audio.h file needed anyway for a CDC USB device?
Any help is welcome
2019-04-29 02:29 AM
Which Target could or Target kit?
Which compiler?
2019-04-29 02:43 AM
Hello @benjamin Gräf , could you please share your ioc file ?
Best Regards,
Khouloud.
2019-04-29 03:14 AM
2019-04-29 03:44 AM
I generate the code with both True Studio and IAR, and I did not find any error, please use the latest CubeMX version (5.2.0).
Best Regards,
Khouloud.
2019-04-29 04:24 AM
I did upgrade to the latest version. Did not change anything.
Best regards,
Benjamin
2019-04-30 02:51 AM
Ok I reinstalled CubeMX. After regenerating the code the whole filesystem changed which caused a little bit of confusion but now it is working.
thanks,
best regards,
Benjamin
2019-04-30 02:58 AM
Hi @benjamin Gräf , my suggestion is for you to start a fresh project with your latest toolchain.
Apply only the USB CDC IP -> build and test. Do not insert any other of your custom code. Does the basic (wizard generated) USB CDC IP work on your target hardware?
Is the CPU on some custom hardware or using an official ST kit? If ST kit, which one?
Can you share any details of the wiring of the USB interface with your CPU? A partial schematic will be of help.
Also, review this thread and please post back your results:
https://community.st.com/s/question/0D50X00009fFsXXSA0/stm32f303-usb-cdc-tutorial
2019-04-30 03:05 AM
Hi, the CPU is on a custom hardware. I did build a fresh project with nothing but the USB code. Testing will be done next week due to hardware deliverie issues.
Anyway i am able to compile now, which was the problem. Getting it to work should be straight forward since I already have done this once.
best regards,
Benjamin
2021-04-01 06:03 AM
Hi Benjamin,
I experienced the same problem of losing usb driver "usbd_def.h" automatically created by CubeMX. Before getting crazy, I configured IO for output. Miracle is happening, error disappeared! It seems the IDE has some bugs. Don't waste more time on this supid tools