1.27.16 Reset Controller (RSTC)

The Reset Controller (RSTC), based on power-on reset cells, handles all the resets of the system without any external components. It reports which reset occurred last.

  • Manages All Resets of the System, Including

    • Processor Reset

    • Backedup Peripheral Reset

  • Based on 2 Embedded Poweron Reset Cells

  • Reset Source Status

    • Status of the Last Reset

    • Either General Reset, Wakeup Reset, Software Reset, User Reset, Watchdog Reset

Using The Library

The reset controller (RSTC) peripheral library provides API to find the cause of last device reset.

RSTC for LED Switcher:

void reset_asserted (uintptr_t context)

{

 LED_Toggle();

}



int main ( void )

{

 /* Initialize all modules */

 SYS_Initialize ( NULL );

 RSTC_CallbackRegister(reset_asserted, (uintptr_t) NULL );

 while ( true )

 {

 /* Maintain state machines of all polled MPLAB Harmony modules. */

 SYS_Tasks ( );

 }

 /* Execution should not come here during normal operation */

 return ( EXIT_FAILURE );

}

Library Interface

Reset Controller peripheral library provides the following interfaces:

Functions

Name Description
RSTC_Initialize Initializes RSTC module with the user configuration
RSTC_Reset Resets the processor and all the embedded peripherals, if RSTC_RESET type is "RSTC_RESET_PROC ". Asserts the NRST pin, if RSTC_RESET type is "RSTC_RESET_EXT "
RSTC_NRSTPinRead This API used to read the NRST pin level, sampled on each "Master Clock(MCK)" rising edge
RSTC_ResetCauseGet Reports the cause of the last reset
RSTC_CallbackRegister Allows a client to identify a callback function

Data types and constants

Name Type Description
RSTC_RESET_CAUSE Struct Identifiers for the cause of reset
RSTC_RESET_TYPE Enum Identifiers for the type of reset
RSTC_CALLBACK Typedef RSTC Callback Function Pointer