GNSS Livestock Ear Tag Feasibility


The safe bench-test firmware is built and packaged using the board’s actual 23-signal MCU mapping. I reviewed it and fixed a GNSS byte-loss problem before the final clean build. Compiled and host-tested does not mean hardware-tested: nothing has run on the physical board yet.
Included
  • SWD programming and RTT diagnostic commands—no USB console assumed.
  • Temperature, accelerometer, battery-voltage and power-status readings.
  • Read-only flash identification/status checks; no erase or write commands.
  • Buffered GNSS reception, checksum validation and stale-fix detection.
  • Explicit BLE advertising start/stop.
  • LoRa reset/status diagnostics only.
Charging remains disabled in hardware. There is no stimulation code, automatic LoRa transmission or flash erasure.
Build results
Zephyr 4.2.0 · GNU 12.2.0 · Zephyr SDK 0.17.4 · MinSizeRel

Table


ResourceUsed / available
Flash129,852 / 1,048,576 bytes — 12.38%
RAM, including reserved stacks/heap38,016 / 262,144 bytes — 14.50%
Warnings: 0 compiler, 0 linker, 0 Kconfig; two inherited Nordic devicetree duplicate-address warnings remain.
Executed sanitizer-test output:

Text


PASS bounded line/NMEA malformed-long-binary checks; command whitelist rejects TX/erase/write/arguments
PASS actual RX1024 ring: delayed bursts, wrap1000, overflow/discontinuity discard-resync, checksums, RMC A/V/malformed and receive-time stale FIX
PASS actual TMP117/LIS2DW12/VBAT conversions: negative/extreme/invalid/null/INT32 overflow inputs and exhaustive16-bit domain
HOST TESTS PASSED; ASan+UBSan exit0 expected; no hardware/dispatch/RF/storage behavior test claimed
No sanitizer defect diagnostics were emitted.
Downloads — use v2 First programming and tests
Follow the backup and APPROTECT inspection steps in the README before programming or resetting. Incorrect debug-protection settings can lock SWD access; no automatic recover or mass erase is included.
After those checks:

Bash


nrfjprog --program agrivanna-safe.hex --sectorerase --verify -f NRF52
nrfjprog --reset -f NRF52
Use regulated 5.0 V, initially without a battery, and verify rails externally first. Through RTT channel 0, run:

Text


help
status
sensors
accel
vbat
flash
radio
Then opt into gnss-on and ble-start. GNSS remains powered and received continuously; gnss-on/off controls location printing only. BLE advertising is off at boot.
Build assumptions: address 0, no bootloader or SoftDevice, module 32 MHz crystal, calibrated internal low-frequency RC clock, and an 8-second watchdog. Reset pin P0.18 is not driven as GPIO. Timing and peripheral operation remain unmeasured on hardware.
Still incomplete
Controlled LoRa packet transmission is not implemented yet. The module’s oscillator-control voltage needs reliable confirmation, and regional frequency/power limits are unspecified. Destructive flash testing, precision PPS timing and BLE GATT diagnostics are also omitted from this first baseline.
Which country will you test in, and will the LoRa output connect to an antenna or a 50 Ω dummy load? I recommend a dummy load for the first transmit test.
canada,
dummy load
I’ll use Canada and a 50 Ω dummy load as the test setup. I’ll check Canadian requirements and confirm the radio module’s oscillator settings, then add an explicitly armed, low-power single-packet test if those checks support it. Transmission will stay off at startup.
I recorded Canada and a 50 Ω dummy load in the Prototype Work Handoff.
No firmware changed this turn. The existing v2 firmware still provides LoRa status diagnostics only—packet transmission remains unavailable.
Remaining work is to confirm the module’s oscillator settings, check Canadian radio requirements, and implement and build an explicitly armed, low-power single-packet test. Charging remains disabled.
Execution stopped because your ACUs ran out.

Waiting for input


Board Bring-Up Plan
Reviewed silent firmware baseline v2 — 31 October 2026
CURRENT firmware package; supersedes ALL earlier firmware links, polling behavior, resource counts and arm/bounds test claims below. Earlier programming examples must NOT be used without the v2 APPROTECT procedure. All physical bring-up stages remain NOT RUN. No hardware/circuit edits.
  • Complete v2 source/binary/log/checksum package; source ZIP; current programming README;

    pinmap


    U1 module padSoC/functionlive net
    1GNDGND
    2GNDGND
    3P1.10CHG_STAT1
    4P1.11CHG_STAT2
    6P1.13PG_3V3
    11P0.02VBAT_SENSE
    15GNDGND
    16P0.27I2C_SCL
    19P0.26I2C_SDA
    22P0.06UART_TX
    23P0.07GNSS_PPS
    24P0.08UART_RX
    27P0.11INT_ACCEL
    28VDD3V3
    29P0.12INT_TEMP_ALERT
    30VDDH3V3
    32VBUSGND
    33GNDGND
    36P0.14SPI_MOSI
    37P0.13SPI_CLK
    38P0.16SPI_CS_LORA
    39P0.15SPI_MISO
    40P0.18MCU_RST
    41P0.17SPI_CS_FLASH
    42P0.19LORA_BUSY
    43P0.21INT_LORA_DIO1
    44P0.20LORA_RST
    46P0.22LORA_RXEN
    50P1.02GNSS_EXTINT
    51SWDIOSWDIO
    53SWDCLKSWDCLK
    55GNDGND
    61P1.01GNSS_RST
    .
  • HEX, ELF, exact build/test/audit results, release SHA256. Clean west build -p always: FLASH 129852/1048576 B (12.38%), RAM 38016/262144 B (14.50%). GNU12.2.0/SDK0.17.4, Zephyr4.2.0; 2 inherited DTS alias warnings, 0 C/linker/Kconfig warnings. Final compiled-input hashes, binary hashes, ZIP integrity verified.
  • GNSS always powered/received/parsed after successful async startup; gnss-on/off ONLY controls location printing (default off). Two256-byte UARTE EasyDMA buffers feed timestamped1024-byte ring. Bounded producer/consumer, overflow/drop/stop/restart/error counters; partial data flushed and discarded through newline after overflow/gap. No GNSS TX/config. Actual shared RMC/checksum/stale and TMP117/LIS2DW12/VBAT conversion functions sanitizer-tested, including delayed bursts, wrap/overflow/resync, negatives/extremes/invalid/INT32 overflow-domain inputs. Unused arm/scratch helpers removed. Host allowlist tested; actual dispatch/peripherals/ISR timing/RF/storage NOT tested. Static audit is not hardware proof.
  • Before first programming OR reset/power cycle: back up firmware/UICR; inspect PSELRESET words 0x10001200/204 AND APPROTECT 0x10001208; identify actual silicon. Fxx/rev3+ erased APPROTECT can lock after hard reset even with USE_UICR firmware. Read README's deliberate optional blank-only programmer write to5A, verified application/startup, readback-before-reset procedure. Older Dxx-and-earlier differs. No firmware/HEX UICR payload, no automatic recover/mass erase, no guessed keep-open Kconfig. Stop on unknown revision/protected/conflicting UICR. P0.18 still never GPIO-driven.
  • Existing bench supply/charging restrictions below remain: initial regulated5.0V J2, no real battery, external rail/CE/current verification; no MCU charger control. TX/erase/write denied; no full LoRa TX until TCXO manufacturer evidence and RF jurisdiction/load authorization. BLE opt-in advertising only (static identity traceable), no GATT; PG pulled to3V3 has limited diagnostic value; no precision PPS or field qualification. On-target DMA/driver recovery, peripherals/debug/watchdog/RF/current remain NOT RUN.
Supersedes only older statements below that firmware has not been written. All physical bring-up stages remain NOT RUN. First read-only firmware baseline compiled for a custom Zephyr 4.2.0 nRF52840 board, not a development-kit image. No hardware changes. No prior firmware-starter document or firmware asset was found; this existing guide is updated in place.
  • Complete source/binary/log package; Programming README and limitations;

    Live module-pad/SoC/net pinmap


    U1 module padSoC/functionlive net
    1GNDGND
    2GNDGND
    3P1.10CHG_STAT1
    4P1.11CHG_STAT2
    6P1.13PG_3V3
    11P0.02VBAT_SENSE
    15GNDGND
    16P0.27I2C_SCL
    19P0.26I2C_SDA
    22P0.06UART_TX
    23P0.07GNSS_PPS
    24P0.08UART_RX
    27P0.11INT_ACCEL
    28VDD3V3
    29P0.12INT_TEMP_ALERT
    30VDDH3V3
    32VBUSGND
    33GNDGND
    36P0.14SPI_MOSI
    37P0.13SPI_CLK
    38P0.16SPI_CS_LORA
    39P0.15SPI_MISO
    40P0.18MCU_RST
    41P0.17SPI_CS_FLASH
    42P0.19LORA_BUSY
    43P0.21INT_LORA_DIO1
    44P0.20LORA_RST
    46P0.22LORA_RXEN
    50P1.02GNSS_EXTINT
    51SWDIOSWDIO
    53SWDCLKSWDCLK
    55GNDGND
    61P1.01GNSS_RST
    .
  • Safe HEX, ELF. Starts at address 0; no bootloader or UICR payload. Back up existing firmware/UICR before programming. P0.18 is never configured as GPIO; inspect/reset-pin UICR procedure in README before relying on TP8.
  • After externally checking rails, connect TP4=VTref, TP5=GND, TP6=SWDIO, TP7=SWDCLK, optional TP8=reset. No USB console. Example: nrfjprog --program agrivanna-safe.hex --sectorerase --verify -f NRF52 then nrfjprog --reset -f NRF52. This replaces application sectors; no mass erase/recover default. Stop if access-protected, do not automatically erase.
  • Bidirectional RTT channel 0 via J-Link, NRF52840_XXAA / SWD / 1000 kHz. Commands: help, status, sensors, accel, vbat, flash, radio, gnss-on, gnss-off, ble-start, ble-stop. BLE advertising only on explicit command; no LoRa TX. Flash commands are read-only. Charger has no firmware control. Initial regulated 5.0 V J2, no battery; current limits/rail inspection in this plan still apply.
  • Build passed GNU 12.2.0 / SDK 0.17.4, MinSizeRel: flash 126380/1048576 B (12.05%), RAM 27840/262144 B (10.62%). Two inherited SoC DTS duplicate-address warnings; zero final compiler/linker/Kconfig warnings. Host ASan+UBSan parser/whitelist/bounds/expiry unit tests exited 0; not on-target tests. Package contains full logs/checksums.
  • Incomplete: full LoRa RF initialization and controlled TX variant are blocked by unestablished exact TCXO voltage (public sources disagree), plus missing jurisdiction/frequency/power/test-load authorization. radio only reset/GetStatus with bounded BUSY wait and reset afterward. Do not proceed to stage 7 with this baseline. Optional destructive scratch-sector test omitted; stage 5 uses JEDEC/status/read only. BLE advertising is diagnostic-name only, not a GATT diagnostic service. PPS/interrupt levels polled, not precision timestamped. No field/geofence/energy qualification.
Detailed manufacturer-source evidence is in SOURCES.md inside package; exact live U5 is TMP117AIDRVR, not an assumed sensor. All GPIO/net assignments were checked against live schematic and manufacturer module mapping. LF clock is calibrated internal RC because the module's 32.768 kHz crystal is external and unfitted; module has an internal 32 MHz HF crystal. No stimulation or low-power-production claim.
Revision D
Hardware facts this plan relies on
  • J2 bench input (Molex 505567-0271, 2-pos): pin1 = +5 V (VIN_RAW), pin2 = GND. Silkscreen: 5V ONLY, + at pin1, - at pin2. Regulated 5.0 V only. Recommended BQ25185 IN maximum is 5.5 V; never use 6 V. F1 (1206L020YR) is 0.2 A hold at 20 °C; expected peak SYS demand ≈0.13–0.15 A (LoRa TX). Input current limit set by R2 = 18 k (500 mA ILIM, 4.2 V VSET, TI Table 6-1).
  • J1 battery (Molex 505567-0371, 3-pos): pin1 = PACK+, pin2 = NC (no NTC; J1.2 unused), pin3 = PACK−/GND. Silkscreen: BATT, +, NC, -. Protected Renata pack or a current-limited battery emulator only. Verify cable polarity with a DMM before mating; do not infer from housing colour.
  • Charging disabled: BQ25185 ~CE pulled to SYS through R6 (100 k) → charge FET off; TS/MR through R29 (10 k) to GND; no thermistor. IN→SYS power path and BAT supplement remain active.
  • D1 SMF12A TVS: cathode at the pad marked K, net VIN_F. Package rev B silkscreen: misleading library anode-side bar removed; project cathode bar printed beside the K pad. Still confirm under microscope (body band must face the K/bar side).
  • SWD test pads: TP4 = 3V3 / VTref, TP5 = GND, TP6 = SWDIO, TP7 = SWDCLK, TP8 = nRESET. Other test points: TP1 = VIN (charger IN), TP2 = VBAT, TP3 = SYS.
  • RF: J3 = GNSS U.FL (passive antenna only, no bias), J4 = LoRa U.FL. Never transmit LoRa with J4 open.
Equipment
Current-limited regulated bench supply (5.0 V, set ≤300 mA, start lower), DMM, oscilloscope, SWD probe that senses VTref and does not power the board, ESD mat, thermal camera or probe, 50 Ω load or correct 868/915 MHz antenna for J4, passive GNSS antenna for J3, stock J1/J2 Micro-Lock Plus cables (housings 505565-0201 / -0301 with 505431-1000 crimps; confirm part numbers), current-limited battery emulator or the protected Renata pack.
Ordered procedure and acceptance

Table


StageProcedureCriterion / stop condition
1 Unpowered inspectionMicroscope: polarity of D1 (K mark), D2, U1/U2/U3/U4/U5/U6/U8/U9 pin-1 dots against silkscreen; no solder bridges on U9 (0.4 mm pitch) and U6; measure VIN, SYS, VBAT, 3V3 to GND resistanceNo rail-to-GND short; polarities correct; otherwise STOP
2 First power, no batteryJ1 disconnected. J2 = regulated 5.0 V, current limit 50 mA, then raise to ≤300 mA. Radios off (blank or safe firmware)No heating; record idle current. Hitting current limit = STOP and diagnose
3 Rails before peripheralsMeasure TP1 VIN ≈5.0 V, TP3 SYS, TP4 3V3 = 3.3 V ±3 %, 3V3_GNSS/3V3_LORA, U6 switch-node ripple; confirm U9 ~CE high (charging off) and no BAT currentAll rails in range; CE high; any oscillation, overshoot or temperature anomaly = STOP
4 SWDConnect probe to TP4–TP8; read nRF52840 ID; flash diagnostic firmware (separately written and reviewed, radios disabled by default)Probe does not back-power the board; readback OK
5 Peripherals, non-radiatingU4 flash JEDEC ID and scratch-sector R/W; U8 WHO_AM_I + INT; U5 temperature; U2 UART NMEA with passive antenna; U3 SPI status only, no TXIDs match parts; no rail excursions
6 Battery/emulatorEmulator through J1 at 3.7 V, current-limited; verify VBAT path via Q4 and that no charge current flows into J1 with J2 present. Do not connect a real pack and J2 together until this is proven.BAT current ≤ leakage with charging disabled; no reverse feed
7 LoRa TX (supervised)Only with correct antenna or 50 Ω load on J4. Short TX bursts at lowest power first, then rated power; watch SYS, 3V3 and F1 temperatureNo brownout or reset during TX; F1 not tripping; board temperature within limits
8 GNSS / BLE functionalGNSS fix with passive antenna outdoors/window; BLE advertising only if authorizedFunctional only; not position-integrity or range qualification
Record board serial, firmware hash, supply settings, instruments, ambient temperature and pass/fail at each stage. A failure or missing criterion blocks progression.
Out of scope / not claimed
No field qualification, no animal use, no certification, no charging validation, no stimulation. The 50 Ω RF feeds are a stackup calculation (0.1778 mm on Top over In1 GND); GNSS_RF two-port full-wave EM converged with low modeled loss; LORA_RF EM NOT VERIFIED (only a one-port run; two-port retry could not place a second port on the short feed — a simulation-geometry limit, not an electrical failure). Neither proves antenna performance.
Gate status
  • Reviewed silent firmware baseline v2 — 31 October 2026

  • Historical first compiled firmware addendum — superseded by v2 above; links and programming examples obsolete

  • Hardware facts this plan relies on

  • Equipment

  • Ordered procedure and acceptance

  • Out of scope / not claimed

  • Gate status