Skip to main content
SPetr.9
Associate
May 1, 2023
Question

Why am I getting a hardfault when attempting to read unique device ID?

  • May 1, 2023
  • 1 reply
  • 928 views

When I try to read unique device ID register (96 bits) byte by byte I get a hardfault. I can however read it in word by word.

In the reference manual is specified :

"The 96-bit unique device identifier can also be read in single bytes/half-words/words in

different ways and then be concatenated using a custom algorithm."

Does anyone know the reason why it can't be read in single bytes?

I am using STM32H7A3 chip.

Sample code :

uint8_t first_byte = (*((uint8_t*) UID_BASE)); // UID_BASE is 0x08FFF800. This cause a hardfault
uint32_t first_word = (*((uint32_t*) UID_BASE)); // This works fine

Thanks

This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
May 1, 2023

Can't say I've noticed on the H7, on the U5 thing were faulting.

Had issues in the past with DBGMCU area reading the DEVID values, something that breaks the library when checking Step Y vs V functionality.

If you need to process byte-wise, perhaps move to a holding buffer in RAM.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
SPetr.9
SPetr.9Author
Associate
May 2, 2023

Thanks, I tried copying to RAM (word by word) and that works fine. I was just wondering why it can't be read byte by byte when in reference manual is specified that it can.