Xmega Application Note


CPU reset cause

Collaboration diagram for CPU reset cause:

Modules

 XMEGA reset cause

Defines

#define CHIP_RESET_CAUSE_BOD_CPU   0
 Brown-out detected on CPU power domain reset cause not available on this chip.
#define CHIP_RESET_CAUSE_BOD_IO   0
 Brown-out detected on I/O power domain reset cause not available on this chip.
#define CHIP_RESET_CAUSE_EXTRST   0
 CPU error reset cause not available on this chip.
#define CHIP_RESET_CAUSE_JTAG   0
 JTAG reset cause not available on this chip.
#define CHIP_RESET_CAUSE_OCD   0
 On-chip debug system reset cause not available on this chip.
#define CHIP_RESET_CAUSE_POR   0
 Power-on-reset reset cause not available on this chip.
#define CHIP_RESET_CAUSE_SLEEP   0
 Wake from Shutdown sleep mode reset cause not available on this chip.
#define CHIP_RESET_CAUSE_SOFT   0
 Software reset reset cause not available on this chip.
#define CHIP_RESET_CAUSE_SPIKE   0
 Spike detected reset cause not available on this chip.
#define CHIP_RESET_CAUSE_WDT   0
 Watchdog timeout reset cause not available on this chip.

Enumerations

enum  reset_cause {
  RESET_CAUSE_BOD_CPU = CHIP_RESET_CAUSE_BOD_CPU, RESET_CAUSE_BOD_IO = CHIP_RESET_CAUSE_BOD_IO, RESET_CAUSE_CPU_ERROR = CHIP_RESET_CAUSE_CPU_ERROR, RESET_CAUSE_EXTRST = CHIP_RESET_CAUSE_EXTRST,
  RESET_CAUSE_JTAG = CHIP_RESET_CAUSE_JTAG, RESET_CAUSE_OCD = CHIP_RESET_CAUSE_OCD, RESET_CAUSE_POR = CHIP_RESET_CAUSE_POR, RESET_CAUSE_SLEEP = CHIP_RESET_CAUSE_SLEEP,
  RESET_CAUSE_SOFT = CHIP_RESET_CAUSE_SOFT, RESET_CAUSE_SPIKE = CHIP_RESET_CAUSE_SPIKE, RESET_CAUSE_WDT = CHIP_RESET_CAUSE_WDT
}
 

List of reset causes in bit-mask format.

More...

Management



static void reset_cause_clear_causes (reset_cause_t causes)
 Clear a bit-mask of reset causes.
static reset_cause_t reset_cause_get_causes (void)
 Get all reset causes.
static void reset_do_soft_reset (void)
 Perform a software reset of the device.

Specific reset cause helper functions



static bool reset_cause_is_brown_out_detected (void)
 Check if chip reset was caused by a brown-out detection on any power domain.
static bool reset_cause_is_cpu_brown_out_detected (void)
 Check if chip reset was caused by a CPU power brown-out detection.
static bool reset_cause_is_cpu_error (void)
 Check if chip reset was caused by a CPU error, illegal access.
static bool reset_cause_is_external_reset (void)
 Check if chip reset was caused by an external reset.
static bool reset_cause_is_io_brown_out_detected (void)
 Check if chip reset was caused by an I/O power brown-out detection.
static bool reset_cause_is_jtag (void)
 Check if chip reset was caused by a JTAG reset.
static bool reset_cause_is_ocd (void)
 Check if chip reset was caused by the on-chip debug system.
static bool reset_cause_is_power_on_reset (void)
 Check if chip reset was caused by a power-on-reset.
static bool reset_cause_is_software_reset (void)
 Check if chip reset was caused by a software reset.
static bool reset_cause_is_spike_detected (void)
 Check if chip reset was caused by a power spike detection.
static bool reset_cause_is_wake_from_shutdown_sleep (void)
 Check if chip reset was caused by a wake up from shutdown sleep mode.
static bool reset_cause_is_watchdog (void)
 Check if chip reset was caused by a watchdog timeout.

Detailed Description

This is a generic interface for getting and clearing the chip reset causes.

Dependencies

The reset cause interface does not depend on any other modules, as it only accesses a few registers in the device core.

On the other hand, the software reset call might depend on System Clock Management to enable the clock to the debug system, for devices doing software reset through the on-chip debug system. This applies only to the 32-bit AVR devices.


Define Documentation

#define CHIP_RESET_CAUSE_BOD_CPU   0

Brown-out detected on CPU power domain reset cause not available on this chip.

Definition at line 79 of file reset_cause.h.

#define CHIP_RESET_CAUSE_BOD_IO   0

Brown-out detected on I/O power domain reset cause not available on this chip.

Definition at line 86 of file reset_cause.h.

#define CHIP_RESET_CAUSE_EXTRST   0

CPU error reset cause not available on this chip.

External reset cause not available on this chip.

Definition at line 94 of file reset_cause.h.

#define CHIP_RESET_CAUSE_JTAG   0

JTAG reset cause not available on this chip.

Definition at line 98 of file reset_cause.h.

#define CHIP_RESET_CAUSE_OCD   0

On-chip debug system reset cause not available on this chip.

Definition at line 102 of file reset_cause.h.

#define CHIP_RESET_CAUSE_POR   0

Power-on-reset reset cause not available on this chip.

Definition at line 106 of file reset_cause.h.

#define CHIP_RESET_CAUSE_SLEEP   0

Wake from Shutdown sleep mode reset cause not available on this chip.

Definition at line 110 of file reset_cause.h.

#define CHIP_RESET_CAUSE_SOFT   0

Software reset reset cause not available on this chip.

Definition at line 114 of file reset_cause.h.

#define CHIP_RESET_CAUSE_SPIKE   0

Spike detected reset cause not available on this chip.

Definition at line 118 of file reset_cause.h.

#define CHIP_RESET_CAUSE_WDT   0

Watchdog timeout reset cause not available on this chip.

Definition at line 122 of file reset_cause.h.


Enumeration Type Documentation

List of reset causes in bit-mask format.

Enumerator:
RESET_CAUSE_BOD_CPU 

Brown-out detected on CPU power domain reset cause.

RESET_CAUSE_BOD_IO 

Brown-out detected on I/O power domain reset cause.

RESET_CAUSE_CPU_ERROR 

CPU error reset cause.

RESET_CAUSE_EXTRST 

External reset cause.

RESET_CAUSE_JTAG 

JTAG reset cause.

RESET_CAUSE_OCD 

On-chip debug system reset cause.

RESET_CAUSE_POR 

Power-on-reset reset cause.

RESET_CAUSE_SLEEP 

Wake from Shutdown sleep mode reset cause.

RESET_CAUSE_SOFT 

Software reset reset cause.

RESET_CAUSE_SPIKE 

Spike detected reset cause.

RESET_CAUSE_WDT 

Watchdog timeout reset cause.

Definition at line 128 of file reset_cause.h.


Function Documentation

reset_cause_clear_causes ( reset_cause_t  causes  )  [inline, static]

Clear a bit-mask of reset causes.

This function will clear the provided reset causes in the reset cause register.

Parameters:
causes bit-mask of reset causes to clear

Definition at line 82 of file xmega_reset_cause.h.

00083 {
00084         RST.STATUS &= ~(causes);
00085 }

reset_cause_t reset_cause_get_causes ( void   )  [inline, static]

Get all reset causes.

This function will return a value containing the currently triggered reset cause(s).

Returns:
Bit-mask with each active reset cause set to 1.

Definition at line 77 of file xmega_reset_cause.h.

Referenced by reset_cause_is_cpu_brown_out_detected(), reset_cause_is_cpu_error(), reset_cause_is_external_reset(), reset_cause_is_io_brown_out_detected(), reset_cause_is_jtag(), reset_cause_is_ocd(), reset_cause_is_power_on_reset(), reset_cause_is_software_reset(), reset_cause_is_spike_detected(), reset_cause_is_wake_from_shutdown_sleep(), and reset_cause_is_watchdog().

00078 {
00079         return (reset_cause_t)RST.STATUS;
00080 }

static bool reset_cause_is_brown_out_detected ( void   )  [inline, static]

Check if chip reset was caused by a brown-out detection on any power domain.

Returns:
True if reset was caused by a power brown-out detection

Definition at line 214 of file reset_cause.h.

References reset_cause_is_cpu_brown_out_detected(), and reset_cause_is_io_brown_out_detected().

Here is the call graph for this function:

static bool reset_cause_is_cpu_brown_out_detected ( void   )  [inline, static]

Check if chip reset was caused by a CPU power brown-out detection.

Returns:
True if reset was caused by a CPU power brown-out detection

Definition at line 193 of file reset_cause.h.

References RESET_CAUSE_BOD_CPU, and reset_cause_get_causes().

Referenced by reset_cause_is_brown_out_detected().

00194 {
00195         return (reset_cause_get_causes() & RESET_CAUSE_BOD_CPU);
00196 }

Here is the call graph for this function:

static bool reset_cause_is_cpu_error ( void   )  [inline, static]

Check if chip reset was caused by a CPU error, illegal access.

Returns:
True if reset was caused by a CPU error, illegal access

Definition at line 225 of file reset_cause.h.

References RESET_CAUSE_CPU_ERROR, and reset_cause_get_causes().

00226 {
00227         return (reset_cause_get_causes() & RESET_CAUSE_CPU_ERROR);
00228 }

Here is the call graph for this function:

static bool reset_cause_is_external_reset ( void   )  [inline, static]

Check if chip reset was caused by an external reset.

Returns:
True if reset was caused by an external reset

Definition at line 235 of file reset_cause.h.

References RESET_CAUSE_EXTRST, and reset_cause_get_causes().

00236 {
00237         return (reset_cause_get_causes() & RESET_CAUSE_EXTRST);
00238 }

Here is the call graph for this function:

static bool reset_cause_is_io_brown_out_detected ( void   )  [inline, static]

Check if chip reset was caused by an I/O power brown-out detection.

Returns:
True if reset was caused by an I/O power brown-out detection

Definition at line 203 of file reset_cause.h.

References RESET_CAUSE_BOD_IO, and reset_cause_get_causes().

Referenced by reset_cause_is_brown_out_detected().

00204 {
00205         return (reset_cause_get_causes() & RESET_CAUSE_BOD_IO);
00206 }

Here is the call graph for this function:

static bool reset_cause_is_jtag ( void   )  [inline, static]

Check if chip reset was caused by a JTAG reset.

Returns:
True if reset was caused by a JTAG reset

Definition at line 245 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_JTAG.

00246 {
00247         return (reset_cause_get_causes() & RESET_CAUSE_JTAG);
00248 }

Here is the call graph for this function:

static bool reset_cause_is_ocd ( void   )  [inline, static]

Check if chip reset was caused by the on-chip debug system.

Returns:
True if reset was caused by the on-chip debug system

Definition at line 255 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_OCD.

00256 {
00257         return (reset_cause_get_causes() & RESET_CAUSE_OCD);
00258 }

Here is the call graph for this function:

static bool reset_cause_is_power_on_reset ( void   )  [inline, static]

Check if chip reset was caused by a power-on-reset.

Returns:
True if reset was caused by a power-on-reset

Definition at line 265 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_POR.

00266 {
00267         return (reset_cause_get_causes() & RESET_CAUSE_POR);
00268 }

Here is the call graph for this function:

static bool reset_cause_is_software_reset ( void   )  [inline, static]

Check if chip reset was caused by a software reset.

Returns:
True if reset was caused by a software reset

Definition at line 285 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_SOFT.

00286 {
00287         return (reset_cause_get_causes() & RESET_CAUSE_SOFT);
00288 }

Here is the call graph for this function:

static bool reset_cause_is_spike_detected ( void   )  [inline, static]

Check if chip reset was caused by a power spike detection.

Returns:
True if reset was caused by a spike detection

Definition at line 295 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_SPIKE.

00296 {
00297         return (reset_cause_get_causes() & RESET_CAUSE_SPIKE);
00298 }

Here is the call graph for this function:

static bool reset_cause_is_wake_from_shutdown_sleep ( void   )  [inline, static]

Check if chip reset was caused by a wake up from shutdown sleep mode.

Returns:
True if reset was caused by a wake up from shutdown sleep mode

Definition at line 275 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_SLEEP.

00276 {
00277         return (reset_cause_get_causes() & RESET_CAUSE_SLEEP);
00278 }

Here is the call graph for this function:

static bool reset_cause_is_watchdog ( void   )  [inline, static]

Check if chip reset was caused by a watchdog timeout.

Returns:
True if reset was caused by a watchdog timeout

Definition at line 305 of file reset_cause.h.

References reset_cause_get_causes(), and RESET_CAUSE_WDT.

00306 {
00307         return (reset_cause_get_causes() & RESET_CAUSE_WDT);
00308 }

Here is the call graph for this function:

void reset_do_soft_reset ( void   )  [inline, static]

Perform a software reset of the device.

Note:
This function will never return.
This function does not disable interrupts, this is up to the caller to handle.

Definition at line 87 of file xmega_reset_cause.h.

References ccp_write_io().

00088 {
00089         ccp_write_io((void *)&RST.CTRL, RST_SWRST_bm);
00090 
00091         while (1) {
00092                 /* Intentionally empty. */
00093         }
00094 }

Here is the call graph for this function:

@DOC_TITLE@
Generated on Fri Oct 22 12:15:26 2010 for AVR1300 Using the Xmega ADC by doxygen 1.6.3