Repository navigation
Long-range release. The module-to-module link is now established on Coded PHY (S=8) instead of being brought up on 1M and upgraded afterwards, and a memory-corruption bug affecting every earlier build is fixed.
Flashing
Download MultiNav-Pro-Plus-BLE-Firmware-V2.5.hex below and flash it with STM32CubeProgrammer — no build environment required. Connect via ST-LINK, drag the hex into CubeProgrammer, and press Download. Flash both modules.
Long-range peer link
The peer link already ran at Coded PHY S=8 once established, but everything that established a link ran on 1M: advertising, scan configuration, discovery, connection configuration and connection creation.
That left a large asymmetry. A link could carry sensor data far beyond the distance at which it could be re-established, so a momentary dropout stranded the remote node until it was physically brought back within 1M range. Coded S=8 gives -104 dBm sensitivity against -97 dBm on 1M, and link setup has no retransmission to fall back on.
Coded PHY advertising is only legal inside extended advertising, because legacy advertising PDUs are 1M-only by specification. The module therefore now runs two advertising sets concurrently:
| Set | Type | Purpose |
|---|---|---|
| 0 | Legacy 1M, connectable + scannable | Phone |
| 1 | Extended, Coded primary + secondary | Peer module |
The phone path is unchanged. Not every phone scans Coded PHY, and that link is short range anyway, so set 0 is configured and enabled by exactly the same code path as before.
Scanning covers both 1M and Coded so a peer is discoverable either way, while initiating is Coded-only.
BLUE RAM sizing — affects every earlier build
stm32wb0x_hal_radio.c reserves the hardware BLUE RAM as __blue_RAM[CFG_NUM_RADIO_TASKS * sizeof(STATMACH_TypeDef) + sizeof(GLOBALSTATMACH_TypeDef)], pinned by the linker script to the fixed address 0x200000C0. That file includes only stm32wb0x_hal.h, never app_conf.h, so the guard in stm32wb0x_hal_conf.h defaulted CFG_NUM_RADIO_TASKS to 2 while the stack was initialised with 4.
The controller addresses state machine N by absolute address — (BLUEDATAWORD + N) in stm32wb0x_ll_radio.h — so state machines 2 and above fell outside the reservation and overwrote .bss, which begins immediately after it. On this target sizeof(STATMACH_TypeDef) is 80 bytes, so 160 bytes of application variables were being corrupted whenever a third radio task was scheduled.
CFG_NUM_RADIO_TASKS is now a project-level define symbol for both build configurations, so it reaches every translation unit and __blue_RAM is sized correctly at 428 bytes. app_conf.h validates the value rather than defining it.
If you maintain a fork, this is worth picking up independently of the Coded PHY work.
Also in this release
- Advertising-data parsing is fully bounds-checked. Extended reports carry up to 229 bytes against 31 for legacy, which made a
uint8_tindex wrap and an unchecked length byte reachable. - Peer advertising runs at 100-120 ms rather than the phone's 20-30 ms, since a Coded S=8 packet occupies 8x the airtime.
- The scan window is split across the PHYs being scanned, so total duty stays near 90% and the phone link keeps its airtime.
CFG_PEER_CODED_PHY_CONNECTinCore/Inc/app_conf.hreverts the whole long-range path to 1M in a single edit.
Notes for integrators
Two ST GAP APIs take one PHY bit per call — aci_gap_set_scan_configuration and aci_gap_set_connection_configuration — while aci_gap_start_procedure and aci_gap_create_connection take a bitmap. Passing a bitmap to the first two returns 0x12 BLE_ERROR_INVALID_HCI_CMD_PARAMS.
Build footprint: flash 232,260 of 258,048 bytes, RAM 34,252 of 65,536 bytes.
Range performance depends heavily on antenna height. In the two-ray ground-reflection regime, range scales with the square root of the product of the two antenna heights, so raising both ends buys far more than any firmware setting.