cancel
Showing results for 
Search instead for 
Did you mean: 

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

AHoll.2
Associate II

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

2 REPLIES 2
TDK
Guru

There aren't any hooks into that part of the code that you can modify without touching non-user code sections. You just need to change it, or lobby ST to change it.

Related:

https://community.st.com/s/question/0D53W00000kwm3I/stm32h755-m4-core-unable-to-read-uid-and-therefore-usb-drivers-do-not-work

https://community.st.com/s/question/0D53W000002diUsSAI/stm32cubemx-h7x5h7x7-usb-cdc-bug

https://community.st.com/s/question/0D53W00000wV42MSAS/how-to-set-up-hs-cdc-of-stm32h747disco-in-cubemx621

If you feel a post has answered your question, please click "Accept as Solution".
AHoll.2
Associate II

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?