RP2040 vs ESP32: How Do These Popular Microcontrollers Compare?

The Raspberry Pi RP2040 and Espressif ESP32 are two of the most popular microcontroller units (MCUs) used by hobbyists and engineers alike. Both offer compelling capabilities at affordable prices, but they have some important differences that users should consider when selecting a microcontroller for their next project. Introducing the RP2040 and ESP32 The RP2040 was

Saving Cortex-M4 Processor State for Power-Down and Resume

The Cortex-M4 processor, like most modern processors, supports power-down modes to conserve energy when the system is idle. To properly resume from a low-power state, the processor’s context (register contents, stack pointer, program counter, etc.) must be preserved. This article provides an overview of the different low-power modes, reset behavior, and how to save and

The ARM Cortex A/R/M Numbering Convention Explained

ARM processors power billions of devices around the world. From smartphones to smartwatches, ARM chips provide the processing power for many of our everyday gadgets. Understanding the ARM Cortex numbering scheme is key to identifying capabilities and features of ARM-based systems. ARM Cortex series processors are grouped into three main families – Cortex-A, Cortex-R, and

How Instructions are Fetched in Cortex M Processors?

Overview of Instruction Fetch in Cortex M The IFU fetches instructions from memory and feeds them to the execution pipeline. It contains a prefetch buffer that caches instructions. The prefetch buffer helps reduce stalls when fetching from slower memories. The IFU also handles branching by fetching instructions from the new branch target address. In Cortex

ARM Cortex M NonMaskable Interrupt is NonClearable also?

The short answer is yes, the NonMaskable Interrupt (NMI) on ARM Cortex M processors is non-clearable by software. The NMI is designed to be triggered by hardware events that require immediate attention from the processor, even during critical operations. Unlike regular interrupts, NMIs cannot be disabled or masked at any time. Once asserted, the NMI

Usage fault exception in ARM Cortex M

A usage fault exception in ARM Cortex M processors indicates an invalid memory access or illegal attempt to execute an instruction. It occurs when the processor tries to access restricted memory regions, executes an undefined instruction, uses a coprocessor instruction when no coprocessor is present, accesses a disabled memory region, or performs an unaligned memory

ARM Cortex-M interrupt handler: directly call a C++ object functions when a interrupt occurs

Handling interrupts efficiently is key for responsive real-time embedded systems. For C++ projects on ARM Cortex-M devices, it can be very useful to directly call C++ object member functions from the interrupt handler. This allows object-oriented encapsulation of interrupt handling logic while still providing low latency and quick response to events. With proper configuration, member

NULL Pointer Protection with ARM Cortex-M MPU with Examples

NULL pointer dereferences are a common source of bugs and security vulnerabilities in embedded systems built on ARM Cortex-M CPUs. Enabling the Memory Protection Unit (MPU) on Cortex-M3 and above devices provides an effective mitigation by preventing access to address 0x00000000, the NULL pointer address. This article explains how to configure the MPU regions to

ARM Cortex-M compiler differences (Keil, IAR, Linaro, Yagarto and GNU Tools for ARM Embedded Processors)

When developing for ARM Cortex-M microcontrollers, the choice of compiler toolchain is an important decision that can significantly impact development time, code performance, and cost. The main compiler options for Cortex-M development include Keil MDK, IAR Embedded Workbench, GNU toolchains like GNU Arm Embedded Toolchain or Arm Embedded GCC, Yagarto, and Linaro. Here is an

Which microcontroller is better than ESP32?

The ESP32 is an extremely popular WiFi-enabled microcontroller produced by Espressif Systems. With its integrated WiFi and Bluetooth capabilities, abundant memory and peripherals, and active development community, the ESP32 is used in a wide range of Internet of Things (IoT) applications. However, the ESP32 is not necessarily the best choice for every project. There are