dualbank – DUALBANK Module

The dualbank module adds ability to update and switch between the two app partitions.

There are two identical partitions, these contain different firmware versions. Having two partitions enables rollback functionality.

The two partitions are defined as boot partition and next-update partition. Calling dualbank.flash() writes the next-update partition.

After the next-update partition is written a validation check is performed and on a successful validation this partition is set as the boot partition. On next reset, firmware will be loaded from this partition.

Here is the sequence of commands to follow:

import dualbank

dualbank.flash(buffer, offset)
dualbank.switch()

Available on these boards
  • AITHinker ESP32-C3S_Kit
  • ATMegaZero ESP32-S2
  • Adafruit Feather ESP32-S2 TFT
  • Adafruit Feather ESP32S2
  • Adafruit FunHouse
  • Adafruit MagTag
  • Adafruit Metro ESP32S2
  • Adafruit QT Py ESP32S2
  • Artisense Reference Design RD00
  • BastWiFi
  • CrumpS2
  • ESP 12k NodeMCU
  • Feather ESP32S2 without PSRAM
  • FeatherS2
  • FeatherS2 Neo
  • FeatherS2 PreRelease
  • Franzininho WIFI w/Wroom
  • Franzininho WIFI w/Wrover
  • Gravitech Cucumber M
  • Gravitech Cucumber MS
  • Gravitech Cucumber R
  • Gravitech Cucumber RS
  • HMI-DevKit-1.1
  • Kaluga 1
  • LILYGO TTGO T8 ESP32-S2 w/Display
  • MORPHEANS MorphESP-240
  • MicroDev microC3
  • MicroDev microS2
  • Oak Dev Tech PixelWing ESP32S2
  • S2Mini
  • S2Pico
  • Saola 1 w/Wroom
  • Saola 1 w/Wrover
  • Targett Module Clip w/Wroom
  • Targett Module Clip w/Wrover
  • Thingz - Galaxia
  • TinyS2
  • nanoESP32-S2 w/Wrover
  • nanoESP32-S2 w/Wroom

dualbank.flash(*buffer: _typing.ReadableBuffer, offset: int = 0) None

Writes one of two app partitions at the given offset.

This can be called multiple times when flashing the firmware in small chunks.

dualbank.switch() None

Switches the boot partition.

On next reset, firmware will be loaded from the partition just switched over to.