Skip to content

ngominhquan/wstkble

Repository files navigation

wstkble (EFR32MG24 Bluetooth Application)

This repository contains firmware for an EFR32MG24-based WSTK target.
The project started from the SoC Empty template, but now includes a secure, bonded-only Application OTA DFU implementation, custom advertising payloads, and delayed-bonding logic tailored for the hardware running in-house tests.

Key Features

  • Encrypted & bonded BLE operation with delayed security escalation to avoid boot-time races.
  • Manufacturer-specific advertising payload that exposes the device identity and “needs pairing” indicator.
  • Application-level OTA DFU (no Apploader) that writes the new GBL into the internal storage slot and reboots automatically after verification.
  • UART logging helpers (app_log_mine) for both normal operation and OTA state/status messages.
  • Bootloader slot alignment with the internal single-slot (0x80C0_000 start, 737 280 bytes) configuration from /ref3.

Repository Layout

wstkble/
├─ app.c / app.h                 Main application logic and BLE event handling
├─ autogen/                      Generated SDK sources (GATT DB, linker script, etc.)
├─ config/                       Project-specific configuration headers
├─ image/                        Reference screenshots for documentation
├─ ref/ / ref2/ / ref3/          Reference projects (original template, Apploader BL, new internal-storage BL)
└─ .gitignore                    Ignores build artifacts such as “GNU ARM v10.3.1 - Default”

Prerequisites

  1. Tooling

    • Simplicity Studio 5 with Gecko SDK Suite 4.3.x.
    • GNU ARM v10.3.1 toolchain (installed automatically by Simplicity Studio).
  2. Hardware

    • Silicon Labs EFR32MG24 radio board (tested with BRD4188B).
    • WSTK mainboard with VCOM enabled (for UART debug output).
  3. Bootloader

    • Flash the ref3/bootloader-storage-internal-single-1536k project (build then flash the *.s37).
      This bootloader provides the internal storage slot the application OTA flow depends on.

Building & Flashing

  1. Open wstkble.slcp in Simplicity Studio to generate the project files.
  2. Build via Studio or CLI (make -C "GNU ARM v10.3.1 - Default").
  3. Flash bootloader-storage-internal-single-1536k.s37 once, then flash wstkble.s37.
  4. Open a serial terminal (115200 8N1) to observe the logs.

Application-Level OTA DFU Flow

  1. Pair/bond the device (Just-Works). The app logs when the security level reaches mode 1 level 2.
  2. Use EFR Connect → Application OTA (not Apploader) on iOS/Android.
  3. The OTA control/data characteristics are set to bonded + encrypted only, so non-bonded devices receive a write-reject.
  4. Monitor UART for lines such as:
OTA state: READY -> DOWNLOAD_BEGIN
OTA state: DOWNLOAD_END -> VERIFY
OTA image ready. Rebooting to install...
  1. The board reboots automatically, the bootloader copies the verified slot image, and the updated firmware runs.

Logging Cheatsheet

Message snippet Meaning
Bonding: delayed bonding scheduled Bonding will be requested ~300 ms later
Connection parameters updated: sec_mode=1 Link is encrypted (Mode 1 Level 2)
OTA denied: link not bonded+encrypted Client attempted OTA without pairing
OTA storage slot start=0x080C0000 size=737280 Bootloader slot info (from handler)
OTA error: … See ota_error_code for cause

Troubleshooting

  • OTA session resets to READY: the phone closed the connection before the state machine reached WAIT_FOR_REBOOT. Keep the client in Application OTA mode until you see the reboot log.
  • No reboot after OTA: Ensure you are using the internal-storage bootloader (ref3) and that the linker script still ends the app at 0x80C0000.
  • Build errors about missing headers: regenerate the project from wstkble.slcp so Studio re-creates autogen/ with the proper include paths.

License

Derived from Silicon Labs examples under the Zlib license (see headers in source files). Any additional code in this repository follows the same license unless noted otherwise.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published