2023-08-23 11:55 PM - edited 2023-08-23 11:56 PM
on STM32U575 when I enable the ECC, it is throwing a Hard Fault. I am just doing RAMCFG_Init() & StartECC() as of now. The system keeps resetting. TrustZone is enabled for the project, will that make any difference?
2023-08-24 04:18 AM
Hi,
Firstly, it's important to understand that ECC is a method used to detect and correct errors in memory. When you enable ECC, the system will generate a Hard Fault when it detects an error that it cannot correct. This is a normal behavior of the system to prevent it from continuing with corrupted data.
However, if you are getting a Hard Fault immediately after enabling ECC, it could be due to an issue with the initialization of the ECC or the SRAM3.
Regards
2023-08-24 04:23 AM
Hi,
Thank you for the reply. As in this case, I have not enabled any interrupt for single or double errors. I am just enabling the ECC feature. So I believe there is some issue with the initialization.
I further checked the addresses of the Bus fault & MemManage fault and that is the same as the start address of the reserved last 64 KB of SRAM3 by ECC. So, again I believe that ECC trying to change this configuration is causing issues, but I don't know how to resolve that.
Correct me if I am wrong anywhere.
Thanks & regards
2023-08-24 05:03 AM - edited 2023-08-24 05:05 AM
Can you initialize (write) the whole RAM _before_ enabling ECC?
HardFault occurs if handling of other (un-masked) exceptions is not enabled so they propagate up to HardFault.
2023-08-24 05:58 AM
Hello @JigarGoswami,
You may need to refer to the reference manual section 6.3.2 Error code correction (SRAM2, SRAM3, BKPSRAM).
When the ECC is enabled for SRAM3, only the first 256 Kbytes of SRAM3 are with ECC.
The next 192 Kbytes for STM32U575/585 or 512 Kbytes for STM32U59x/5Ax/5Fx/5Gx are without ECC, and the last block is used to store the ECC, so cannot be used for application.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-08-28 02:35 AM
Hello Belaid,
Thank you, I referred to that.
I have one doubt. Will the last 64 KB of SRAM3 be reserved only when ECC is enabled for SRAM3?
or it does not matter if I enable ECC on SRAM3 or not.
What if I only enable ECC for SRAM2 alone? in that case, will it reserve the last 64 KB of SRAM3?
2023-08-28 09:47 AM
Hello again @JigarGoswami,
Hope this helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-12-13 12:13 PM
I was well beyond my wits end trying to understand what in the seven hells was raising a hard fault. Null pointer exception?! Where? SRAM3 Ecc...
Thanks a million.