feat: PROVES USP radio integration (collapses PRs #1-#6) - #7
Mikefly123 wants to merge 12 commits into
Conversation
The EBYTE E22-400M30S (SX1262) module drives its RF switch via two
dedicated GPIOs (TX-EN, RX-EN) rather than DIO2, so the existing
dio2-as-rf-switch mechanism is unusable on boards using this module.
Changes:
- dts/bindings/usp/semtech,sx126x-new-common.yaml: add optional
tx-enable-gpios and rx-enable-gpios phandle-array properties with
full description of operating-mode semantics.
- drivers/usp/sx126x/sx126x_hal_context.h: add tx_enable and
rx_enable gpio_dt_spec fields to sx126x_hal_context_cfg_t (both
zero-initialised / .port==NULL when absent in DT, so boards without
the properties compile and behave identically to before).
- drivers/usp/sx126x/sx126x_board.c: configure both pins as
OUTPUT_INACTIVE at init; wire them into SX126X_CONFIG via the
existing CONFIGURE_GPIO_IF_IN_DT helper.
- drivers/usp/sx126x/sx126x_hal.c: add sx126x_hal_update_rf_switch()
that intercepts the first byte of every sx126x_hal_write() command
buffer and drives the GPIOs before the SPI transaction:
TX-class (TX-EN=1, RX-EN=0): 0x83 SetTx, 0xD1 SetTxContinuousWave,
0xD2 SetTxInfinitePreamble
RX-class (TX-EN=0, RX-EN=1): 0x82 SetRx, 0x94 SetRxDutyCycle,
0xC5 SetCad
Inactive (TX-EN=0, RX-EN=0): 0x84 SetSleep, 0x80 SetStandby
All other opcodes leave switch state unchanged.
Deactivation of the leaving path always precedes activation of the
entering path to prevent simultaneous PA+LNA enable.
Boards without tx-enable-gpios / rx-enable-gpios in DT are unaffected:
gpio_dt_spec.port is NULL and all branches are skipped at runtime.
Build verified: zephyr.elf + zephyr.uf2 compile clean on Zephyr 4.3 /
RP2350 with FLASH 104760 B / RAM 31564 B (ping_pong sample).
…nalized in 4.3) ZEPHYR_LORA_BASICS_MODEM_MODULE was an external-module auto-symbol in Zephyr <=4.2. In 4.3 it became an internal Zephyr symbol and is not exposed to external modules. Remove the select to avoid a fatal Kconfig 'direct dependencies 0' abort.
… layout Upstream usp removed lr_fhss_driver/src/; lr_fhss_mac.c now lives flat in sx126x_driver/src (same dir as LBM_SX126X_LIB_DIR). Drop the now- invalid subdirectory suffix to fix the cmake path.
…close BUSY-poll race sx126x_hal_check_device_ready() wakes a sleeping SX126x with a glitch on NSS and then immediately polls BUSY via sx126x_hal_wait_on_busy(). Per the datasheet, the chip needs up to ~340us (t_woff, warm start) after the wake-up NSS edge before it reliably asserts BUSY. Polling right away can sample BUSY before the chip has driven it, so the caller believes the radio is ready when it is still starting up; the very next SPI command (frequently SET_FREQ) is then clocked into a device that isn't listening yet and is silently dropped. This reproduces ~40% of the time in release builds where the post-wake instruction path is fast enough to win the race. Fix: insert a k_busy_wait(500) between the wake-up NSS toggle and the BUSY poll to wait out the chip's startup window before trusting BUSY.
…_call The RAC wraps every public entry point (engine pass included) in protect/unprotect and relies on it for mutual exclusion between the USP engine thread and API callers on other threads. The bare-metal stub shipped with this HAL did nothing, so a concurrent rp_task_enqueue()/abort against a running engine could tear the radio planner's task structs — observed as an RP_FAILSAFE panic on a LOCK_RADIO_ACCESS task whose type field read non-LOCK, and a TX launch taken through the LR-FHSS branch while on a LoRa profile. Implement protect/unprotect_api_call with a k_mutex. k_mutex allows recursive locking by the owner, which the RAC requires: post- transaction callbacks run inside the engine pass and may call smtc_rac_unlock_radio_access(), which re-enters protect. The radio/timer IRQ callbacks only set flags and never call protect, so ISR context is excluded by design; assert if a caller violates this.
…schema Zephyr 4.4 board-schema.yaml requires name+full_name (or extend). The vendored xiao_nrf54l15 board.yml predates this; matches the in-tree Zephyr 4.4.1 board metadata. Signed-off-by: Michael Pham <phamlongmichael@gmail.com>
…r_fhss_driver layout
…p BUSY-poll race
…unprotect_api_call
…r Zephyr 4.4 schema
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Superseded by native GitHub stack Lora-net#8 (PRs #1-#6, bottom-to-top: feat/sx126x-external-rf-switch-gpio -> fix/zephyr-4.3-drop-lbm-module-select -> fix/lr-fhss-src-path-flattened-layout -> fix/sx126x-wakeup-busy-race-settle-delay -> fix/smtc-modem-hal-rac-api-mutex -> fix/xiao-nrf54l15-board-yml-full-name). Stack-top tree is verified identical to this branch's tree (0bf3e20) — no content is lost. Closing this PR in favor of the stack, but keeping the |
Purpose
Provides a single integration branch for the
proves-core-referencesuperproject to pin as itsusp_zephyrmodule revision, replacing the set of carried patches previously applied on top ofmain(see Open-Source-Space-Foundation/proves-core-reference#439).This branch merges each of the 6 currently open constituent PRs, in order, via explicit
--no-ffmerge commits, so each PR's own commit history and review thread remain intact and traceable. The resulting tree is byte-identical tomain(bfacd43) with all 6 patches applied.Constituent PRs
The constituent PRs above remain open — they are the per-change review/traceability record and are not being merged or closed by this PR.
Related