3.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

    • Backed up Peripheral Reset

  • Based on 2 Embedded Power on 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

NameDescription
RSTC_InitializeInitializes RSTC module with the user configuration
RSTC_ResetResets 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_NRSTPinReadThis API used to read the NRST pin level, sampled on each "Master Clock(MCK)" rising edge
RSTC_ResetCauseGetReports the cause of the last reset
RSTC_CallbackRegisterAllows a client to identify a callback function

Data types and constants

NameTypeDescription
RSTC_RESET_CAUSEStructIdentifiers for the cause of reset
RSTC_RESET_TYPEEnumIdentifiers for the type of reset
RSTC_CALLBACKTypedefRSTC Callback Function Pointer