Over-the-air (OTA) software updates in embedded MCU based applications

Many MCU based embedded systems are used in a variety of IoT applications which are typically deployed in the field on a large scale. These devices coupled with the rapid software development cycle, cause many systems to require support for over-the-air (OTA) updates. In this process, an OTA update replaces the software and firmware on the microcontroller (MCU) of the embedded system with a new software and firmware.

An example of an MCU based application that may require OTA updates is shown in the figure below. In this example, a microcontroller (MCU) is connected to a radio and sensor, which could be used as an environmental monitoring system using the sensor collecting data about its surroundings and reporting them periodically using the radio. This portion of the system can be referred to as the edge node and is the target of OTA update. The remaining portion can be referred to as the provider of the new software or the server.

MCUs are generally used for overall lower overhead operations where low cost, low power running at low clock rates enable more battery efficient and cost effective devices as compared to application processors used in the same system design. Many embedded software applications employ a real-time operating system (RTOS) that run on top of MCU based systems, which allows the software to split concurrent tasks with different responsibilities in the system. In the figure above, the system may have RTOS tasks for reading sensor data, running algorithms to process the sensor data, and interfacing with the radio communication. The RTOS is primarily responsible for coordinating these tasks based on specific time-based delays or events.

Mender addresses MCU based updates using Update Modules with peripheral devices as the target of OTA updates. As compared to the figure above, this means the external MCU is another software component in the system that could reside on the same board as the processor (server), or it could be an external component that is connected to the wired device (edge node), for example over USB or a serial line.

An Update Module is a piece of user-written code that defines how the Mender client installs an update to a device. They are customizable and can be written in any programming language, so it can be tailored to meet the specific needs of a device or environment. Mender comes with reference Update Modules for the most common application package types: Docker containsers, .deb packages, .rpm packages, .Files and directories.

Figure below illustrates rootfs image file, package and other custom updates for software and firmware deployment to peripheral components and/or devices such as microcontrollers (MCU), sensor processors, storage devices, cameras, etc.

The benefit of using Update Modules to do MCU based OTA updates as a connected peripheral device is to provide the flexibility in deploying various smaller size application based updates without the need for larger size full image system updates. So by only updating the application, the downtime and network usage during the update is kept to a minimum.

Learn more with a tutorial on How to do a proxy deployment to an FRDM-K64F device connected to a Raspberry Pi 3. Also, see how to use the Device Firmware Update (DFU) USB class in Zephyr Project 2 using a FRDM-K64F 1 board as target.