What is the difference between a microcontroller and a microprocessor?
What the interviewer wants to hear
- Microcontroller has CPU, flash, RAM and peripherals on one chip
- Microprocessor needs external memory and peripherals
- MCUs are low cost, low power, for dedicated tasks
- MPUs run rich operating systems like Linux
- Examples of each
Model answer
A microcontroller, or MCU, puts a CPU core, flash memory for the program, RAM and peripherals such as GPIO, timers, ADC, UART, SPI and I2C on a single chip. It is designed for a dedicated job, like controlling a washing machine, with low cost and very low power, and usually runs bare-metal code or a small RTOS. Examples are STM32 with Cortex-M cores, ESP32 and the RP2040. A microprocessor, or MPU, is a more powerful CPU that needs external RAM, storage and often extra chips for peripherals. It typically has a memory management unit and runs a full operating system like Linux or Android. Examples are the ARM Cortex-A chips in a Raspberry Pi or phones. Choosing between them depends on the need: an MCU for real-time control and battery life, an MPU for rich UIs, networking stacks and heavy processing.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Embedded Systems Engineer questions
- What is an interrupt, and how is it different from polling?
- Compare UART, SPI and I2C. When would you use each?
- Explain volatile and const in embedded C. Can a variable be both?
- When would you use bare-metal firmware versus an RTOS?
- What GPIO modes does a typical microcontroller pin support, and when would you use each?
- What is PWM, how is it generated on a microcontroller, and what is it used for?
- What is a bootloader in an embedded device, and why would a product need one?
- What is endianness, and how do you deal with it when exchanging data between devices?
- How do you approach reading a datasheet for a new sensor or microcontroller?