cancel
Showing results for 
Search instead for 
Did you mean: 

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

peterdonchev
Associate III

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

0 REPLIES 0