Foundations · Lesson 1 of 11 · about 10 min

What is a microcontroller?

The tiny computer inside every device

An embedded system is a small computer built into a device to do one job: a thermostat, a washing machine, the brakes of a car. Its heart is a microcontroller (MCU): one chip that holds a whole computer.

Every device follows the same pattern: read the inputs, decide in code, drive the outputs.

Microcontroller or microprocessor?

Microcontroller (MCU)Microprocessor (MPU)
On the chipCPU, memory and peripheralsMostly the CPU
MemoryKilobytesGigabytes
SoftwareYour C code, or a small RTOSA full operating system such as Linux
Starts inMicrosecondsSeconds
ExamplesSTM32, ESP32, ATmegaRaspberry Pi, phones, laptops

Everything is an address

The CPU sees flash, RAM and the hardware as one long list of numbered addresses. Reading a variable and switching on an LED are the same operation: write a value to an address.

The BoardPilot Learn screen: a lesson with its 3D board preview
Try it live

The real app, running in your browser: this lesson with its 3D preview on a simulated ST NUCLEO-F401RE. No install, nothing to plug in.

int counter = 5;                              // the compiler picks an address in RAM

*(volatile uint32_t *)0x40020014 = (1 << 5);  // GPIOA output register: pin PA5 high, LED on

What happens at power on

  1. The CPU reads the vector table at the start of flash: where the stack begins and where the startup code is.
  2. The startup code copies the initial values of variables into RAM and sets the clock.
  3. Your main() runs, and never returns: there is no operating system to return to.

Interview questions

  1. What is the difference between a microcontroller and a microprocessor?
  2. Where do the code and the variables live in an MCU?
  3. What happens between reset and main()?

No answers here on purpose: try answering out loud first. In the BoardPilot app, the interview coach reads your own answer and tells you what was right, what is missing and what a senior interviewer would ask next (it uses the AI provider you choose in the app). Embedded systems interview questions →

Key terms

In the app, the lessons come alive

The lessons have interactive demos and hands-on labs checked on your board in the app. These pages are the readable version: the demos are described in words, and the labs need the app.

Download BoardPilot Try the lessons in your browser