cancel
Showing results for 
Search instead for 
Did you mean: 

MX_USB_DEVICE_Init() function call is not automatically add to main()

Xxoyo.1
Associate III

I have added the USB device via the CubeMX within STM32CubeIDE, however it have not automatically add the MX_USB_DEVICE_Init() function call at the main function. Do I have to enable something for this ? Or I'll have to manually add them myself?

0693W00000ANcLmQAL.png0693W00000ANcLrQAL.png0693W00000ANcM1QAL.png

1 ACCEPTED SOLUTION

Accepted Solutions
BParh.1
Senior III

Is your application enabling FreeRTOS? If yes, check on the function task, it seems cubemx put it there instead of main body.

In fact from your snippet, it might me in TouchGFX task function where they put it as __weak. But since TouchGFX task override it, that is why it was not called and therefore you have to manually add it

View solution in original post

2 REPLIES 2
BParh.1
Senior III

Is your application enabling FreeRTOS? If yes, check on the function task, it seems cubemx put it there instead of main body.

In fact from your snippet, it might me in TouchGFX task function where they put it as __weak. But since TouchGFX task override it, that is why it was not called and therefore you have to manually add it

Yes you're right, the MX_USB_DEVICE_Init call is placed inside the weak TouchGFX task. So it seems theres no other way but to manually add the init code ..