Fifteen common embedded interview questions
- What does volatile do, and when is it required?
- How do you set, clear and toggle a bit in a register?
- What happens when an interrupt fires? What should an ISR avoid?
- How do you share data safely between an ISR and the main loop?
- What is a race condition in embedded code, and how do you prevent it?
- Bare-metal super-loop versus RTOS — when would you use each?
- What is priority inversion, and how is it solved?
- Mutex versus semaphore in an RTOS?
- Compare UART, SPI and I2C.
- What is DMA, and why use it?
- Explain the memory layout of a C program on a microcontroller.
- What is a watchdog timer?
- How do you debug a board that doesn't boot?
- How do you reduce power consumption?
- Big-endian versus little-endian?
C for hardware
- volatile: required for memory-mapped registers, variables changed by ISRs and variables shared with DMA, so the compiler doesn't cache or remove reads and writes. It doesn't make operations atomic.
- Bit operations: set with |= (1 << n), clear with &= ~(1 << n), toggle with ^= (1 << n), test with & (1 << n).
- Memory layout: .text (code, usually flash), .data (initialised globals, copied to RAM at start-up), .bss (zero-initialised globals), heap and stack — and on small devices, often no heap at all.
- Endianness: the byte order of multi-byte values in memory; it matters for protocols and shared data structures.
Interrupts and concurrency
When an interrupt fires, the CPU saves context, jumps to the interrupt service routine and returns afterwards. ISRs should be short: set a flag, copy data into a buffer, and defer work to the main loop or a task. Avoid blocking calls, heavy computation and non-reentrant functions such as some printf implementations. Share data with volatile variables plus a critical section (briefly disabling interrupts) or atomic operations for anything larger than a single machine word. A lock-free ring buffer is a common pattern for ISR-to-main communication.
RTOS concepts
| Concept | Answer |
|---|---|
| Super-loop vs RTOS | Simple sequential loop for simple devices; RTOS for multiple timing-critical tasks |
| Preemptive scheduling | Highest-priority ready task runs, interrupting lower ones |
| Priority inversion | High-priority task waits on a lock held by a low-priority task preempted by a medium one |
| Priority inheritance | Lock holder temporarily inherits the waiting task's priority, fixing inversion |
| Mutex vs semaphore | Ownership and priority inheritance for mutual exclusion vs signalling or counting |
| Watchdog | Resets the system if software stops servicing it, recovering from hangs |
Protocols
- UART: asynchronous, two wires, point to point; both sides agree a baud rate.
- SPI: synchronous, full duplex, fast; a chip-select line per peripheral.
- I2C: synchronous, two wires shared by many devices with addresses; slower, with pull-up resistors and acknowledgements.
- CAN: robust multi-master bus with message priorities, standard in automotive and industrial systems.
- DMA: moves data between peripherals and memory without the CPU, freeing it for other work.
Debugging and power
For a board that won't boot: check power rails and clocks, confirm the reset line, connect a debugger (JTAG or SWD) to see where execution stops, toggle a GPIO or use a UART print at early start-up, and use an oscilloscope or logic analyser on buses. For power: sleep modes, clock gating, lowering clock frequency, turning off unused peripherals, interrupt-driven rather than polling designs, and batching radio transmissions. See C programming interview questions.
Practising
The fastest way to find gaps is to be asked. Run a spoken mock round on embedded systems topics — a free AI interview assistant such as CoPilot Interview builds one from your résumé and the job description and scores every answer — then study whatever you stumbled on. Bring a project you can discuss in depth — a board bring-up, a driver you wrote, or a timing bug you found with a logic analyser.
Disclosure: CoPilot Interview is our product, so weigh what we say about it accordingly. Everything else on this page applies whichever tool you use, or none.
Frequently asked questions
What questions are asked in embedded software interviews?
C with hardware focus (volatile, bit manipulation, memory layout), interrupts and ISRs, concurrency, RTOS concepts like priority inversion, UART, SPI, I2C and CAN, DMA, watchdogs, debugging boards and low-power design.
What is priority inversion?
When a high-priority task waits for a resource held by a low-priority task, which is itself preempted by a medium-priority task. Priority inheritance resolves it by temporarily raising the holder's priority.
What is the difference between SPI and I2C?
SPI is faster and full duplex with a separate chip-select per device. I2C uses two shared wires and device addresses, supporting many devices at lower speed.
What should an interrupt service routine avoid?
Long processing, blocking calls, dynamic memory allocation and non-reentrant functions. Keep ISRs short and defer work to the main loop or a task.
Practise on real interview questions
Run 145 real interview questions across 10 tracks, answer out loud and see a structured answer to compare with yours. Free, no signup.
Try a practice question