cancel
Showing results for 
Search instead for 
Did you mean: 

Error in the generated USB CDC code for the M4 core (STM32H474)

peterdonchev
Senior

STM32CubeMX 6.13.0
MCU: STM32H747

The generated code for USB device, class: CDC on Core M4 causes HardFault.
The reason is the following definitions in the usbd_desc.c file:

 

#define DEVICE_SERIAL0     (*(uint32_t *) 0x11223344)
#define DEVICE_SERIAL1     (*(uint32_t *) 0x55667788)
#define DEVICE_SERIAL2     (*(uint32_t *) 0x12345678)

 

The code should probably look like this:

 

#define DEVICE_SERIAL0     (0x11223344)
#define DEVICE_SERIAL1     (0x55667788)
#define DEVICE_SERIAL2     (0x12345678)

 

Note: the literals come from the STM32CubeMX tool:

peterdonchev_0-1737376888375.png

The code for the M7 core uses the UID for a serial number, but the M4 core does not have access to the system memory region.
Regards,
Peter

1 REPLY 1
Ghofrane GSOURI
ST Employee

Hello @peterdonchev 

First let me thank you for reporting.

I'm currently checking this issue . I will get back to you asap.

THX

Ghofrane