LogoLogo
  • Ruuvi Developer Documentation
  • Ruuvi Hardware
    • RuuviTag B
    • RuuviTag Pro
    • Ruuvi Gateway
    • Ruuvi DevShield
    • Ruuvi Connector Kit
    • TMP 117 External Sensor
  • Ruuvi Connector System
    • Introduction
    • Expansion boards
    • Cables
    • Connectors
  • Ruuvi Sensor Firmware
    • 1.2.12
    • 2.5.9
    • 3.X
      • 3.x Sensors
      • 3.x Heartbeat
    • Device Firmware Update (DFU)
  • Ruuvi Gateway Firmware
    • GW Getting Started
    • GW Web-UI
      • Greeting window
      • Internet connection settings
        • Connection via Wi-Fi
        • Connection via Ethernet
      • Software update
      • Automatic configuration download
      • Automatic updates
      • Access Settings from LAN
      • Cloud Options
        • Backend: HTTP(s)
        • Backend: MQTT(s)
        • Backend: Statistics
      • Time Synchronisation Options
      • Bluetooth Scanning Settings
      • Configuration completion
      • Authentication when accessing from LAN
    • GW Install custom firmware
    • GW nRF52811 Firmware
      • GW nRF52811 selftest
      • GW nRF52811 scanning
      • GW nRF52811 repeating
      • GW nRF52811 UART communication
  • GW ESP32 Firmware
    • GW ESP32 WiFi Hotspot
    • GW ESP32 Button
    • GW ESP32 LED
    • GW ESP32 HTTP Client
    • GW ESP32 MQTT client
  • GW Data formats
    • HTTP: Time-stamped data from Bluetooth-sensors
    • HTTP: Data from Bluetooth-sensors without timestamps
    • MQTT: Time-stamped data from Bluetooth-sensors
    • MQTT: Data from Bluetooth-sensors without timestamps
    • HTTP GET /history (with timestamps) and decoding
    • HTTP: Gateway status
    • Gateway configuration
  • GW Examples
    • Polling mode
    • Poll endpoint "/metrics"
    • Configuration update via API
    • Firmware update via API
    • Configuration download from a remote server via API
    • MQTT examples
    • Home Assistant
    • MQTT+AWS IoT Core
  • Communicate with RuuviTag devices via Bluetooth
    • Bluetooth advertisements
      • Data format 3 (RAWv1)
      • Data format 4 (URL)
      • Data format 5 (RAWv2)
      • Data format C5 (Cut-RAWv2)
      • Data format 8 (Encrypted environmental)
    • Bluetooth connection
      • DIS (Device Information Service)
      • NUS (Nordic UART Service)
        • Heartbeat transmissions
        • Read logged history
    • Real Time Transfer (RTT)
  • Communicate with Ruuvi Cloud
    • Ruuvi Cloud
      • User API
      • Gateway API
      • Internal API
      • Alerts
      • Cloud stored app settings
  • Ruuvi Community projects
    • Integrations
Powered by GitBook
On this page
  • OTA (Over the Air)
  • Ruuvi firmware version 1.x, 2.x
  • Ruuvi firmware version 3.x
  • SWD (Serial Wire Debug)
Edit on GitHub
  1. Ruuvi Sensor Firmware

Device Firmware Update (DFU)

Lifecycle: In production

Previous3.x HeartbeatNextGW Getting Started

Last updated 5 years ago

There are two different options on how to update RuuviTag firmware.

OTA (Over the Air)

Ruuvi firmware version 1.x, 2.x

Ruuvitag firmware version up until 2.x are built on top of Nordic SDK 12.3 / Softdevice s132 v3.1.1. The bootloader on these RuuviTags uses debug-mode which skips hardware and firmware version checks.

The keyfile to sign the RuuviTag updates is published in repository.

Command to generate DFU package for RuuviTags up to firmware version 2

nrfutil pkg generate --debug-mode --application _build/ruuvi_firmware.hex --hw-version 3 --sd-req 0x91 --key-file ~/git/ruuvitag_fw/keys/ruuvi_open_private.pem ruuvi_firmware_dfu.zip

To upload package to RuuviTag, press button "B" and tap "R" to reset the tag. Bootloader checks if button "B" is pressed at boot and enters the bootloader mode.

Ruuvi firmware version 3.x

Ruuvi firmware 3 builds on SDK15.3 and Softdevice s132 v6.1.1. There are special edition RuuviTags with nRF52811 that do not have bootloader at all due to size constraints.

The bootloader is a production version and it enforces version checks. On RuuviTag B1 ... B7.1 the hardware version is 0xB0, regardless of which sensors are installed.

Command to generate DFU package for RuuviTags with firmware version 3

nrfutil pkg generate --application _build/nrf52832_xxaa.hex --application-version 1 --hw-version 0xB0 --sd-req 0xB7 --key-file ruuvi_open_private.pem ${BINNAME}_dfu_app.zip

In bootloader mode the tag advertises itself with name "RuuviBoot" and it provides . Nordic Semiconductor provides libraries for and to interface with the service.

SWD (Serial Wire Debug)

If you're developing your own firmware or need to flash hunderds or more of RuuviTags, you should consider using a wired programmer for higher programming speed. To create your own hex image for flashing, you need 4 parts:

  • Softdevice

  • Bootloader

  • Bootloader settings

  • Application

The softdevice is given by Nordic Semiconductor or other company which provides the radio protocol.

Application is the .hex file you have created.

Commands to generate application settings and merge them into one package

nrfutil settings generate --family NRF52 --application _build/nrf52832_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex

mergehex -m ../../../../nRF5_SDK_15.3.0_59ac345/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex $BOOTLOADER settings.hex -o sbc.hex

mergehex -m sbc.hex _build/nrf52832_xxaa.hex -o packet.hex

Commands to flash the package to RuuviTag

nrfjprog --eraseall

nrfjprog --program packet.hex

nrfjprog --reset

If your firmware is secret or you wish to avoid duplications by users, you should enable the read protection bit .

nrfjprog -f nrf52 --rbp ALL

If you have enabled the read protection, you must run nrfjprog --recover to use the programming interface again. This completely erases the tag.

Always power cycle the tag after using a wired programmer. Otherwise the debug interface might remain active and consume excess current.

You can use Ruuvi's bootloader available at , but you should at least change the public key used for verifying the firmware images to ensure that you can keep the full control of your tags.

Settings are generated with nrfutil, which is part of . You'll also need nrfjprog and mergehex from the command line tool package.

ruuvitag_fw
BLE DFU Service
iOS
Android
https://github.com/ruuvi/ruuvi.nrf5_sdk15_bootloader.c
Nordic Command Line Tools