DEV Community

Cover image for How Mesh+ flashes Meshtastic firmware onto an nRF52 node over a USB cable
borodutch.eth ๐Ÿ’Ž๐Ÿคฒ
borodutch.eth ๐Ÿ’Ž๐Ÿคฒ

Posted on Edited on Originally published at blog.meshplus.app

How Mesh+ flashes Meshtastic firmware onto an nRF52 node over a USB cable

Mesh+ flashes Meshtastic firmware onto nRF52 radios like the Heltec T114 or RAK4631 straight from your phone: it downloads Meshtastic's own update zip, reboots the node into its bootloader, and pushes the new image over USB. All of it lives in roughly 350 lines of Kotlin inside Firmware.kt, with no laptop or external flasher needed. The protocol itself is old and picky, so instead of implementing it from a spec I ported Adafruit's Python tool. Everything below comes from the main branch (commit 6967418, 2 November 2026) and Meshtastic's published releases checked on 3 November 2026; I didn't flash a physical node while writing this, so the timings come from the code's constants and README rather than a stopwatch.

What you tap, and what happens next

Open Node settings and Mesh+ reads the connected board and firmware version, then hits api.meshtastic.org/github/firmware/list for published releases. Right now that feed returns two stable builds (2.7.26.54e0d8d and 2.7.15.567b8ea) plus alphas up to 2.8.2.4c89b69. When a newer stable build exists, the button offers Update to 2.7.26; otherwise it says Up to date. Firmware options lists every build available for your board, with pre-releases tucked behind a toggle, so downgrading is just as easy.

Version comparison is trickier than it looks because Meshtastic tags end in a commit hash (2.7.26.54e0d8d). Mesh+ checks only the first three numbers and drops the hash, with a unit test locking down the case I care about most: running an alpha like 2.8.0 shouldn't make the app nag you to "update" backward to stable 2.7.26.

Once you confirm, five steps run in order:

  1. Download firmware-<board>-<version>-ota.zip from meshtastic.github.io. For a T114 on 2.7.26, that file is 734,689 bytes and returns a plain 200.
  2. Unzip it and read manifest.json to pull out two files: the 14-byte .dat init packet and the .bin application image (733,664 bytes on the T114).
  3. Tell the running firmware to reboot into bootloader mode.
  4. Wait for a different USB device to show up.
  5. Push the image over Nordic's serial DFU protocol until the node finishes writing and reboots onto the new firmware.

Per the README, the whole run takes around a minute and a half. Because the start packet requests an application-only update, the bootloader stays untouched and your settings, rooms, and messages survive intact.

Why the app watches for a different USB device

Step 4 is the quirk that catches most people off guard. Once an nRF52 node enters its bootloader, it enumerates on USB under a completely different ID than when running Meshtastic: the code comment lists 239a:0071 for the bootloader and 239a:4405 for the firmware. Waiting for just any serial device breaks down fast, since a normal settings reboot looks identical to a node entering DFU mode. Mesh+ saves the vendor and product IDs before triggering the reboot and only latches onto a newly appeared device with different IDs. On a retry, or when rescuing a node already stuck in update mode, there's nothing prior to compare against, so it grabs the first serial device that answers.

Android tacks on one more pause: because the bootloader counts as a brand-new USB device, the OS pops up the USB permission prompt all over again. Mesh+ waits up to 60 seconds for you to tap allow.

The protocol: HCI packets inside SLIP frames

Every nRF52 Meshtastic board runs the Adafruit nRF52 bootloader, speaking Nordic's legacy serial DFU from SDK 11. Each message wraps an HCI packet inside SLIP framing. A four-byte header packs a 3-bit sequence number, the next sequence number expected back, two flag bits for integrity checking and reliable delivery, a packet type of 14, a 12-bit payload length, and a checksum byte that brings the four header bytes to zero. Two bytes of CRC-16 (CCITT-FALSE, matching nrfutil's crc16.py) trail the payload, and 0xC0 marks the start and end of the frame with any literal 0xC0 or 0xDB inside escaped to two bytes.

With a 3-bit sequence number, the counter wraps after seven packets, and the bootloader replies to each one with a tiny ack frame. Mesh+ waits up to one second to see two 0xC0 delimiters (one complete ack frame) before moving to the next packet.

I didn't build this from a spec because there isn't a decent one. It's a direct port of dfu_transport_serial.py from Adafruit's adafruit-nrfutil, and DfuTest.kt pins exact byte vectors lifted from util.py and crc16.py. That includes the classic sanity check where ASCII 123456789 hashes to 0x29B1. On 3 November 2026 I ran the algorithm independently in Python, got 0x29b1, and hashed the real T114 binary to get 39265, matching the firmware_crc16 inside the package manifest. One bad framing byte can strand a radio in its bootloader, so checking against an independent implementation wasn't optional.

What gets sent, in order

The transfer uses five packet types and timing steps:

  • Start (packet type 3) sends the update mode plus sizes for the softdevice, bootloader, and application. Only the application size is non-zero: 733,664 for the T114's 2.7.26 build. Because the bootloader can lag briefly after enumerating on USB, Mesh+ retries this packet up to eight times using the same sequence number so it can't apply twice.
  • Erase wait. The bootloader wipes flash pages before taking data and never sends a "done" signal, so the app simply sleeps for (size / 4096 + 1) ร— 90 milliseconds with a 500 ms floor (90 rounds up the 89.7 ms needed per 4 KB page). For the T114 image, that pause is 16.2 seconds.
  • Init packet (type 1) transmits the .dat file plus two trailing zero bytes.
  • Data (type 4) streams the binary in 512-byte chunks, 1,433 chunks for this build. Every eighth chunk, the app pauses 103 ms (1,024 words at 100 ยตs each) while the chip commits a flash page, adding up to 180 pauses and roughly 18.5 seconds of waiting on flash.
  • Stop (type 5) tells the bootloader to verify and boot the new image. The bootloader USB device vanishes and the Meshtastic radio comes back in under a second on a T114, though Mesh+ waits up to 40 seconds before giving up.

Hardcoded sleeps make the whole protocol feel dated, and it is, but that's literally how Adafruit's reference flasher works, right down to the millisecond constants, so Mesh+ matches it.

What happens when it fails

Most of the code exists for one scenario: an update dying halfway through, because that's what decides whether anyone trusts a mobile flasher.

If the bootloader never acks the start packet, the radio is still on its old firmware and Mesh+ just reports the error and stops. Once the bootloader replies even once, though, the app flags the node as "in update mode," where it stays until a full image lands. Any hiccup after that triggers up to three automatic retries with a two-second gap, enough to recover from a surprise USB permission dialog or a dipping phone battery. If all three attempts fail, the connect screen puts up Node stuck in update mode?, which runs the exact same flash loop without asking the firmware to reboot first.

Retries handle a flaky moment, not a broken cable, so make sure your phone has charge and the cable is solid before you start.

The Bluetooth path is separate, and marked experimental

Since v0.2 (7 October 2026), Mesh+ also includes an experimental Bluetooth flasher built on Nordic's official Android DFU library instead of my serial port. It asks the firmware's DFU helper service to reboot into Bluetooth bootloader mode while preserving the bond, so you don't re-enter the PIN. One quirk needs a hack: the stock Adafruit bootloader responds to a large MTU request with 23 and then throws "OPERATION FAILED", so Mesh+ forces 20-byte packets instead. It's slower, sure, but it dodges the bug. USB is still the path I recommend and the one covered in the README and on the comparison page.

ESP32 boards like the Heltec V3 flash completely differently. Mesh+ doesn't support them and points their owners to flasher.meshtastic.org in the README.

Why bother when the official tools exist

Meshtastic's web flasher at flasher.meshtastic.org works fine when you're at a desk with a laptop. Mesh+ gives you the same firmware update in one tap inside the app you're already messaging from, right in the field off the phone already plugged into your radio. Since it only needs USB access and a download, the flasher ships in both the Google Play release and the standalone APK (SMS relay is the only feature limited to the APK).

The entire app sits around 3 MB (the v0.4.4 APK is 3,234,025 bytes), and the DFU code is a tiny slice of it, pulling in just two dependencies: usb-serial-for-android 3.11.0 for USB and Nordic's DFU library 2.11.0 for Bluetooth.

Try it, or read it

Grab the MIT-licensed source at github.com/backmeupplz/meshtastic-plus; the updater lives in app/src/main/java/com/backmeupplz/meshtasticplus/Firmware.kt. You can install Mesh+ for Android free from Google Play or grab the APK directly. Mesh+ is an independent app not affiliated with Meshtastic LLC; Meshtasticยฎ is a registered trademark of Meshtastic LLC.

Frequently asked questions

Does Mesh+ update ESP32 Meshtastic nodes? No. It only flashes nRF52 boards like the Heltec Mesh Node T114 and RAK4631. Use flasher.meshtastic.org for ESP32 hardware.

Will an update erase my messages and settings? No, the flash only writes the application image, so per the README your settings, rooms, and messages stay put.

What if the update stops halfway? The node stays sitting in its bootloader. Mesh+ automatically retries up to three times, and Node stuck in update mode? on the connect screen lets you pick up and finish the flash.

Can I install an older firmware? Yes. Open Firmware options to see every version Meshtastic publishes for your board, including older stable releases and, if you flip the switch, pre-releases.

Top comments (0)