Microchip® Advanced Software Framework

Quick Start guide for SAM RSTC driver

This is the quick start guide for the SAM3/4C/4CM/4CP/4E/4N/4S/G/V71/V70/S70/E70 Reset Controller (RSTC) Driver, with step-by-step instructions on how to configure and use the driver in a selection of use cases.

The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main application function.

Basic Use Case

In this basic use case, the User Reset interrupt is enabled and the main application notified about NRST signal assertion events.

Prerequisites

Setup Steps

Example Code

Add the following to the application C-file:

static volatile bool reset_interrupt_triggered = false;
void RSTC_Handler(void)
{
/* Clear the interrupt. */
reset_interrupt_triggered = true;
}

Workflow

Enable the User Reset interrupt:

NVIC_DisableIRQ(RSTC_IRQn);
NVIC_ClearPendingIRQ(RSTC_IRQn);
NVIC_SetPriority(RSTC_IRQn, 0);
NVIC_EnableIRQ(RSTC_IRQn);

Usage steps

Workflow

Add to, e.g., main loop in application C-file:

if (reset_interrupt_triggered) {
/* Critical section to access a variable that is set in an IRQ. */
reset_interrupt_triggered = false;
puts("User Reset IRQ triggered. Press any console key for the menu\r");
}