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

2 REPLIES 2
Ghofrane GSOURI
ST Employee

Hello @peterdonchev 

First let me thank you for reporting.

Issue has been raised to dev team .

Internal  ticket number :205984

I will keep you posted with updates.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Semer CHERNI
ST Employee

Hello @peterdonchev 

The issue is fixed in the latest release of the STM32CubeMX (6.14.1).

KR,
Semer.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.