Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 37 ยท Microcontroller Architecture

Microcontroller vs Microprocessor

Compare microcontrollers, microprocessors, SoCs and DSPs: what is inside an MCU, Harvard vs von Neumann, 8/16/32-bit cores, and ARM, AVR and RISC-V families.

People often use the words "microprocessor" and "microcontroller" as if they meant the same thing, but they describe different design choices. A microprocessor (MPU) is only the processing core: it needs external memory, external peripherals and a lot of support circuitry. A microcontroller (MCU) puts the core, memory and peripherals on one chip, so that a tiny circuit board with a few capacitors is enough to make a working computer.

This lesson explains the difference, looks inside a typical MCU, and introduces the architectural vocabulary (Harvard vs von Neumann, RISC, word size, ARM Cortex-M, AVR, RISC-V) that you will meet in every datasheet.

The difference in one picture

flowchart LR
    subgraph MPU["Microprocessor system"]
        direction TB
        CPU1["CPU core"] --- BUS1(("External bus"))
        BUS1 --- RAM1["External RAM chip"]
        BUS1 --- ROM1["External flash / storage"]
        BUS1 --- IO1["I/O controller chips"]
    end
    subgraph MCU["Microcontroller (one chip)"]
        direction TB
        CPU2["CPU core"] --- BUS2(("Internal bus"))
        BUS2 --- RAM2["SRAM"]
        BUS2 --- ROM2["Flash"]
        BUS2 --- PER["GPIO, timers, UART, ADC..."]
    end
Microcontroller (MCU) Microprocessor (MPU)
Integration CPU + flash + RAM + peripherals in one chip CPU alone; memory and I/O are separate chips
Typical clock 1 MHz to ~600 MHz 500 MHz to several GHz
Memory KBs to a few MBs MBs to many GBs, with an MMU for virtual memory
Operating system none, or a small RTOS Linux, Android, Windows
Power microwatts to a few hundred milliwatts hundreds of mW to many watts
Cost cents to a few dollars several dollars up
Use control tasks, sensors, appliances phones, routers, PCs, infotainment
Start time microseconds to milliseconds seconds (boot loader, OS)
Examples STM32, ATmega328P, RP2040, ESP32, nRF52 Intel Core, ARM Cortex-A (Raspberry Pi 5), RISC-V Linux SoCs

Between the two lies the system on chip (SoC) and the application processor: a Cortex-A core with built-in peripherals (a Raspberry Pi's chip is one). Those run Linux; they are embedded systems too, but a different discipline (device trees, drivers, user space). Dedicated DSPs (digital signal processors) and FPGAs (programmable logic) round out the family; you will see them next to an MCU in audio or radio designs.

What is inside a microcontroller

A typical MCU contains:

  1. CPU core: executes instructions (8-, 16- or 32-bit).
  2. Flash memory: program storage, non-volatile.
  3. SRAM: working memory for variables and the stack, volatile.
  4. Optional EEPROM or data flash for settings.
  5. GPIO: general-purpose pins.
  6. Timers and counters: delays, PWM, input capture, watchdog, real-time clock.
  7. Serial interfaces: UART, SPI, I2C, CAN, USB, Ethernet.
  8. Analog: ADC (analog to digital), DAC, comparators, voltage reference.
  9. Clock system: oscillators and PLL.
  10. Interrupt controller: lets hardware events interrupt the CPU.
  11. DMA controller: moves data between memory and peripherals without the CPU.
  12. Power and reset logic: brown-out detection, power-on reset, sleep modes.
  13. Debug interface: SWD or JTAG.

Chapters 4 to 6 cover the peripherals one by one. For now remember: an MCU is a computer plus the things it needs to touch the real world, on one chip.

Harvard vs von Neumann

In a von Neumann architecture, code and data share one memory and one bus. The CPU can fetch an instruction or read data in a given cycle, not both. Desktop CPUs present this model to programs.

A Harvard architecture has separate memories and buses for code and data. The CPU can fetch the next instruction while loading data for the current one, which is faster and simpler to time. Classic 8-bit AVR and PIC chips are pure Harvard, with a consequence for C programmers: a pointer to RAM and a pointer to flash are different kinds of address, which is why Arduino code uses PROGMEM to keep constant tables in flash.

Von Neumann Harvard
Memories one shared separate code and data
Buses one two (instruction, data)
Fetch and data access take turns at the same time
Constants in flash read like any memory need special access on AVR (PROGMEM)
Examples classic x86, MSP430, RISC-V simple cores AVR, PIC, many DSPs

Modern 32-bit chips take a middle road, the modified Harvard design: ARM Cortex-M has separate instruction and data buses internally, but both memories live in one unified address space, so pointers work uniformly and flash constants can be read with ordinary loads.

CPU families and word size

The word size (8, 16 or 32 bits) is the natural width of registers and arithmetic. An 8-bit MCU adds two 8-bit numbers in one instruction; adding two 32-bit numbers takes four. Smaller word means smaller, cheaper, lower power; bigger word means faster for real arithmetic and easier addressing of memory beyond 64 KB.

Core Bits Style Where you see it
8051, PIC16/18, AVR 8 classic, small toys, appliances, Arduino Uno
MSP430, PIC24 16 low power meters, sensors
ARM Cortex-M0/M0+/M3/M4/M7/M33 32 RISC, Thumb-2, rich ecosystem most modern MCUs (STM32, RP2040, nRF52, SAMD)
RISC-V (RV32IMC) 32 open ISA ESP32-C3, CH32V, GD32V
Xtensa LX6/LX7 32 configurable ESP32, ESP32-S3

RISC (reduced instruction set computer) means a small set of simple, regular instructions, usually one per clock; compare CISC where single instructions do more complicated work. Most embedded cores today are RISC.

C Word size matters: adding 32-bit numbers on an 8-bit CPU

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

ARM Cortex-M in particular

Cortex-M is by far the most important core family in embedded work, so it is worth remembering how it is organized:

Core Typical features
Cortex-M0 / M0+ smallest and cheapest; Thumb instructions only; very low power
Cortex-M3 full Thumb-2, hardware divide, bit-banding
Cortex-M4 / M4F adds DSP instructions and optional single-precision FPU
Cortex-M7 superscalar, caches, optional double-precision FPU, up to ~1 GHz
Cortex-M23 / M33 TrustZone security extensions

Every Cortex-M shares the same programming model: the same registers (R0-R15), the same interrupt controller (NVIC), the same SysTick timer and the same debug interface. That is why moving from an STM32 to an nRF52 or an RP2040 costs you days, not months.

Choosing: MCU or MPU?

Use a microcontroller when you need hard real-time behavior, low power, a low bill of materials and instant start. Use a microprocessor or SoC when you need a rich UI, networking stacks, file systems, large memory or the Linux ecosystem. Many products use both: a Linux SoC for the screen and cloud, plus an MCU next to it that handles motors and safety, communicating over UART or SPI.

C MCU or MPU? A simple decision helper

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with scanf or fgets), it gets the next line from this box.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the main difference between an MCU and an MPU?

    An MCU is a complete small computer on one chip. An MPU needs external memory and I/O.
  2. 2. What does a Harvard architecture have that a von Neumann one does not?

    Separate code and data paths let the CPU fetch an instruction while accessing data.
  3. 3. Why is moving between different Cortex-M vendors relatively easy?

    Arm defines the core; vendors differ mainly in peripherals and their registers.
  4. 4. Which workload points toward an MPU running Linux rather than an MCU?

    Rich networking, UI and file systems fit the Linux ecosystem. Hard real-time and tiny power budgets fit an MCU.

Summary

  • An MCU integrates CPU, flash, RAM and peripherals; an MPU is only the processor.
  • MCUs trade speed for low power, low cost, determinism and instant start.
  • Harvard architectures have separate code and data buses; Cortex-M is modified Harvard with a unified address space.
  • Word size (8/16/32 bit) affects speed and cost; Cortex-M and RISC-V dominate modern 32-bit designs.
  • Many products pair a Linux SoC with an MCU for real-time work.

Next: The CPU Core and the Instruction Cycle