SoC
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
  • Arm Cortex M3
  • Contact
Reading: ARM Cortex M Software Reset
SUBSCRIBE
SoCSoC
Font ResizerAa
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Search
  • Home
  • Arm
  • Arm Cortex M0/M0+
  • Arm Cortex M4
Have an existing account? Sign In
Follow US
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
© S-O-C.ORG, All Rights Reserved.
Arm

ARM Cortex M Software Reset

Mike Johnston
Last updated: September 15, 2023 12:40 pm
Mike Johnston 4 Min Read
Share
SHARE

A software reset is a method to reset the processor in an ARM Cortex M-based microcontroller without requiring any external hardware. It can be achieved by writing to the System Control Block (SCB) Application Interrupt and Reset Control Register (AIRCR). This register contains the security privileges, reset types and reset request bits needed to initiate a software reset.

Contents
Reasons for a Software ResetAIRCR RegisterReset TypesCode ExamplesARM GCCARM MDKReset HandlersPrecautionsSummary

Reasons for a Software Reset

There are several reasons why a software reset may be necessary in a Cortex M device:

  • Recover from a locked-up or crashed state
  • Restart the application after updating firmware
  • Reset peripheral registers to default values
  • Re-initialize hardware from a known clean state

Since the processor does not need to be power cycled, a software reset allows the system to reboot faster than a hardware reset. It also does not require any additional hardware and can be invoked from software at any time.

AIRCR Register

The SCB AIRCR register is a 32-bit write-only register which controls resets in the Cortex M processor. The register contains the following bitfields:

  • Bits [31:16] – Vector Key: Must write 0x05FA to write to other register bits
  • Bits [15:11] – Reserved
  • Bits [10:8] – PRIGROUP: Interrupt priority grouping
  • Bit [2] – SYSRESETREQ: Generates a system reset when set to 1
  • Bits [1:0] – VECTRESET: Type of reset to perform

To generate a software reset, the VECTRESET and SYSRESETREQ bits must be set to the appropriate values while writing the key to bits [31:16].

Reset Types

There are several types of software resets that can be initiated by writing to the AIRCR register:

  • VECTRESET=0b00, SYSRESETREQ=1 – Reset entire system
  • VECTRESET=0b01, SYSRESETREQ=1 – Reset core only
  • VECTRESET=0b10, SYSRESETREQ=1 – Reset system and core

The most common software reset uses VECTRESET=0b00 and SYSRESETREQ=1 to reset the entire system including core peripherals. This causes the processor to restart execution at the reset vector as if a hardware reset occurred.

Code Examples

Here are some examples of how to trigger a software reset from C code:

ARM GCC

/* Reset entire system */ SCB->AIRCR = 0x05FA0004; /* Reset core only */ SCB->AIRCR = 0x05FA0005;

ARM MDK

/* Reset entire system */ SCB->AIRCR = 0x05FA0004; /* Reset core only */ SCB->AIRCR = 0x05FA0005;

Reset Handlers

After a software reset occurs, code execution will resume from one of the processor’s reset handlers located in the startup code:

  • Reset_Handler – Executes on a full system reset
  • Default_Handler – Executes on a core only reset

These handlers are responsible for initializing hardware, setting up the stack pointer, copying .data sections to RAM, and jumping to the application entry point main().

Precautions

There are some precautions that should be taken when using software resets:

  • Make sure to re-initialize hardware peripherals and RAM contents as needed
  • Critical global variables may need to be re-initialized
  • Code execution will start from the reset vector, not the point where reset was called
  • Software resets can be privileged – check security control bits

It is also good practice to minimize the use of software resets and only use them as a last resort if the system is unrecoverable.

Summary

The SCB AIRCR register provides an easy method to reset an ARM Cortex M processor through software. Setting the VECTRESET and SYSRESETREQ bits will initiate a system, core, or full reset from code without external hardware.

Software resets are useful for recovering from crashes, restarting the application, or initializing hardware peripherals. However, care must be taken to re-initialize critical variables and hardware state when using software resets.

Newsletter Form (#3)

More ARM insights right in your inbox

 


Share This Article
Facebook Twitter Email Copy Link Print
Previous Article Arm Cortex-M0+ Power Consumption
Next Article How to Reduce Interrupt Latency in RTOS?
Leave a comment Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

2k Followers Like
3k Followers Follow
10.1k Followers Pin
- Sponsored-
Ad image

You Might Also Like

What is the difference between WFI and WFE arm cortex?

The ARM Cortex processor architecture provides two low-power states for…

11 Min Read

What is the maximum operating frequency of the 32-bit ARM Cortex-M0+ processor core?

The 32-bit ARM Cortex-M0+ processor core is designed to deliver…

8 Min Read

How Unaligned Memory Access is Handled in ARM Cortex-M4

ARM Cortex-M4 microcontrollers have built-in support for unaligned memory access,…

7 Min Read

How does ARM processor boot?

When an ARM processor powers on, it goes through a…

6 Min Read
SoCSoC
  • Looking for Something?
  • Privacy Policy
  • About Us
  • Sitemap
  • Contact Us
Welcome Back!

Sign in to your account