🛠 Thread/OpenThread sous Zephyr et mises à jour DFU/UF2
Objectives
Move beyond BLE: the nRF52840 is also an IEEE 802.15.4 radio and a first-class Zephyr target (ieee802154-supported, OpenThread/Thread support documented by Zephyr). You will compile the OpenThread CLI sample for the nRF52840 target, flash it via the Adafruit UF2 bootloader, and then review the update methods: UF2 drag-and-drop, nrfutil serial DFU, and BLE OTA.
Hardware
- 1× Adafruit Feather nRF52840 Express + micro-USB data cable
- PC with Zephyr SDK +
west(nRF Connect SDK workspace or Zephyr main) - For Thread: a border router (Raspberry Pi + OpenThread) to form the network
Complete Code
# 1) Compiler l'echantillon OpenThread CLI pour nRF52840 (cible DK = meme SoC)
west init -m https://github.com/zephyrproject-rtos/zephyr --mr main ot-ws
cd ot-ws && west update
cd zephyr
west build -b nrf52840dk/nrf52840 samples/net/openthread/cli
# 2) Flash : soit par SWD (2x5 0.05" de la Feather, J-Link/DAPLink) :
west flash --runner jlink
# soit en UF2 : double-clic RST -> NeoPixel vert -> lecteur FTHR840BOOT,
# convertir build/zephyr.bin en .uf2 (uf2conv.py -f 0xADF7) puis glisser.
# 3) Console serie (115200) : commands OpenThread
# dataset init new / dataset commit active / ifconfig up / thread start
# thread state -> "leader" ou "child"
Expected Verification
thread state responds "child" after thread start when a border router is active; ping to an IPv6 address on the Thread network traverses the 802.15.4 radio. Regarding updates: dragging a UF2 file onto FTHR840BOOT reprograms the board without any JTAG tools — the boot chain is the preinstalled open-source Adafruit nRF52 UF2 bootloader.
Common Errors
- Bootloader < 0.6.1: Large UF2 files (CircuitPython 8.2.0+, heavy Zephyr images) are handled poorly — check
INFO_UF2.TXTon the BOOT drive and update the bootloader first (≤ 0.3.x: no UF2 auto-update, use the IDE). - Wrong UF2 family:
uf2conv.py -fmust match the nRF52840 family, otherwise the bootloader ignores the file. - Inverted Zephyr target:
nrf52840dk/nrf52840describes the SoC; DK pins ≠ Feather pins, adapt the device tree overlay. - Forgetting that IEEE 802.15.4 ≠ BLE: A Thread build is not detectable via BLE; plan for two builds or a multiprotocol build (significant RAM cost on 256 KB).
Other tutorials for this board
Code examples for this board
neopixel_pulsation.pyPythonled_bouton.pyPythonentrees_num.pyPythonanalogique_lumiere.pyPythonservo_pwm.pyPythonscanner_i2c.pyPython