
4
Example code
An example code that includes the FCCU settings and how to inject the faults according to the above list is
available upon request. This is the summary of the actions done in the example code:
•
Initialize the MCU (clocks and IPs);
•
Reset the RGM and clear its registers;
•
Initialize the FCCU for all the testable faults:
–
Enabled the FCCU input
–
Set the FCCU input as SW recoverable
–
No reset action (except for SWT_2 input)
–
Enable Interrupt with timeout (FCCU state machine goes to alarm state in case of fault)
–
Enable output pins
•
For each fault identified as "testable" the software:
–
Verify the FCCU status before injection
◦
If it is in normal state, proceed, otherwise, if it is in alarm or fault state, stop
–
Inject it (using the registers of the monitor or using fake fault injection or a SW procedure, if possible)
–
Verify the FCCU status after injection
◦
If it is in alarm state, proceed, otherwise, if it is in normal or fault state, stop
◦
Check FCCU reaction (IRQ and relevant FCCU fault flag)
◦
Clear the monitor fault and the FCCU alarm state
◦
Verify the FCCU status after recovering from alarm
•
If it is in normal state, proceed, otherwise, if it is in alarm or fault state, stop
AN5752
Example code
AN5752
-
Rev 1
page 25/35