The reset button is an essential component on ARM Cortex microcontrollers and SoCs. Pressing the reset button restarts the processor and resets it to a known good state. This allows recovery from crashes, hangs, or other issues. The debug interface, called SWD (Serial Wire Debug), provides access to debug, programming, and profiling features built into the Cortex CPU. SWD allows halt, single-step, breakpoint, and watchpoint capabilities through an external debugger. Together, the reset button and SWD offer critical control and visibility into the processor.
The reset button, labeled RESET, RST, or similar, is a push-button that restarts the Cortex processor. It is typically located near the power switch or other controls. Pressing the reset button forces a hard reset which resets all processor registers and restarts program execution from the reset vector. This stops any running program and reinitializes the system.
On turning on power, the processor begins executing code from the preset reset vector. Pressing reset forces the processor to restart from this point. This halts any crashing, frozen, or unresponsive software and reverts the processor to a fresh state. The reset button is useful any time the system needs to be restarted such as after a crash, before uploading new firmware, or when the system is otherwise unresponsive.
The reset circuitry integrates with the processor reset pin. Pressing the button asserts the reset pin which halts the CPU and begins the restart process. The reset button is active at all times allowing emergency recovery no matter the state of the processor. Some MCUs offer wakeup on reset allowing restart from deep sleep modes.
Most ARM Cortex development boards include a reset button. It may be a tactile button, small switch, or a momentary push-button. The button triggers a level change or pulse on the reset pin. Some include a second button for bootloader mode. Reset buttons also feature on evaluation modules, baseboard add-ons, and embedded end products.
Uses and Advantages
Key uses and advantages of the reset button include:
- Recover from crashes and hangs – Pressing reset restarts the system
- Restart before flashing new firmware – Resets the processor to allow programming
- Halt erratic behavior – Stops unstable code execution
- Emergency stop for devices – Provides a quick safety reset
- Recover lost connectivity – Restarts operation to regain contact
- Safe known reset state – Prevents undefined startup conditions
- Quick restore of operation – Faster than power cycling for reset
The reset button offers a fast, convenient method to restart the processor without having to power cycle the board. It quickly restores expected operation in the event of crashes, hangs, faults, or glitches. By providing an emergency restart, it improves reliability and recoverability.
Pressing the reset button initiates the following sequence to reset and restart the processor:
- Button press pulls reset pin low
- Reset pin assert forces core registers, logic, and clocks to reset state
- Processor executes reset handler code to initialize components
- RAM cleared, peripherals disabled, clocks started
- CPU begins executing code at predefined reset vector
The reset pin assertion halts the CPU and resets internal registers and logic. Clocks are recalibrated and restarted. RAM is cleared to avoid undefined startup states. Peripherals are reset and disabled. The processor then begins executing initialization code from the reset vector. This code sets up memory, clocks, I/O, and other features based on the reset source. Finally, the main application runs restarting normal operation.
The Cortex processor supports multiple reset sources each with a dedicated reset handler. These include:
- Power-on Reset – When power is first applied
- External Reset – From reset button, reset pin
- Watchdog Reset – From watchdog timer expiring
- Software Reset – Initiated by runtime code
- Debug Reset – Triggered by external debugger
Dedicated reset handlers allow customized initialization sequence tailored for the specific reset source. This improves robustness for handling different types of resets.
The debug interface provides external access to internal processor state for test, debug, and trace. SWD (Serial Wire Debug) is the standard ARM Cortex debug interface. It provides a two-pin serial connection to debugger tools that enable robust development capabilities.
SWD uses just two pins for bi-directional debug access over a serial connection. The SWD pins are:
- SWCLK – Serial Clock
- SWDIO – Bi-directional Serial Data
SWCLK clocks data over the single SWDIO pin. An external debugger connects to these pins to communicate with the SWD debug module inside the Cortex CPU. SWD operates independently from the processor allowing debug even with clocks stopped.
SWD provides the following debug capabilities:
- Run control – Halt, single-step
- Breakpoints – Set software breakpoints
- Watchpoints – Monitor memory/peripherals
- Register access – Processor register read/write
- Memory access – RAM and flash read/write
- Flash programming
- Debug logging
This provides robust tools for low-level debugging and program trace. Supported debuggers include J-Link, ULINK, OpenOCD, pyOCD, and ARM Keil MDK. SWD is built into all Cortex-M cores making it the de facto standard for ARM debug.
Advantages of SWD
SWD provides several benefits compared to previous JTAG interfaces:
- Two pins versus 5+ for JTAG reducing board space
- Faster serial interface than JTAG
- Supports multiprocessor debugging
- More flexible than JTAG
- Supported on all Cortex-M cores
The two-pin SWD interface saves pins over JTAG. It offers faster performance with clock rates up to 10 MHz. SWD also enables simultaneous debugging of multiple processors. Overall, SWD provides a superior debug experience than legacy JTAG.
SWD Debugger Tools
Many debugger tools integrate with SWD. This allows robust debugging using SWD capabilities. Common SWD debug tools include:
- J-Link – SEGGER J-Link debug probes
- ULINK – Keil ULINK and ULINKpro debug adapters
- OpenOCD – Open On-Chip Debugger software
- PyOCD – Python OpenOCD Python-based debugger
- ARM Keil MDK – ARM Microcontroller Development Kit
These tools connect over SWD and leverage the debug and test capabilities exposed. J-Link and ULINK provide robust professional hardware probes. OpenOCD and PyOCD offer open-source debugger software solutions. And MDK integrates a full IDE with debug capabilities.
SWD vs JTAG
JTAG (Joint Test Action Group) is an older standard debug interface supported on some Cortex chips. The key differences between SWD and JTAG are:
- Pins – SWD uses just 2, JTAG requires 5+ pins
- Speed – SWD supports faster clock rates
- Flexibility – SWD has more flexible debug architecture
- Multicore – SWD better supports multicore debugging
- Popularity – SWD is the standard for Cortex-M cores
In most cases, SWD provides major advantages over legacy JTAG interfaces. The two-pin SWD delivers lower pin count, better speed, and greater flexibility. JTAG may offer some additional test capabilities on certain chips. But overall SWD is the preferred choice for Cortex debug.
Reset and Debug Together
The reset button and SWD interface provide complementary capabilities to control and observe processor operation:
- Reset button restarts the processor
- SWD interface provides debug visibility
- Reset recovers from faults and hangs
- SWD enables detailed program trace
- Reset offers quick emergency restart
- SWD allows inspecting internal CPU state
Together they form critical tools for development, testing, and debugging. The reset button provides a rapid way to restart the system. SWD enables inspecting and controlling the detailed internal processor state. Having both on development boards accelerates troubleshooting firmware issues and crashes.
Development Board Examples
ARM Cortex development boards provide reset buttons and SWD connectors for easy access. Here are some common examples:
- STM32 Nucleo – Reset button, SWD connector
- NXP LPCXpresso – Reset button, 10-pin SWD connector
- Raspberry Pi Pico – Reset button, SWD pins broken out
- Microchip Curiosity Nano – Reset button, SWD debug port
- Cypress PSoC 6 – Reset button, SWD pins
The onboard reset button offers quick access to restart these boards. The exposed SWD pins or connectors enable connecting a debug probe. Together they provide ideal development and debugging capabilities.
The reset button provides a quick and easy way to restart an ARM Cortex processor. This recovers operation from crashes, hangs, and faults. The SWD interface enables powerful control and visibility through an external debugger. With capabilities like halt, step, breakpoint, and register/memory access, SWD offers robust debugging using just two pins.
Having both a reset button and SWD access on development boards makes debugging and development much easier. The reset button offers simple restart while SWD enables deep inspection and control. Combining these two critical capabilities accelerates the development and debugging process on ARM Cortex platforms.