STM32 SRAM HW parity - a meaningful product feature?
- November 7, 2019
- 6 replies
- 2682 views
Hardware parity generation and check mechanism can be found in the datasheet of several STM32 controllers (e.g. STM32F0/3x/L4x, etc.).
I have here a few questions/concerns related to this feature and would be grateful if these could be addressed:
1) Use of the feature
Based on the reference manual of related devices (e.g. STM32F0xx), HW parity check is capable of detecting faults only (not correcting e.g. in case of single event upsets).
Furthermore, detecting here means notifying that data have been modified "externaly", but not identifying the cause (e.g. affected address like in case of an MPU fault.)
I used the following procedure to configure and test the feature (the firmware was launched via an onboard debugger over SWD):
a) Enable HW parity check in option bytes (OB) of the flash (SRAM2_PE/RAM_PARITY_CHECK flag in FLASH OB).
b) (optional) Cleanup the SRAM2 area (in this case, SRAM2 was protected).
c) Enable interrupts.
d) Pause debugging.
e) Inject a fault in SRAM2 (by manipulating memory with debugger over SWD).
f) Resume debugging.
Ok, the controller triggers an NMI (NonMaskableInt_IRQn).
However, it was expected that (in addition to the NMI) the SPF/PEF flag in the SYSCFG_CFGR2 register is set, but was not.
To make sure that the NMI is comming from the HW parity check mechanism and not from some other source, I repeated the sequence with disabled HW parity check and the behavior is as expected, i.e. no NMI in this case.
My questions:
* Did someone experienced the same issue with the SPF/PEF flag (or could there be an issue with the sequence above)?
* Is there a "better" way to verify/test the feature?
* Is there a way to identify the faulty memory address?
Thanks!
Zike
(The remaining points are just general points/concerns and are provided in the attachment.)
