Skip to main content
Visitor II
November 21, 2021
Question

Get_SerialNum () crashes when USB middleware is used in STM32H7 CM4 core. - Workaround?

  • November 21, 2021
  • 2 replies
  • 1156 views

Hello dear people,

Of course, the reason is that Get_SerialNum () tries to read the device ID (UID_BASE), which unfortunately is not supported in CM4 core. So i get a Hard Fault.

I do have a solution getting the UID from the CM7 core, but alas, it's quite difficult to put this solution into the cube-generated source code.

One workaround would be, to have an USER CODE area somewhere before the buggy code (in USBD_HS_SerialStrDescriptor before the call of Get_SerialNum or in Get_SerialNum before the buggy code). Then i could simply execute different code and then just return, so to skip that particular code.

So can anyone tell me how to change the Cube template in that way?

Any better solutions to fix this?

Thanks in advance!

-Albert

    This topic has been closed for replies.

    2 replies

    Super User
    November 21, 2021
    AHoll.2Author
    Visitor II
    November 21, 2021

    Thanks for your answer.

    Unfortunately, none of it answeres my questions.

    These are my questions:

    Can anyone tell me how to change the Cube template in that way?

    Any better solutions to fix this?