2022-10-03 11:48 PM
Hi everyone,
I am trying to implement SRAM Parity bit check in my application. But when I am enabling it from option byte. and then it is going into Hardfault whenever I am going into debug mode before running application even it is going into .Hardfault.
Please let me know how I can implement SRAM Parity bit check?
Thanks
2022-10-04 05:48 AM
Hi @imran.aftab ,
you may be reading uninitialized memory. There the parity is often wrong. What product are you using?
BR,
J
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.
2022-10-06 08:34 AM
Thanks @JHOUD for quick response.
We are using STM32G0B1CBT.
Can you give some example please how I can implement it?
2022-10-06 09:46 PM
It sounds like the parity check is working properly, alerting the application that uninitialized (therefore unreliable content) memory is being read. Not sure about the STM32G0 series but on the STM32L4 series with parity SRAM I always clear it to zeroes at C runtime startup, along with application RAM variables. I use my own startup code, not sure what the ST code generator does, or if you can modify the startup routine.
With parity enabled you cannot read before write, even if you think the SRAM section survived a reset intact. The purpose of the parity check is to increase the reliability of SRAM based code, which implies you have already copied the relevant code sections from flash, similar to the way C variables are initialized with a specific value.