Skip to main content
Graduate
June 6, 2024
Solved

STM32H5 ECC errors and ICACHE invalidation

  • June 6, 2024
  • 2 replies
  • 1874 views

Should ICACHE be invalidated when a double ECC error occurs?

    This topic has been closed for replies.
    Best answer by Sarra.S

    Hello @PieterG, sorry for the delayed answer, 

    When two ECC errors occur during a read, the flash interface sets the double error detection flag ECCD in the FLASH_ECCDETR register

    and when this flag is raised, an NMI is generated, and the software must invalidate the instruction cache (CACHEINV = 1) in the NMI interrupt service routine when the ECCD flag is set.

    I hope that answers your question! 

    2 replies

    ST Employee
    June 7, 2024
    PieterGAuthor
    Graduate
    June 7, 2024

    Maybe I've overlooked it, but I have read the article several times and it does not mention how ECC errors are to be handled?

     

    I am quite sure that I read about invalidating ICACHE after a double ECC error, but I cannot find it anymore in the official documentation, nor any of the examples.

    Does it make any sense to invalidate ICACHE when a double ECC error occurs in FLASH? Or is there no need for that? 

    Sarra.SAnswer
    ST Employee
    June 20, 2024

    Hello @PieterG, sorry for the delayed answer, 

    When two ECC errors occur during a read, the flash interface sets the double error detection flag ECCD in the FLASH_ECCDETR register

    and when this flag is raised, an NMI is generated, and the software must invalidate the instruction cache (CACHEINV = 1) in the NMI interrupt service routine when the ECCD flag is set.

    I hope that answers your question! 

    PieterGAuthor
    Graduate
    June 20, 2024

    Thank you @Sarra.S for your answer.

    I guess invalidating the ICACHE is only necessary when ICACHE is enabled for the flash sector in which the error occurred? (in other words, I do not have to invalidate ICACHE for double ECC errors in OTP / EDATA for which I disabled caching in the MPU)

    ST Employee
    June 20, 2024

    Yes!