Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

EPD-nRF5

E-paper display firmware for Nordic nRF52 microcontrollers with Bluetooth Low Energy (BLE) support. This firmware enables wireless image transfer, OTA updates, and flexible configuration for e-paper displays.

This project is part of the OpenDisplay ecosystem, providing open-source firmware and protocol standards for e-paper displays.

About

This is a fork of tsl0922/EPD-nRF5 for compatibility with the OpenDisplay protocol standard.

Key Features

  • Low Power Operation: Optimized for minimal power consumption with deep sleep support
  • BLE Communication: Bluetooth Low Energy for wireless updates and configuration
  • Config-driven displays: panels are driven from drive packets in the config (UC81xx and SSD16xx families)
  • Direct Write Mode: Bufferless image transfer for efficient memory usage
  • OTA Updates: Over-the-air firmware updates via BLE DFU
  • Button Support: Interrupt-based button handling with press counting
  • LED Control: RGB LED support with configurable flash patterns
  • Battery Monitoring: Built-in battery voltage reading via ADC
  • NFC: an I2C NFC tag chip (NXP NTAG I2C plus or TNB132M) set up by the config; NDEF read and write over BLE, field detect in the advertisement and as a wake source

Supported Hardware

Microcontrollers

  • nRF52811 (primary target)

E-Paper Displays

Firmware 3.0 has no built-in panel drivers. A panel is driven by the drive packets in its config (0xB1 panel, 0xAE refresh mode), run by the shared OpenDisplay drive chain in od/.

The presets for this target live in Firmware_Unified, not here:

  • panels/nrf52811/presets.yaml is the source (drive steps, notes, 0xB0 palette units);
  • panels/generated/drive_presets_nrf52811.json is generated from it by panels/tools/gen_nrf52811.py, and every Firmware_Unified release carries it as drive_presets_nrf52811.json;
  • panels/nrf52811/README.md says what the presets are and how to add one.

Only presets checked on a real panel ship (status glass). Their ids are provisional (0xE0xx / 0xE1xx).

host/tests/run.sh KEY checks that a preset's bus traffic on this firmware matches its replay. It reads the presets from a Firmware_Unified checkout: set OD_UNIFIED=<checkout> (default: a Firmware_Unified folder next to this repo) or OD_PRESETS=<file>.

Building

Prerequisites

  • ARM GCC toolchain (arm-none-eabi-gcc)
  • nRF Command Line Tools (for flashing and hex merging)
  • nrfutil (for OTA package generation, optional)

See build-nrf52/README.md for detailed installation and build instructions.

Quick Start

cd build-nrf52
make

This generates _build/EPD-nRF52.hex which can be flashed to the device.

Complete Firmware Build

To build a complete firmware package including bootloader and softdevice:

cd build-nrf52
make GENERATE_OTA=1

This generates:

  • _build/EPD-nRF52-full.hex - Complete firmware
  • _build/EPD-nRF52-ota.zip - Signed OTA package (only with GENERATE_OTA=1; needs nrfutil)
  • _build/EPD-nRF52-settings.hex - Bootloader settings

The DFU signing key defaults to tools/priv.pem; KEY_FILE=/absolute/path overrides it. It must match the bootloader's public key.

Flashing

Using nrfjprog

# Flash complete firmware
nrfjprog --eraseall
nrfjprog --program build-nrf52/_build/EPD-nRF52-full.hex
nrfjprog --reset

Configuration

The firmware uses a TLV (Type-Length-Value) based configuration system that supports:

  • System configuration (device name, manufacturer data)
  • Display configuration (pin mapping, panel type, color scheme)
  • LED configuration (pin mapping, flash patterns)
  • Button configuration (pin mapping, debounce settings)
  • Sensor configuration
  • Data bus configuration
  • NFC configuration (0x2A, on an I2C data bus)
  • External flash (0x2B): the first enabled FlashConfig's MOSI/SCK/CS; the flash is sent the deep power-down command (0xB9) at boot, after every config write and before System OFF, and CS is held high
  • Power options

Configuration can be written via BLE using the OpenDisplay protocol. See the OpenDisplay documentation for protocol details.

BLE Protocol

The firmware implements the OpenDisplay BLE protocol standard. Key commands include:

  • 0x0040 - Read configuration
  • 0x0041 - Write configuration
  • 0x0042 - Write configuration chunk
  • 0x0070 - Direct write start
  • 0x0071 - Direct write data
  • 0x0072 - Direct write end
  • 0x0073 - LED activate
  • 0x0043 - Firmware version
  • 0x000F - Reboot
  • 0x0083 - NFC endpoint: read or write the NDEF record (single or chunked)

Deep sleep wake

0x0053 DEEP_SLEEP enters System OFF. Every configured button (0x25) wakes the tag at its pressed level, and so does the NFC field-detect pin. After such a wake:

  • the boot screen is drawn, as after any start;
  • the button that woke the tag (from the GPIO LATCH register, or still held) is advertised as its first press, so the host sees which button woke the tag.

NFC

glue/od_nrf_nfc.c, built unless make OD_CAP_NFC=0 (about 4 KB of flash).

  • The first NFC config (0x2A) with flags bit0 set is used. Its bus_instance names an I2C data bus (0x24): pin_1 SCL, pin_2 SDA, and pin_3 the chip's power pin when power_pin is 0xFF. Pins are GPIO numbers.
  • nfc_ic_type 0 (auto) probes an NXP NTAG I2C plus at address 0x55, and otherwise uses the TNB132M flow. 1 forces TNB132M, and 3 forces NTAG I2C plus (target-local value, not yet in the protocol header).
  • The chip is powered only for a session, waiting power_on_delay_ms (default 40 ms). A session runs at boot, on every config write, and for each 0x0083 request.
  • On an NTAG, the NDEF TLV goes in user blocks 0x01 to 0x37, with block 1 written last. Block 0 (I2C address, lock and capability bytes) and the configuration and lock blocks are never written.
  • 0x0083 has the same sub-commands, statuses, NACK codes and check order as the other 3.0 targets. A read returns at most 218 bytes; a chunked write takes up to 512.
  • Field detect: field_detect_mode 1 polls the pin and 2 adds a pin interrupt. Each active edge increments a 7-bit counter, and dynamicreturndata[adv_button_byte_index] = state | counter << 1 is advertised at once.
    • The pull follows the active level: pull-up when active low.
    • Before System OFF the pin is armed as a wake source.
    • A phone switches its field on and off many times while it reads; field_detect_debounce_ms 255 counts about one tap per touch. A change held back by the debounce is taken on a later pass, not lost.

See the OpenDisplay protocol documentation for complete protocol specifications.

Power Consumption

The firmware is optimized for low power operation:

  • Idle current: ~35 µA (with EPD powered down)
  • Active current: ~100 µA (during BLE operations)
  • Display update: ~5-10 mA (during refresh)

EPD GPIO is automatically powered down when not in use to minimize idle consumption.

Development

Building with Logging

RTT logging is disabled by default to reduce code size and power consumption. To enable:

cd build-nrf52
make ENABLE_RTT=1

Versioning

The version is set once, in build-nrf52/Makefile (MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION), and the git short SHA of the tree is detected at build time (with -dirty for uncommitted changes). Both go into the generated _build/od_nrf_build_id.h, which FIRMWARE_VERSION (0x0043) and the boot screen ("FW:N 3.0.0") read. They can be overridden:

cd build-nrf52
make MAJOR_VERSION=3 MINOR_VERSION=1 PATCH_VERSION=2 SHA=abc1234

License

This project is licensed under the GPL-3.0 license. See LICENSE for details.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages