Purpose
This basic example shows how to use the Reset Controller (RSTC) peripheral available on SAM devices. The RSTC handles all the resets of the system, reports which reset occurred last and also drives independently or simultaneously the external reset and the peripheral and processor resets.
Requirements
- This example can be used with SAM evaluation kits
- Optional: An oscilloscope connected to the evaluation kit's NRST signal
Description
Upon startup, the program displays the reset controller status and a menu to perform the following:
* Menu:
* 0 - Reset Status information.
* 1 - User Reset enable.
* 2 - User Reset disable.
* 3 - User Reset interrupt enable.
* 4 - User Reset interrupt disable.
* 5 - Software Reset.
* 6 - Watchdog Reset.
* 7 - NRST assert.
The menu can be used to initiate several types of reset and to enable/disable the User Reset interrupt.
Main Files
Compilation Information
This software is written for GNU GCC and IAR Embedded Workbench® for Atmel®. Other compilers may or may not work.
Usage
- Build the program and download it into the evaluation board.
- On the computer, open and configure a terminal application (e.g., HyperTerminal on Microsoft® Windows®) with these settings:
- 115200 baud
- 8 bits of data
- No parity
- 1 stop bit
- No flow control
- Start the application.
- In the terminal window, the following text should appear:
* -- RSTC Reset Controller Example --
* -- xxxxxx-xx
* -- Compiled: xxx xx xxxx xx:xx:xx --
*
* Reset info : General Reset, NRST=1, User Reset=0
*
* Menu:
* 0 - Reset Status information.
* 1 - User Reset enable.
* 2 - User Reset disable.
* 3 - User Reset interrupt enable.
* 4 - User Reset interrupt disable.
* 5 - Software Reset.
* 6 - Watchdog Reset.
* 7 - NRST assert.
- Press one of the keys listed in the menu to perform the corresponding action.
- Press '1': The following message is displayed:
User Reset enabled - Press evaluation kit RESET button to test.
If the evaluation kit's reset button is pressed the last reset source will be displayed and the menu shown again.
- Press '2': The following message is displayed:
User Reset enabled - Press evaluation kit RESET button to test.
If the evaluation kit's reset button is pressed it will have no effect on the system.
- Press '3': The following message is displayed:
User Reset interrupt enabled..
If the evaluation kit's reset button is pressed the following message will be displayed. User Reset IRQ triggered. Press any console key for the menu
- Press '4': The following message is displayed:
User Reset interrupt disabled.
If the evaluation kit's reset button is pressed it will have no effect on the system.
- Press '5': The following message is displayed:
Software Reset activated.
The evaluation kit will perform a software reset, the last reset source will be displayed and the menu shown again.
- Press '6': The following message is displayed:
Watchdog Reset will trigger in 3 seconds.
The evaluation kit will perform a watchdog reset, the last reset source will be displayed and the menu shown again.
- Press '7': The following message is displayed:
NRST asserted.
The evaluation kit will assert the NRST signal for 60µs. - Note
- The "NRST assert" menu option requires an oscilloscope connected to the evaluation kit's NRST signal. To avoid a hardware conflict during the test do not use the evaluation kit's manual RESET button.