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

The following fault interrupt handlers are implemented in the PRIME Reset Handler library:
  • Hard Fault
  • Memory Management
  • Bus Fault
  • Usage Fault
  • Watchdog
When an error interrupt is triggered, this library stores in GPBRs the value of several registers, the number of resets and the reset type.

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
    GPBRContents
    5number of resets + reset type
    6PC
    7LR
    8PSR
    9HFSR
    10CFSR
    11R0
    12R1
    13R2
    14R3
    Table 1-15. PIC32CXMT Reset Information in Base Node
    GPBRContents
    0number of resets + reset type
    1PC
    2LR
    3PSR
    4HFSR
    5CFSR
    6R0
    7R1
    8R2
    9R3
    10R12
  • For SAME70 devices:
    Table 1-16. SAME70 Reset Information in Slave Service Node
    GPBRContents
    5number of resets + reset type
    6PC
    7LR
    Table 1-17. SAME70 Reset Information in Base Node
    GPBRContents
    0number of resets + reset type
    1PC
    2LR
    3PSR
    4HFSR
    5CFSR
    6R0
    7R1
  • 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.

Reset sources 0 - 4 are already defined in 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.