This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can’t compile KEIL MDK with STM32CubeMX middleware USB components due to missing header file (usbd_def.h)

Dear readers,

I’m developing a SW project with KEIL MDK Plus (V5.25) and the STM32CubeMX (V6.5) tool. The target processor is the STM32F303VCTx and everything goes well until I added a USB device to the project.

Before I describe the issue  I’d like to ask some basic questions for a better comprehension:

When I generate the code with CubeMX a new KEIL project is generated in the path

…\RTE\Device\STM32F303VCTx\STCubeGenerated\MDK-ARM

and the original KEIL project is going to be updated by CubeMX. May I understand the two KEIL projects as a generated output which shares some common resources ?

  • What is the reason for the second (new) generated project ? Is it connected to the stand alone concept from STM ?
  • Due to the original KEIL project contains all the developed code I’d like to continue with this project. Is there any reason against this ?
  • Do I need a special configuration settings to make sure that I receive everything from CubeMX?

 

The problem appears when I added a USB device and the Middleware class USB_DEVICE with HID. After generating code and compiling the project I received the following message:

 

./RTE/Device/STM32F303VCTx/STCubeGenerated/Inc\usb_device.h(33): error: 'usbd_def.h' file not found

 

In principle, it’s possible to fix this by adding manually some groups from the generated cubeMX code and with some include path from my local  STM32Cube repository but I’m not sure whether this is the right way?

I guess I have to add the USB port to the run time environment. Is this correct:

CubeMX looks like this:

 

and the KEIL project folder looks like this:

 

Any suggesting how to solve the missing groups, paths and entries in the KEIL project ?

 Thanks in advance.

Best regards

Norbert

Parents
  • Hello Andreas ,

    Thanks for your message and the copy to the open support case.

    I copied the configuration from the STM32303E-EVAL example project and the project is compileable now! I think you are right that I have to decide between the USB HID from Cube and KEIL middleware. I changed the device class from HID to the CDC class but in principle the config of the run time environment looks like this:

    and with Cube I have to enable the USB device only without the middleware component.

    Unfortunately the host can't connect and read the descriptor of the USB device and I'm still searching for other bugs. Maybe there is something wrong with the hardware - I have to find out ... 

    Best regards

    Norbert

Reply
  • Hello Andreas ,

    Thanks for your message and the copy to the open support case.

    I copied the configuration from the STM32303E-EVAL example project and the project is compileable now! I think you are right that I have to decide between the USB HID from Cube and KEIL middleware. I changed the device class from HID to the CDC class but in principle the config of the run time environment looks like this:

    and with Cube I have to enable the USB device only without the middleware component.

    Unfortunately the host can't connect and read the descriptor of the USB device and I'm still searching for other bugs. Maybe there is something wrong with the hardware - I have to find out ... 

    Best regards

    Norbert

Children
No data