1.5.2.1 How The Library Works
The PRIME Reset Handler service library offers the necessary functions to manage fault interrupt handlers, to store reset information and to trigger software resets.
This library needs to be initialized, but it does not need to be maintained periodically.
Reset Handling
- Hard Fault
- Memory Management
- Bus Fault
- Usage Fault
- Watchdog
Note that the information stored and the GPBRs used depend on the hardware platform and the PRIME node:
- For PIC32CXMT devices:
Table 1-14. PIC32CXMT Reset Information in Service Node GPBR Contents 5 number of resets + reset type 6 PC 7 LR 8 PSR 9 HFSR 10 CFSR 11 R0 12 R1 13 R2 14 R3 Table 1-15. PIC32CXMT Reset Information in Base Node GPBR Contents 0 number of resets + reset type 1 PC 2 LR 3 PSR 4 HFSR 5 CFSR 6 R0 7 R1 8 R2 9 R3 10 R12
- For SAME70 devices:
Table 1-16. SAME70 Reset Information in Slave Service Node GPBR Contents 5 number of resets + reset type 6 PC 7 LR Table 1-17. SAME70 Reset Information in Base Node GPBR Contents 0 number of resets + reset type 1 PC 2 LR 3 PSR 4 HFSR 5 CFSR 6 R0 7 R1 - For other MCU devices, it is not implemented yet.
Reset Sources
There are different reset types (see SRV_RESET_HANDLER_RESET_CAUSE Enum), which combine reset sources from the RSTC peripheral library and specific PRIME sources.
The reset type is read at initialization from the RSTC driver.
- GENERAL_RESET: No information is available because this is the first power-up.
- BACK_RESET and USER_RESET: The only information available is the reset type and the number of resets because the handlers are not invoked and therefore the GPBRs have not been updated.
- WATCHDOG_RESET: When the watchdog has been configured to trigger a reset instead of an interrupt, the only information available is the reset type and the number of resets because the handlers are not invoked and therefore the GPBRs have not been updated.
- SOFTWARE_RESET: If a software reset is triggered by the user application, the only information available is the reset type because the handlers are not invoked and therefore the GPBRs have not been updated. The number of resets is not updated.
The reset source FU_RESET is set during a firmware upgrade process in the PRIME Service Node and does not invoke the handlers. Therefore, the only information available is the reset type and the number of resets.
For the rest of reset sources, there is information available in the GPBRs.