dualbank – Dualbank Module

The dualbank module adds ability to update and switch between the two identical app partitions, which can contain different firmware versions.

Having two partitions enables rollback functionality.

The two partitions are defined as the boot partition and the 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.

Use cases:
  • Can be used for OTA Over-The-Air updates.

  • Can be used for dual-boot of different firmware versions or platforms.

Note

Boards with flash =2MB:

This module is unavailable as the flash is only large enough for one app partition.

Boards with flash >2MB:

This module is enabled/disabled at runtime based on whether the CIRCUITPY drive is extended or not. See storage.erase_filesystem() for more information.

import dualbank

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

Available on these boards
  • ATMegaZero ESP32-S2
  • Adafruit Feather ESP32 V2
  • Adafruit Feather ESP32S3 No PSRAM
  • Adafruit ItsyBitsy ESP32
  • Adafruit MatrixPortal S3
  • Adafruit Metro ESP32S3
  • Adafruit QT Py ESP32 PICO
  • Adafruit QT Py ESP32-S3 no psram
  • Adafruit-Qualia-S3-RGB666
  • Arduino Nano ESP32
  • AutosportLabs-ESP32-CAN-X2
  • BARDUINO 4.0.2
  • BLING!
  • BPI-Leaf-S3
  • BPI-PicoW-S3
  • Bee-Data-Logger
  • Bee-Motion-S3
  • Bee-S3
  • BlizzardS3
  • CRCibernetica IdeaBoard
  • CircuitART Zero S3
  • ColumbiaDSL-Sensor-Board-V1
  • CrowPanel 4.2 EPaper
  • Cytron Maker Feather AIoT S3
  • DFRobot FireBeetle 2 ESP32-S3
  • ES3ink
  • ESP32-C6-DevKitC-1-N8
  • ESP32-P4 Stamp XL
  • ESP32-P4-Function-EV
  • ESP32-S2-DevKitC-1-N8R2
  • ESP32-S3-Box-2.5
  • ESP32-S3-Box-Lite
  • ESP32-S3-DevKitC-1-N16
  • ESP32-S3-DevKitC-1-N32R8
  • ESP32-S3-DevKitC-1-N8
  • ESP32-S3-DevKitC-1-N8R2
  • ESP32-S3-DevKitC-1-N8R2 (ROS version)
  • ESP32-S3-DevKitC-1-N8R8
  • ESP32-S3-DevKitC-1-N8R8-with-HACKTABLET
  • ESP32-S3-DevKitM-1-N8
  • ESP32-S3-EYE
  • ESP32-S3-USB-OTG-N8
  • Espressif ESP32 DevKitc V4 WROVER
  • Espressif-ESP32-S3-LCD-EV-Board
  • Espressif-ESP32-S3-LCD-EV-Board_v1.5
  • FeatherS2
  • FeatherS2 PreRelease
  • FeatherS3
  • FeatherS3 Neo
  • Hardkernel Odroid Go
  • Heltec ESP32-S3-WIFI-LoRa-V3
  • Heltec Vison Master E290
  • Heltec Wireless Paper
  • IoTs2
  • LILYGO T-DISPLAY S3 v1.2
  • LILYGO T-Deck (Plus)
  • LILYGO T-Display S3 Pro
  • LILYGO T-Dongle S3
  • LILYGO T-QT PRO NO PSRAM
  • LILYGO T-Watch-S3
  • LILYGO TEMBED ESP32S3
  • LILYGO TTGO T-DISPLAY v1.1
  • LOLIN S3 16MB Flash 8MB PSRAM
  • LOLIN S3 PRO 16MB Flash 8MB PSRAM
  • Lilygo T-watch 2020 V3
  • M5Stack AtomS3
  • M5Stack AtomS3 Lite
  • M5Stack AtomS3U
  • M5Stack Cardputer
  • M5Stack Cardputer (ROS version)
  • M5Stack Core Basic
  • M5Stack Core Fire
  • M5Stack Core2
  • M5Stack CoreS3
  • M5Stack Dial
  • M5Stack M5Paper
  • M5Stack Stamp-S3
  • M5Stack Stick C Plus2
  • MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch
  • MicroDev microS2
  • NanoS3
  • Neuron
  • OMGS3
  • Oxocard Artwork
  • Oxocard Connect
  • Oxocard Galaxy
  • Oxocard Science
  • ProS3
  • RGBTouch Mini
  • Seeed Xiao ESP32-S3 Sense
  • Spotpear ESP32C3 LCD 1.69
  • Sunton-ESP32-8048S050
  • Sunton-ESP32-8048S070
  • TinyC6
  • TinyS3
  • TinyWATCH S3
  • VCC-GND YD-ESP32-S3 (N16R8)
  • VCC-GND YD-ESP32-S3 (N8R8)
  • VIDI X V1.1
  • Waveshare ESP32-S3-ETH
  • Waveshare ESP32-S3-GEEK
  • Waveshare ESP32-S3-Pico
  • Waveshare ESP32S3 LCD 1.28
  • Waveshare ESP32S3 Touch LCD 2
  • WeAct ESP32-C6 (8MB)

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

Writes one of the two app partitions at the given offset.

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

Parameters:
  • buffer (ReadableBuffer) – The entire firmware or a partial chunk.

  • offset (int) – Start writing at this offset in the app partition.

dualbank.switch() None

Switches to the next-update partition.

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