10 Essential Embedded Software Engineering Interview Questions *

Toptal sourced essential questions that the best embedded software engineers can answer. Driven from our community, we encourage experts to submit questions and offer feedback.

Hire a Top Embedded Software Engineer Now
Toptal logois an exclusive network of the top freelance software developers, designers, marketing experts, product managers, project managers, and finance experts in the world. Top companies hire Toptal freelancers for their most important projects.
1.

Describe the pros and cons of using a generic real-time operating system (RTOS) on a mid-range microcontroller.

View answer

RTOSes can significantly ease the development of complex products, which can translate into faster development cycles. They often support compartmentalizing code into tasks, implement cross-task communication mechanisms, and commonly include abstractions (“drivers”) for platform-specific hardware, which makes porting firmware to new hardware easier. Because of all that, they also introduce overhead in code size and CPU usage, which is not acceptable for all projects.

2.

What are some common issues when handling interrupts?

View answer

Interrupt handlers almost always need to finish their execution quickly—the details depend on the device and application—and this limits the complexity of what can be done in their code. Also, the context in which the interrupt handler code is executed can, for either hardware or software reasons, prevent the usage from within the interrupt handler code of:

  • Common library functions
  • Access to peripherals and devices
  • Even certain types of CPU instructions

The usual way to mitigate this is to have the interrupt controller set a special variable which is observed by non-interrupt code, and which can then perform arbitrary actions

3.

In platforms with significant constraints on memory size, is it more preferable to allocate memory statically or dynamically?

View answer

It’s preferable to use static memory allocation on platforms with memory sizes in the low kilobytes and below. This is because data overhead, CPU overhead, and memory fragmentation can be significant issues when using dynamic memory allocation.

4.

Why are C and C++ still very popular and widely supported in embedded firmware development?

View answer

Hardware constraints, both for memory sizes and CPU speed, limit what can be done on embedded devices. C and C++ usually have very minimal overhead and are very “close to the hardware” in terms of abstractions offered to developers. This makes them suitable for even the smallest devices.

5.

How many wires are required to reliably implement TTL-like serial communication between two devices, and why?

View answer

TTL-like serial communication is often used to interface small microcontroller-based devices to larger computer systems, either for general communication or for uploading firmware. This type of communication uses two wires, one for each direction, called TX (transmit) and RX (receive.) But there also needs to be a common electrical ground level shared between the devices, so the minimum number of wires to reliably implement TTL serial communication is three. (The requirement for common electrical ground is also present in I2C and SPI.)

6.

Since 32-bit and 64-bit microcontrollers exist, why are 8-bit ones still in use?

View answer

The general reason is picking the right tool for the job. The three most common reasons are backwards compatibility, price, and electrical power consumption. Backwards compatibility is important when interfacing with existing infrastructure, especially in industrial environments, where in many cases, the electrical and operational constraints impact the choice of microcontrollers.

Generally, smaller microcontrollers (with narrower primary registers) are also cheaper. But they can contain a very large selection of peripherals and interfacing options, so they can be used in many situations that require advanced functionality but not high CPU speed.

Smaller microcontrollers also generally require less power to operate, which is especially important for IoT and battery-powered devices.

7.

Is firmware and data embedded in microcontrollers generally safe from downloading, tampering, or hacking?

View answer

No. Unless the microcontroller is specially constructed to offer countermeasures against firmware downloading and/or modification, any code and data uploaded to a microcontroller should be considered relatively easy to download and modify. (Such hardened microcontrollers are usually expensive.)

8.

Describe the role of a watchdog timer.

View answer

A watchdog timer is a feature of many microcontrollers—usually implemented with specific dedicated hardware—that can be used to check whether the software running on the microcontroller hung.

Microcontrollers are designed to be sturdy and resilient. But there’s still any number of issues that can affect hardware stability. There can also be an unhandled combination of events on the software side. Both of these can cause microcontrollers to “hang,” either electrically or in an infinite loop in software.

A watchdog timer is a subsystem which needs to be explicitly notified by the software that everything is running as expected, within a specific amount of time. If the watchdog does not receive the notification it expects, it will perform some action, such as resetting the microcontroller, or even the whole device. This is usually done periodically, and the watchdog timer will perform its action if it doesn’t receive a notification after a configurable amount of time has passed since the last notification.

9.

What are the most important characteristics of UART-based (also called RS-232-like and TTL-like) serial communication, I2C communication, and SPI communication?

View answer

Simple UART-based serial communication—with or without UART hardware—is the least demanding communications protocol to implement, but comes with severe limitations:

  • It’s intended to connect only two devices.
  • It’s asynchronous, meaning there’s no explicit agreement about clock rates between the devices.
  • It’s most commonly used at slow bit rates (up to 115,200 bps).

I2C can connect up to 127 devices on the same electrical bus, and each device is individually addressable. One of the devices, a master device, generates a clock signal shared by all the others, called slave devices. There is only one data wire, so all communication is unidirectional. (It’s commonly used to communicate with sensors on a PCB, which often use simple request-response protocols.)

The SPI bus is designed for fast, bidirectional communication with complex devices, which can involve cases such as transferring a large volume of data in bulk. With SPI, all devices share the data and clock wires, but there are also separate addressing wires which enable communication to and from specific devices.

10.

Discuss a couple of options for wireless communication between embedded devices.

View answer

On the high end of cost and complexity, wireless communication can be implemented using one of the wifi standards. These offer great bandwidth, are interoperable with many other devices, and can be long-range. But wifi standards are also fairly complex and require dedicated hardware.

Bluetooth is a reasonable choice for interfacing between different types of hardware over short distances, i.e., those of up to 15 yards (~14 meters). It also requires specialized hardware, but such hardware is usually cheap and simple to use. Devices using Bluetooth for communication often emulate a serial line between them.

There are also custom radio-based communication devices and protocols which work on the same frequencies as WiFi and Bluetooth (around 2.4 GHz), but with simpler protocols that are incompatible with the standard ones. They are usually cheaper than Bluetooth and simpler to implement.

There are also transceivers operating at low frequencies such as 433 MHz. While they offer very low bitrates over short distances—up to 10 yards (~9 meters)—they are extremely cheap and easy to implement. If larger distances are required and a small bitrate is acceptable, which is often the case in IoT devices, solutions like LoRa, SigFox, and NB-IoT can be used.

Finally, infrared communication over very short distances (a couple of yards) can also be an efficient choice.

These sample questions are intended as a starting point for your interview process. If you need additional help, explore our hiring resources—or let Toptal find the best developers, designers, marketing experts, product managers, project managers, and finance experts for you.

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of Toptal, LLC.

* All fields are required

Looking for Embedded Software Engineers?

Looking for Embedded Software Engineers? Check out Toptal’s embedded software engineers.

Bhavesh Kakwani

Freelance Embedded Software Engineer
Canada
Toptal Member Since May 5, 2020

Bhavesh is an award-winning developer with a strong foundation in math and electronics. His professional experience includes end-to-end embedded software development and hardware design. His code runs on SpaceRyde's gondola and rocket, McMaster University's launched satellite, Quanta Vici's Bluetooth gloves, and Ecobee's IoT lightswitch. These projects are on embedded Linux and microcontrollers (both bare metal and RTOS) and are written in C, C++, and Python.

Show More

Ian Anderson

Freelance Embedded Software Engineer
Canada
Toptal Member Since December 18, 2023

Ian is a creative and skilled developer who specializes in the development of software for embedded devices. He has 16 years of industry experience in the automotive sector in the Metro Detroit area. He holds a degree in electrical engineering, focusing on computer and software engineering. Ian has experience writing production-quality, saleable embedded software sold at high volumes on the consumer market.

Show More

Flavio Alves

Freelance Embedded Software Engineer
Brazil
Toptal Member Since December 27, 2019

Flavio is an experienced software engineer with solid expertise in both back end and embedded software, ready to contribute to product development projects. He is a highly skilled Linux developer, working from virtual machine levels using KVM to embedded systems with Yocto and OpenWrt. Fluent in C, C++, and Python, Flavio excels in back-end frameworks such as Django and Flask, making him a versatile and valuable asset for building robust and innovative solutions.

Show More

Toptal Connects the Top 3% of Freelance Talent All Over The World.

Join the Toptal community.

Learn more