Skip to main content
Visitor
September 30, 2026
Question

STM32H503 FLASH_ECCDETR incorrect OTP ADDR_ECC min value?

  • September 30, 2026
  • 0 replies
  • 3 views

I have been writing some code to recover from the NMI after reading unwritten OTP addresses but I found a bit of a snag when checking that the Address listed in FLASH_ECCDETR is what I would expect after a read.

The Table 42 of the H503 reference manual (RM0492 Rev 2) lists a minimum ADDR_ECC offset of 0x0600. I was a little unsure what exactly this meant but `HAL_FLASHEx_GetEccInfo()` clearly runs:

// FLASH_ADDRESS_OFFSET_OTP is defined as 0x600 as you would expect here
pData->Address = (FLASH_OTP_BASE + ((addr_reg - FLASH_ADDRESS_OFFSET_OTP) * 4U)) & 0xFFFFFFFFU;

Seems simple enough then - the number is just which OTP word triggered the error minus 0x600.
Except the actual offset I am seeing in the address field is 0x200 instead of 0x600.

Reading an unwritten OTP at 0x08FFF010 gives me an ADDR_ECC of 0x204, reading 0x08FFF020 gives me 0x208, and so on...

Is this an error in the Reference Manual and HAL? Should the listed value be 0x200 or am I missing something here?

 

Thanks!