SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC)...

21
SMART ARM-based Microcontrollers AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver APPLICATION NOTE Introduction This driver for Atmel ® | SMART ARM ® -based microcontrollers provides an interface for the configuration and management of the device's Reset Controller functionality. The Reset Controller manages all Resets of the System including; external devices (via the NRST pin), Processor Reset and Peripheral Reset. It also provides the status of the last reset source. The following peripheral is used by this module: RSTC (Reset Controller) Devices from the following series can use this module: Atmel | SMART SAM3 Atmel | SMART SAM4C Atmel | SMART SAM4CM Atmel | SMART SAM4CP Atmel | SMART SAM4E Atmel | SMART SAM4N Atmel | SMART SAM4S Atmel | SMART SAM G The outline of this documentation is as follows: Prerequisites Module Overview Special Considerations Extra Information Examples API Overview Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

Transcript of SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC)...

  • SMART ARM-based Microcontrollers

    AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G ResetController (RSTC) Driver

    APPLICATION NOTE

    Introduction

    This driver for Atmel® | SMART ARM®-based microcontrollers provides aninterface for the configuration and management of the device's ResetController functionality.

    The Reset Controller manages all Resets of the System including; externaldevices (via the NRST pin), Processor Reset and Peripheral Reset. It alsoprovides the status of the last reset source.

    The following peripheral is used by this module:

    • RSTC (Reset Controller)

    Devices from the following series can use this module:• Atmel | SMART SAM3• Atmel | SMART SAM4C• Atmel | SMART SAM4CM• Atmel | SMART SAM4CP• Atmel | SMART SAM4E• Atmel | SMART SAM4N• Atmel | SMART SAM4S• Atmel | SMART SAM G

    The outline of this documentation is as follows:• Prerequisites• Module Overview• Special Considerations• Extra Information• Examples• API Overview

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

  • Table of Contents

    Introduction......................................................................................................................1

    1. Software License....................................................................................................... 4

    2. Prerequisites..............................................................................................................5

    3. Module Overview.......................................................................................................63.1. NRST Manager.............................................................................................................................6

    3.1.1. NRST Signal or Interrupt............................................................................................... 63.1.2. NRST External Reset Control........................................................................................6

    3.2. Reset State Manager....................................................................................................................63.2.1. General Reset................................................................................................................63.2.2. Backup Reset................................................................................................................ 63.2.3. User Reset.....................................................................................................................73.2.4. Software Reset.............................................................................................................. 73.2.5. Watchdog Reset............................................................................................................ 73.2.6. Reset State Priorities..................................................................................................... 7

    4. Special Considerations..............................................................................................8

    5. Extra Information....................................................................................................... 9

    6. Examples.................................................................................................................10

    7. API Overview........................................................................................................... 117.1. Macro Definitions........................................................................................................................11

    7.1.1. Macro RSTC_BACKUP_RESET..................................................................................117.1.2. Macro RSTC_CPMR_KEY_PASSWD......................................................................... 117.1.3. Macro RSTC_GENERAL_RESET............................................................................... 117.1.4. Macro RSTC_NRST_HIGH..........................................................................................117.1.5. Macro RSTC_NRST_LOW.......................................................................................... 117.1.6. Macro RSTC_SOFTWARE_RESET............................................................................ 117.1.7. Macro RSTC_USER_RESET...................................................................................... 117.1.8. Macro RSTC_WATCHDOG_RESET........................................................................... 11

    7.2. Function Definitions.................................................................................................................... 117.2.1. Function rstc_assert_reset_of_coprocessor()..............................................................117.2.2. Function rstc_deassert_reset_of_coprocessor()......................................................... 127.2.3. Function rstc_disable_user_reset()............................................................................. 127.2.4. Function rstc_disable_user_reset_interrupt().............................................................. 127.2.5. Function rstc_enable_user_reset().............................................................................. 137.2.6. Function rstc_enable_user_reset_interrupt()...............................................................137.2.7. Function rstc_get_reset_cause()................................................................................. 137.2.8. Function rstc_get_status()........................................................................................... 137.2.9. Function rstc_reset_extern()........................................................................................147.2.10. Function rstc_set_external_reset().............................................................................. 147.2.11. Function rstc_start_software_reset()........................................................................... 14

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    2

  • 8. Extra Information for Reset Controller Driver...........................................................158.1. Acronyms....................................................................................................................................158.2. Dependencies.............................................................................................................................158.3. Errata..........................................................................................................................................158.4. Module History............................................................................................................................15

    9. Examples for Reset Controller Driver...................................................................... 169.1. Quick Start guide for SAM RSTC driver..................................................................................... 16

    9.1.1. Basic Use Case........................................................................................................... 169.1.2. Setup Steps................................................................................................................. 169.1.3. Usage Steps................................................................................................................ 17

    9.2. Reset Controller (RSTC) Example............................................................................................. 179.2.1. Purpose....................................................................................................................... 179.2.2. Requirements.............................................................................................................. 179.2.3. Description...................................................................................................................179.2.4. Main Files.................................................................................................................... 179.2.5. Compilation Information...............................................................................................179.2.6. Usage.......................................................................................................................... 18

    10. Document Revision History..................................................................................... 20

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    3

  • 1. Software LicenseRedistribution and use in source and binary forms, with or without modification, are permitted providedthat the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice, this list of conditions and thefollowing disclaimer.

    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and thefollowing disclaimer in the documentation and/or other materials provided with the distribution.

    3. The name of Atmel may not be used to endorse or promote products derived from this software withoutspecific prior written permission.

    4. This software may only be redistributed and used in connection with an Atmel microcontroller product.

    THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLYDISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ORBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OFSUCH DAMAGE.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    4

  • 2. PrerequisitesThere are no prerequisites for this module.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    5

  • 3. Module OverviewThe Reset Controller contains an NRST Manager and a Reset State Manager. It runs at Slow Clock(SCLK) and generates the following:

    • Processor and Watchdog Timer reset• Embedded peripheral reset• Co-processor and Co-processor peripheral reset (SAM4C devices only)• External device reset (via the NRST pin)

    These reset signals are asserted by the Reset Controller acting on external events or as the result of anaction performed by software. The Reset State Manager controls the operation of reset signals andprovides a signal to the NRST Manager when an assertion of the NRST pin is required.

    3.1. NRST Manager

    To control an external device reset the NRST Manager shapes the NRST assertion period using aprogrammable timer. While asserted, after power-up, NRST is an output and driven low. When theprogrammable time period has elapsed the pin behaves as an input and all the system is held in reset ifNRST is tied to GND by an external signal.

    3.1.1. NRST Signal or Interrupt

    The NRST Manager samples the NRST pin at Slow Clock (SCLK) speed and drives this pin low whenrequired by the Reset State Manager. When the line is detected as being low a User Reset is reported tothe Reset State Manager. However, the NRST Manager can be programmed not to trigger a reset whenNRST is asserted.

    The Reset controller can also be programmed to generate an interrupt instead of generating a reset.

    3.1.2. NRST External Reset Control

    The NRST Manager can assert NRST for a programmable time period of between 60µs and 2s(approximately). This allows the Reset Controller to shape the NRST pin level and thus to guarantee thatthe NRST line is low for a time that is compliant with any external devices also connected to the systemreset.

    3.2. Reset State Manager

    The Reset State Manager handles the different reset sources and generates the internal reset signals.

    3.2.1. General Reset

    A general reset occurs when either a Power-on-reset is detected or the Supply Controller detects aBrownout or Voltage regulation loss.

    3.2.2. Backup Reset

    A Backup Reset occurs when the chip returns from Backup Mode. The core_backup_reset signal isasserted by the Supply Controller when a Backup Reset occurs.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    6

  • 3.2.3. User Reset

    If User Reset is enabled then the state is entered when a low level is detected on the NRST pin. WhenUser Reset is entered both the Processor Reset and the Peripheral Reset are asserted.

    The User Reset state is left when NRST rises and the processor clock is re-enabled as soon as NRST isconfirmed high.

    3.2.4. Software Reset

    The Reset Controller allows software to assert the the following reset signals:• Reset the processor and the Watchdog Timer• Reset all the embedded peripherals• Reset the Co-processor (SAM4C devices only)• Reset all the embedded peripherals associated with the Co-processor (SAM4C devices only)• Assert NRST for a programmable time period

    Note:  The embedded peripheral reset also includes the memory system and the Remap Command andis generally used for debugging purposes.

    Note:  For SAM4C devices the Co-processor peripheral reset only affects the embedded peripheralsassociated with the Co-processor. The processor's peripherals are not reset.

    3.2.5. Watchdog Reset

    The Watchdog Reset is entered when a watchdog fault occurs.

    3.2.6. Reset State Priorities

    The Reset State Manager manages the following priorities between the different reset sources, given indescending order:

    • General Reset• Backup Reset• Watchdog Reset• Software Reset• User Reset

    Particular cases are listed below:• When in User Reset:

    • A watchdog event is impossible because the Watchdog Timer is being reset• A Software Reset is impossible because the processor reset is being activated

    • When in Software Reset:• A watchdog event has priority over the current state• The NRST has no effect

    • When in Watchdog Reset:• The processor reset is active and so a Software Reset cannot be programmed• A User Reset cannot be entered

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    7

  • 4. Special ConsiderationsSystem designs using any external devices that require a software controllable reset signal assertionlonger than two seconds should use a dedicated I/O output of the microcontroller.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    8

  • 5. Extra InformationFor extra information, see Extra Information for Reset Controller Driver. This includes:

    • Acronyms• Dependencies• Errata• Module History

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    9

  • 6. ExamplesFor a list of examples related to this driver, see Examples for Reset Controller Driver.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    10

  • 7. API Overview

    7.1. Macro Definitions

    7.1.1. Macro RSTC_BACKUP_RESET

    #define RSTC_BACKUP_RESET

    7.1.2. Macro RSTC_CPMR_KEY_PASSWD

    #define RSTC_CPMR_KEY_PASSWD

    7.1.3. Macro RSTC_GENERAL_RESET

    #define RSTC_GENERAL_RESET

    7.1.4. Macro RSTC_NRST_HIGH

    #define RSTC_NRST_HIGH

    7.1.5. Macro RSTC_NRST_LOW

    #define RSTC_NRST_LOW

    7.1.6. Macro RSTC_SOFTWARE_RESET

    #define RSTC_SOFTWARE_RESET

    7.1.7. Macro RSTC_USER_RESET

    #define RSTC_USER_RESET

    7.1.8. Macro RSTC_WATCHDOG_RESET

    #define RSTC_WATCHDOG_RESET

    7.2. Function Definitions

    7.2.1. Function rstc_assert_reset_of_coprocessor()

    Assert the reset of the Co-processor.

    void rstc_assert_reset_of_coprocessor( Rstc * p_rstc, const uint32_t reset)

    Note:  This function is for SAM4C devices only.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    11

  • Table 7-1 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    [in] reset The reset to be asserted as a bitmask, which could beRSTC_CPMR_CPEREN (peripheral reset) and/orRSTC_CPMR_CPROCEN (core reset).

    7.2.2. Function rstc_deassert_reset_of_coprocessor()

    Deassert the reset of the Co-processor.

    void rstc_deassert_reset_of_coprocessor( Rstc * p_rstc, const uint32_t reset)

    Note:  This function is for SAM4C devices only.

    Table 7-2 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    [in] reset The reset to be deasserted as a bitmask, which could beRSTC_CPMR_CPEREN (peripheral reset) and/orRSTC_CPMR_CPROCEN (core reset).

    7.2.3. Function rstc_disable_user_reset()

    Disable User Reset.

    void rstc_disable_user_reset( Rstc * p_rstc)

    Table 7-3 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    7.2.4. Function rstc_disable_user_reset_interrupt()

    Disable the User Reset interrupt.

    void rstc_disable_user_reset_interrupt( Rstc * p_rstc)

    Table 7-4 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    12

  • 7.2.5. Function rstc_enable_user_reset()

    Enable User Reset.

    void rstc_enable_user_reset( Rstc * p_rstc)

    Table 7-5 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    7.2.6. Function rstc_enable_user_reset_interrupt()

    Enable the User Reset interrupt.

    void rstc_enable_user_reset_interrupt( Rstc * p_rstc)

    Table 7-6 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    7.2.7. Function rstc_get_reset_cause()

    Get the reset cause.

    uint32_t rstc_get_reset_cause( Rstc * p_rstc)

    Table 7-7 Parameters

    Data direction Parameter name Description

    [in] p_rstc Module hardware register base address pointer

    ReturnsThe last reset cause.

    7.2.8. Function rstc_get_status()

    Get the RSTC status.

    uint32_t rstc_get_status( Rstc * p_rstc)

    Table 7-8 Parameters

    Data direction Parameter name Description

    [in] p_rstc Module hardware register base address pointer

    ReturnsRSTC status.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    13

  • 7.2.9. Function rstc_reset_extern()

    Asserts the NRST pin for external resets.

    void rstc_reset_extern( Rstc * p_rstc)

    Table 7-9 Parameters

    Data direction Parameter name Description

    [out] p_rstc Module hardware register base address pointer

    7.2.10. Function rstc_set_external_reset()

    Set the external reset length.

    void rstc_set_external_reset( Rstc * p_rstc, const uint32_t ul_length)

    Table 7-10 Parameters

    Data direction Parameter name Description

    [in, out] p_rstc Module hardware register base address pointer

    [in] ul_length The length of external reset

    7.2.11. Function rstc_start_software_reset()

    Perform a Software Reset.

    void rstc_start_software_reset( Rstc * p_rstc)

    Table 7-11 Parameters

    Data direction Parameter name Description

    [out] p_rstc Module hardware register base address pointer

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    14

  • 8. Extra Information for Reset Controller Driver

    8.1. AcronymsBelow is a table listing the acronyms used in this module, along with their intended meanings.

    Acronym Definition

    GND Ground

    I/O Input Output

    NRST Synchronous Microcontroller Reset

    QSG Quick Start Guide

    SCLK Slow Clock

    8.2. DependenciesThis driver has the following dependencies:

    • None

    8.3. ErrataThere are no errata related to this driver.

    8.4. Module HistoryAn overview of the module history is presented in the table below, with details on the enhancements andfixes made to the module since its first release. The current version of this corresponds to the newestversion in the table.

    Changelog

    Initial document release

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    15

  • 9. Examples for Reset Controller DriverThis is a list of the available Quick Start Guides (QSGs) and example applications for SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver. QSGs are simple examples with step-by-step instructions to configure and use this driver in a selection of use cases. Note that a QSG can becompiled as a standalone application or be added to the user application.

    • Quick Start guide for SAM RSTC driver• Reset Controller (RSTC) Example

    9.1. Quick Start guide for SAM RSTC driver

    This is the quick start guide for the SAM Reset Controller (RSTC) driver, with step-by-step instructions onhow 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 copiedinto a custom initialization function, while the steps for usage can be copied into, e.g., the mainapplication function.

    9.1.1. Basic Use Case

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

    9.1.1.1. Prerequisites

    • System Clock Management• Watchdog Timer

    9.1.2. Setup Steps

    9.1.2.1. Example Code

    Add the following to the application C-file:static volatile bool reset_interrupt_triggered = false;

    void RSTC_Handler(void){ /* Clear the interrupt. */ rstc_get_status(RSTC); reset_interrupt_triggered = true;}

    9.1.2.2. Workflow

    Enable the User Reset interrupt:rstc_disable_user_reset(RSTC);NVIC_DisableIRQ(RSTC_IRQn);rstc_enable_user_reset_interrupt(RSTC);NVIC_ClearPendingIRQ(RSTC_IRQn);NVIC_SetPriority(RSTC_IRQn, 0);NVIC_EnableIRQ(RSTC_IRQn);

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    16

  • 9.1.3. Usage Steps

    9.1.3.1. 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. */ cpu_irq_enter_critical(); reset_interrupt_triggered = false; cpu_irq_leave_critical(); puts("User Reset IRQ triggered. Press any console key for the menu\r");}

    9.2. Reset Controller (RSTC) Example

    9.2.1. 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 drivesindependently or simultaneously the external reset and the peripheral and processor resets.

    9.2.2. Requirements

    • This example can be used with SAM evaluation kits• Optional: An oscilloscope connected to the evaluation kit's NRST signal

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

    9.2.4. Main Files

    • rstc.c: Reset Controller driver• rstc.h: Reset Controller driver header file• rstc_example1.c: Reset Controller example application

    9.2.5. Compilation Information

    This software is written for GNU GCC and IAR Embedded Workbench® for Atmel®. Other compilers mayor may not work.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    17

  • 9.2.6. Usage

    1. Build the program and download it into the evaluation board.2. 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

    3. Start the application.4. 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.

    5. 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 themenu 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.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    18

  • The evaluation kit will perform a software reset, the last reset source will be displayed and themenu 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 andthe 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 evaluationkit's NRST signal. To avoid a hardware conflict during the test do not use the evaluation kit'smanual RESET button.

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    19

  • 10. Document Revision HistoryDoc. Rev. Date Comments

    42279B 07/2015 Updated title of application note and added list of supported devices

    42279A 05/2014 Initial document release

    Atmel AT06864: SAM3/4C/4CM/4CP/4E/4N/4S/G Reset Controller (RSTC) Driver[APPLICATION NOTE]

    Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    20

  • Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 | www.atmel.com

    © 2015 Atmel Corporation. / Rev.: Atmel-42279B-SAM3-4C-4CM-4CP-4E-4N-4S-G-Reset-Controller-RSTC_AT06864_Application Note-07/2015

    Atmel®, Atmel logo and combinations thereof, Enabling Unlimited Possibilities®, and others are registered trademarks or trademarks of Atmel Corporation in U.S. andother countries. ARM®, ARM Connected®, and others are registered trademarks of ARM Ltd. Windows® is a registered trademark of Microsoft Corporation in U.S.and or other countries. Other terms and product names may be trademarks of others.

    DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to anyintellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS ANDCONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIEDOR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESSINTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISEDOF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of thisdocument and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment toupdate the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotiveapplications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.

    SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with anyapplications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) withoutan Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for theoperation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environmentsunless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specificallydesignated by Atmel as automotive-grade.

    https://www.facebook.com/AtmelCorporationhttps://twitter.com/Atmelhttp://www.linkedin.com/company/atmel-corporationhttps://plus.google.com/106109247591403112418/postshttp://www.youtube.com/user/AtmelCorporationhttp://en.wikipedia.org/wiki/Atmelhttp://www.atmel.com

    IntroductionTable of Contents1. Software License2. Prerequisites3. Module Overview3.1. NRST Manager3.1.1. NRST Signal or Interrupt3.1.2. NRST External Reset Control

    3.2. Reset State Manager3.2.1. General Reset3.2.2. Backup Reset3.2.3. User Reset3.2.4. Software Reset3.2.5. Watchdog Reset3.2.6. Reset State Priorities

    4. Special Considerations5. Extra Information6. Examples7. API Overview7.1. Macro Definitions7.1.1. Macro RSTC_BACKUP_RESET7.1.2. Macro RSTC_CPMR_KEY_PASSWD7.1.3. Macro RSTC_GENERAL_RESET7.1.4. Macro RSTC_NRST_HIGH7.1.5. Macro RSTC_NRST_LOW7.1.6. Macro RSTC_SOFTWARE_RESET7.1.7. Macro RSTC_USER_RESET7.1.8. Macro RSTC_WATCHDOG_RESET

    7.2. Function Definitions7.2.1. Function rstc_assert_reset_of_coprocessor()7.2.2. Function rstc_deassert_reset_of_coprocessor()7.2.3. Function rstc_disable_user_reset()7.2.4. Function rstc_disable_user_reset_interrupt()7.2.5. Function rstc_enable_user_reset()7.2.6. Function rstc_enable_user_reset_interrupt()7.2.7. Function rstc_get_reset_cause()7.2.8. Function rstc_get_status()7.2.9. Function rstc_reset_extern()7.2.10. Function rstc_set_external_reset()7.2.11. Function rstc_start_software_reset()

    8. Extra Information for Reset Controller Driver8.1. Acronyms8.2. Dependencies8.3. Errata8.4. Module History

    9. Examples for Reset Controller Driver9.1. Quick Start guide for SAM RSTC driver9.1.1. Basic Use Case9.1.1.1. Prerequisites

    9.1.2. Setup Steps9.1.2.1. Example Code9.1.2.2. Workflow

    9.1.3. Usage Steps9.1.3.1. Workflow

    9.2. Reset Controller (RSTC) Example9.2.1. Purpose9.2.2. Requirements9.2.3. Description9.2.4. Main Files9.2.5. Compilation Information9.2.6. Usage

    10. Document Revision History