Memory Technologies

OTA Firmware Update Design: EEPROM Implementation Challenges and How to Solve Memory Limitations

This article summarizes the key points for reliable OTA design, covering the storage of state-management data in EEPROM, measures to address power loss and write-cycle wear, and the option of switching to FeRAM for long-term field operation.

The Supplementary Role of EEPROM in OTA Design

In OTA design, EEPROM plays a crucial role in storing state management data—such as update status flags, version information, and boot partition selection flags. The bootloader references this data immediately upon power-up, making high reliability essential, as corruption could render the device unbootable.

Design for Storing OTA Status Flags, Version Information, and CRC

Data managed by EEPROM during OTA updates includes update status flags, firmware version information, CRC values for integrity verification, boot partition selection flags (Partition A/B), and rollback attempt counters. Although these items involve small amounts of data—ranging from a few bytes to several dozen—they are the highest-priority data referenced by the bootloader at startup. The standard approach for address allocation is to assign independent address regions for each data type to prevent mutual interference.

EEPROM Referencing by the Bootloader and the Startup Sequence

Upon power-up, the bootloader first reads the boot partition selection flag and update status from the EEPROM. If the status indicates “update complete and verified,” it boots the new firmware; if it indicates “update interrupted,” it switches to the rollback partition. Incorporating CRC verification into this startup sequence allows for the detection of EEPROM data corruption at boot time, ensuring safe fallback behavior. The specific EEPROM addresses referenced by the bootloader and the meaning of each flag must be strictly defined in the specifications shared between the application and the bootloader.

EEPROM Wear-Out Risk Based on Write Frequency

Designs that repeatedly write state flags or version information to the same address on every OTA update accumulate writes from standard operations such as saving settings and logging. This creates a real risk of reaching the write endurance limit sooner than anticipated given a typical guaranteed write endurance of 100,000 to 1,000,000 cycles. Particularly with devices deployed in large numbers in the field, individual variations can lead to some units reaching the end of their lifespan prematurely. It is crucial to estimate actual in-field write frequencies during the design phase and ensure a sufficient margin relative to the guaranteed write cycle count.

Risk of EEPROM State Data Corruption Due to Power Loss or Noise

Power loss or external noise during an OTA update can corrupt state data stored in the EEPROM. The consequences of such corruption extend beyond the mere loss of configuration settings; it poses a risk of critical failure—such as the device becoming unbootable—if the bootloader references invalid flags. Accurately understanding the conditions under which this occurs is the starting point for implementing countermeasures.

Impact of Power Loss During OTA on EEPROM Writes

A power loss during an EEPROM write cycle leaves the data at the target address in an indeterminate state, since the write itself takes several milliseconds to complete. If the writing of an update status flag or a boot partition selection flag is interrupted during an OTA update, the bootloader may read an invalid flag upon the next power-up and attempt to launch the incorrect firmware. In the worst-case scenario, the device becomes unbootable even though valid firmware exists. Designing for recovery from power loss is essential.

Critical Failures Caused by Flag Data Corruption in Noisy Environments

In industrial equipment settings, cases have been reported where electrical noise caused corruption of EEPROM flag data, leading to serious consequences. If a flag stored in EEPROM is overwritten with an incorrect value, the system treats it as valid; consequently, there is a risk that malfunctions will persist without the corruption being detected. The same applies to OTA-related status flags: if an update-completion flag is erroneously overwritten, it could trigger unnecessary re-updates or unintended rollbacks.

Corruption Detection and Recovery: The Commit-Rollback Mechanism

A transaction-based commit-rollback mechanism is an effective countermeasure against EEPROM write interruptions caused by power loss. In this approach, data is saved to a temporary area before writing, and a “committed” flag is set only after the write operation has fully completed. If the commit flag indicates an incomplete state upon power-up, the system uses the data in the temporary area to perform a rollback and restore data consistency. Applying this mechanism to OTA status flags ensures the EEPROM remains in a consistent state, even in the event of a power loss.

Implementation Methods to Enhance OTA Status Management Data Reliability

To improve the reliability of OTA-related data stored in EEPROM, a combination of three approaches is effective: data integrity verification, redundancy, and wear leveling (equalizing write cycles). Software implementation eliminates the need for additional hardware, keeping costs down.

Data Integrity Verification via CRC and Checksums

Attaching a CRC or checksum to OTA status data stored in EEPROM allows for the detection of data corruption during read operations. A robust design involves the bootloader performing CRC verification when reading EEPROM status flags; if a mismatch is detected, the system falls back to default values or requests a re-update. Another advantage is that checksums can be implemented in software, avoiding additional hardware costs. For particularly critical flags, it is also recommended to perform a read-back verify immediately after writing.

Ensuring Consistency via Multiple Writes and Sequence Numbers

Writing critical OTA status data to multiple addresses and assigning a sequence number to each copy provides robust protection against power loss and bit errors. During read operations, the data with the most recent sequence number is treated as valid; if inconsistencies arise between copies, the system resolves them using a majority vote or by selecting the latest valid value. In a triple-copy configuration, the correct value can be recovered from the remaining two copies even if one becomes corrupted. While this method consumes additional EEPROM capacity, the small data size of OTA-related flags means it rarely poses a practical issue.

Equalizing Write Wear via Wear Leveling

Writing status flags to a fixed address on every OTA update causes premature “wear-out,” where only that address suffers localized wear. By implementing a rotation buffer to cycle through write addresses, the write wear across the entire EEPROM can be equalized. The address of the currently valid data is managed separately via a pointer. Applying this technique to frequently rewritten data, such as sequence numbers or update counters, can significantly extend the EEPROM’s effective lifespan.

EEPROM Limitations and the Alternative: FeRAM

While software-based measures can enhance EEPROM reliability, they do not eliminate inherent structural constraints regarding guaranteed write cycles and write speeds. For designs requiring long-term operation or high-frequency updates, switching to FeRAM—which fundamentally resolves these constraints—is a viable option.

Impact of Guaranteed Write Cycle Limits on Long-Term OTA Operation

EEPROM typically offers a write endurance of 100,000 to 1 million cycles; however, the cumulative effect of status flag writes during OTA updates and standard operational writes creates a real risk that devices in long-term service will reach this limit. When designing systems intended for over a decade of operation—such as IoT devices—or systems with frequent OTA updates, accurately estimating write cycles and selecting the appropriate EEPROM are critical. Even with software measures like wear leveling, the fundamental limit on guaranteed write cycles remains unchanged.

FeRAM Surpasses EEPROM with Power-Loss Resilience and High-Speed Writes

FeRAM (Ferroelectric RAM) stores data through the polarization reversal of a ferroelectric thin film, offering a write endurance of over 10 trillion cycles—providing a level of write endurance that exceeds that of EEPROM by orders of magnitude. Storing frequently updated data—such as OTA status flags—in FeRAM virtually eliminates the risk of wear-out. Write speeds significantly faster than EEPROM’s also reduce the latency of bootloader reads and writes of OTA status information. The rapid completion of write operations also lowers the risk of data corruption caused by power loss during a write cycle.

Minimizing Design Changes by Switching to I2C/SPI-Compatible FeRAM

Many FeRAM (Ferroelectric RAM) products support I2C and SPI interfaces, and some are even pin-compatible with existing EEPROMs. This allows for replacement without major hardware redesigns, significantly improving OTA status management reliability while keeping migration costs low. On the software side, many products can be controlled using the same read/write APIs as EEPROM, requiring only minimal driver modifications. This makes FeRAM an especially effective choice for industrial equipment and IoT devices that require long-term operation and frequent updates.

RAMXEED FeRAM Product Lineup

Share this article