Nordic Thingy:91
Configs
wakaama
Wakaama LwM2M demo using descriptors/examples/thingy91_wakaama_lte.yaml.
Brings up LTE, registers with the public Eclipse Leshan sandbox, and exposes the
on-board sensors as LwM2M objects:
Sensor |
Reading |
LwM2M |
uorb topic |
|---|---|---|---|
BME680 |
Temperature |
3303/0/5700 |
|
BME680 |
Humidity |
3304/0/5700 |
|
BME680 |
Pressure |
3315/0/5700 |
|
BME680 |
Gas |
3300/0/5700 |
|
BH1749 |
Colour R |
33001/0/0 |
|
BH1749 |
Colour G |
33001/0/1 |
|
BH1749 |
Colour B |
33001/0/2 |
|
Lightwell |
Colour (rw) |
33002/0/0 |
|
Sense LED |
Colour (rw) |
33003/0/0 |
|
GNSS |
Latitude |
6/0/0 |
|
GNSS |
Longitude |
6/0/1 |
|
GNSS |
Altitude |
6/0/2 |
|
GNSS |
Radius/eph |
6/0/3 |
|
GNSS |
Time (UTC) |
6/0/5 |
|
GNSS |
Speed |
6/0/6 |
|
GNSS |
Satellites |
33005/0/0 |
|
GNSS |
Course |
33005/0/1 |
|
GNSS |
Accuracy V |
33005/0/2 |
|
GNSS |
HDOP |
33005/0/3 |
|
GNSS |
PDOP |
33005/0/4 |
|
GNSS |
VDOP |
33005/0/5 |
|
Notes:
Runs non-secure behind the dedicated Thingy:91
miniboot_sbootloader, which grants I2C2 to the non-secure app (CONFIG_NRF91_SERIAL2_NS) and the RGB-LED PWMs (CONFIG_NRF91_PWM0_NS,CONFIG_NRF91_PWM1_NS).The BH1749 and both RGB LEDs are on the 3.3 V rail;
nrf91_pmic.cenables the ADP5360 buck-boost at bring-up (off at power-on reset). BME680 is on 1.8 V.The board has two RGB LEDs, driven by
nrf91_rgbled.c: the lightwell LED (the large LED in the enclosure light pipe) on PWM0 (P0.29/30/31) as/dev/rgbled0, and the sense LED (next to the sensors) on PWM1 (P0.0/1/2) as/dev/rgbled1. Objects 33002/0/0 (lightwell) and 33003/0/0 (sense) are writable packed0xRRGGBBcolours: write e.g.0xFF0000(16711680) from Leshan to set a LED red.Each sensor is cached by a
latestprogram into avirtIO so on-demand reads always return the last sample (uorb reads return-EAGAINbetween samples). The BH1749 RGB vector is split by avecsplitprogram.GNSS shares the modem with LTE-M (
AT%XSYSTEMMODE=1,0,1,0). The nRF91 GNSS driver defers starting the engine until the LTE stack has powered the modem (CFUN), so openingsensor_gnss0early does not fail.GNSS uses four dedicated sub-IOs (
dawn::CIOSensorGnss), all readingsensor_gnss0:gnss(position+velocity),gnss_time(UTC,uint64seconds),gnss_info(accuracy + DOP) andgnss_sats(uint32satellite count). Thegnssandgnss_infovectors are fanned out byvecsplitinto the LwM2M Location object (6) and the custom object 33005;gnss_time/gnss_satsare cached by alatestprogram so reads return the last value (0 until the first fix) rather than-ENODATA. A position fix requires sky view, so all GNSS resources read 0 until the modem locks.CONFIG_NRF91_MODEM_GNSS_BOOST_PRIOis enabled, but the boost is bounded and satellite-gated: GNSS only preempts LTE idle once it actually sees satellites (CONFIG_NRF91_MODEM_GNSS_BOOST_MINSV, default 4), and the priority is released after a timeout if no fix arrives, with a cool-down before retrying (..._BOOST_TIMEOUT/..._BOOST_COOLDOWN). Indoors GNSS sees nothing, so LTE is never preempted and the device stays reachable; outdoors GNSS grabs window time, gets the fix, then yields back to LTE.LTE power-save is configurable via
CONFIG_DAWN_SYSTEM_LTE_PSAVE(0 = none, 1 = PSM, 2 = eDRX), applied through the LTE API. The default (none) disables PSM/eDRX so the device stays reachable for server-initiated reads.The on-board 24CW160 (16-Kbit / 2 KB) I2C EEPROM (I2C2, 0x50) is registered as
/dev/eeprom0vianrf91_eeprom.c(generic24xx16geometry). It is not yet consumed by Dawn – exposed for later use.
Flashing
This non-secure application runs behind the miniboot_s secure bootloader.
Build both images and flash over the external J-Link:
source .venv/bin/activate
python -m dawnpy build build_thingy91_wakaama \
boards/arm/nrf91/thingy91/configs/wakaama \
-e CXX=g++-14 -e CC=gcc-14
python -m dawnpy build build_thingy91_miniboot_s \
boards/arm/nrf91/thingy91/configs/miniboot_s \
-e CXX=g++-14 -e CC=gcc-14
nrfutil device recover
nrfutil device program --firmware build_thingy91_miniboot_s/nuttx.hex \
--options chip_erase_mode=ERASE_ALL
nrfutil device program --firmware mfw_nrf9160_<ver>.zip
nrfutil device program --firmware build_thingy91_wakaama/nuttx.hex \
--options chip_erase_mode=ERASE_RANGES_TOUCHED_BY_FIRMWARE
nrfutil device reset
nrfutil device recoverclears access-port protection and also erases the modem firmware – re-flashmfw_nrf9160_<ver>.zipafter a recover.The application is flashed with
ERASE_RANGES_TOUCHED_BY_FIRMWAREto keep the bootloader intact.
RTT log
Console and syslog are on RTT channel 0 (there is no UART). View it with
JLinkRTTViewer (device nRF9160_xxAA, SWD, channel 0), or:
JLinkExe -device nRF9160_xxAA -if SWD -speed 4000 -autoconnect 1
# in another terminal:
JLinkRTTClient