Skip to content

csrutil/Adafruit_nRF52_Bootloader_OTAFIX

 
 

Repository files navigation

Adafruit nRF52 Bootloader w/ Enhanced OTA DFU

The purpose of this fork is to change the behaviour of the bootloader in OTA DFU mode. When the bootloader detects an invalid application firmware after an OTA update it will boot back to OTA DFU mode. This isn't totally bulletproof but if your device is difficult to access then this is a lot better than the default behaviour which is to boot into UF2/CDC mode on detection of an invalid application firmware.

Additionally HCI_RX_BUF_QUEUE_SIZE is increased from 8 to 16. This is almost a necessity for OTA updates work on nRF52850 boards, otherwise a buffer overflow and crash in the bootloader is almost guaranteed.


Boards supported:

  • Heltec Automation Mesh Node T114 / HT-nRF5262
  • Nologo ProMicro NRF52840 (aka SuperMini NRF52840)
  • Seeed Studio SenseCAP Card Tracker T1000-E
  • Seeed Studio Wio Tracker L1
  • Seeed Studio XIAO nRF52840 BLE
  • Seeed Studio XIAO nRF52840 BLE SENSE
  • RAK 4631 (See note)

Any board already supported by the Adafruit nrf52 bootloader can be added, or if there's another nRF52840-based board you're interested in please raise an issue.

Supported OLED Displays

Supported Drivers

  • SSD1306
  • SH1106

Implementation Details

  • BRAND_NAME Splash
  • USB Mode Bootloader
  • BLE DFU Connected
  • BLE DFU Initializing
  • BLE DFU Progress bar

Screenshots

Meshtiny

Bootloader Features

  • BRAND_NAME Splash
  • USB Mode Bootloader
  • BLE DFU Connected
  • BLE DFU Initializing
  • BLE DFU Progress bar
  • Fast DFU Speed

Installation:

The recommended way to install the bootloader is using the UF2 file. Download the UF2 file for your board, enter UF2 mode (usually by double pressing the reset button within 0.5s) and copy the UF2 file across.

If you have accidentally flashed an incorrect bootloader to your device I recommend flashing a full bootloader and SoftDevice zip package using adafruit-nrfutil


Recommended settings and notes for doing OTA update:

To perform the OTA update you can use either "nRF Connect" (Android/iOS) or "nRF Device Firmware Update" (Android/iOS). My preference is the "nRF Device Firmware Update" app on Android, but I have no experience with flashing from iOS devices.

I use the following settings with the nRF Device Firmware Update app. Note that with the exception of "Force scanning" these are not set in stone.

DFU Settings Part 1/2 DFU Settings Part 2/2

Notes on settings:

  • Force scanning (called Scan for bootloader in Legacy DFU in nRF Connect) is required, because when initiating OTA DFU mode the device will reboot and start advertising as AdaDFU with a different MAC address, Force scanning is what allows the app to find the device after it reboots.
  • Packets receipt notification is not strictly required but in my experience it makes the update less likely to fail, at the cost of being much slower.

IMPORTANT: If you do an OTA update while your device is plugged into a computer the device will update but it will not boot into the new application firmware. It will require a manual reset in order to start. Plugged into a USB charger is fine.


Performing an OTA update on a MeshCore repeater

First you will need to login to the repeater and issue the 'start ota' CLI command.

Next open the nRF Device Firmware Update app, select the appropriate MeshCore firmware zip file for your device, select your device (it will be called ProMicro_OTA/RAK4631_OTA etc), and press start.

Now cross your fingers and hope for the best!


Donations:

Although it's not necessary, if you find this useful please consider donating to support my work!

Ko-Fi


Notes on RAK4631 bootloader

This version of the RAK4631 bootloader is based on a much newer version (0.9.2) of the Adafruit nRF52 bootloader than what RAK Wireless uses on their official bootloader (0.6.2-11).

I haven't looked to see what changes (if any) that RAK made to the Adafruit bootloader, so I'm not sure if there's any difference but I have tested this bootloader and I haven't found any problems thus far. If you would rather use the original RAK bootloader but with these patches included you can find that here.

About

USB-enabled bootloaders for the nRF52 BLE SoC chips

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.1%
  • Linker Script 0.5%
  • Assembly 0.5%
  • Makefile 0.4%
  • CMake 0.3%
  • Python 0.2%