Skip to main content
RMart.0
Associate III
Dec 7, 2020 4:29 PM UTC
Solved

STM32CubeMx sometimes not generating MX_USB_DEVICE_Init()

STM32CubeMX v6.1.0, H7 lib v 1.8.0

is generating code where main() calls MX_USB_DEVICE_Init();, but MX_USB_DEVICE_Init does not seem to be defined anywhere.

int main(void)
{
...
 
 /* Initialize all configured peripherals */
 MX_GPIO_Init();
...
 MX_USB_DEVICE_Init();
 
...}

Also worth noticing that MX_USB_DEVICE_Init "line" can be seen in Project Manager-> Advanced Settings, but the Visibility (Static) box cannot be marked:

0693W000006EtI2QAK.pngChange the order/rank of MX_USB_DEVICE_Init did not work around the issue :(

Is this a know issue or do I need to set something extra to get that function's implementation?

This topic has been closed for replies.
Khouloud ZEMMELI
Khouloud ZEMMELIBest answer
ST Employee
Dec 8, 2020 6:59 AM UTC

Hi @RMart.0​ 

The Visibility (Static) check-box is always unchecked because the MX_USB_DEVICE_Init function is already defined in usb_device.c file (under your_project\USB_DEVICE\App).

If you still can't find the MX_USB_DEVICE_Init function, please share your ioc file.

Thanks, Khouloud

1 reply

Khouloud ZEMMELI
Khouloud ZEMMELIBest answer
ST Employee
Dec 8, 2020 6:59 AM UTC

Hi @RMart.0​ 

The Visibility (Static) check-box is always unchecked because the MX_USB_DEVICE_Init function is already defined in usb_device.c file (under your_project\USB_DEVICE\App).

If you still can't find the MX_USB_DEVICE_Init function, please share your ioc file.

Thanks, Khouloud