Repository navigation
PEND: drivers: basic_radio: add basic radio API and TI CC23x0 backend - #255
DavidFoscaTI wants to merge 8 commits into
Conversation
PR Summary by Qododrivers: basic_radio: add basic radio API and TI CC23x0 backend
AI Description
Merge Risk
|
|
The following west manifest projects have changed revision in this Pull Request:
⛔ DNM label due to: 1 impostor SHA Note: This message is automatically posted and updated by the Manifest GitHub Action. |
⏩ Board tests skippedCommit Board tests were not run because other checks on this commit failed: PR Metadata Check, Prevent Merging. Fix those first; the boards will run on the next push. |
|
This needs to be split up into several commits: at least one commit to update west.yml, and probably one commit per sample you add. For the rest I am not 100% sure what is best, but each commit should ideally change less files and be more self-contained |
Update hal_ti to a revision that provides the certified CC23x0R5 PHY settings used by the basic_radio CC23x0 backend. The revision is from TexasInstruments/hal_ti pull request 15 and is to be replaced by the merged revision. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
Add SIMPLELINK_F3_RADIO_DRIVER, which builds the Radio Control Layer (RCL), the LRF driver and the RF patches from hal_ti, and SIMPLELINK_F3_RADIO_PHYS, which builds the certified PHY settings. Drivers that use the radio select them. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
Add a vendor-neutral driver API for packet radios below the link layer, for applications that run their own protocol on a radio with no protocol-specific Zephyr API. The API is described in zephyrproject-rtos/zephyr issue 119337. A PHY is a backend-defined object, passed to basic_radio_config() as an opaque struct basic_radio_phy pointer. A PHY must be passed only to a radio of the backend that defined it. basic_radio_phy_get_std() returns the backend's PHY for a standard 2-GFSK profile whose frame format is defined by the API, so radios of different vendors can interoperate. Frequency, sync word, TX power and maximum payload length are applied on top of the PHY; flags select the fields to apply, so any value, including 0, can be set. TX, RX and tone operations are asynchronous, take per-operation overrides and can be scheduled on a 64-bit microsecond radio time base. Events carry a sync word timestamp and, for received packets, the RSSI. get_caps() reports the optional operations and the frequency and power ranges of the active PHY; ext_ctl() carries vendor commands. Devicetree describes the radio hardware only. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
Add a basic_radio backend for the CC23x0 on-chip radio, on top of the Radio Control Layer (RCL) of hal_ti. A CC23x0 PHY names an LRF_Config generated by SysConfig, the phyFeatures word selecting its sub-PHY, its characterized frequency range and the default frequency, sync word and TX power applied when it is selected. The frame header layout and TX power range are read from the register list of the LRF_Config, so PHYs with different layouts can be switched at runtime. Only generic PBE configurations are accepted. The certified PHYs of the CC2340R5 are provided in a per-SoC catalog, built when BASIC_RADIO_CC23X0_PHY_CATALOG is set. Its default PHY is applied at init unless BASIC_RADIO_CC23X0_DEFAULT_PHY is disabled. The catalog has no PHY for the standard profiles yet, so basic_radio_phy_get_std() returns -ENOTSUP. RCL keeps the RSSI and timestamp of the last received packet only: when several packets are reported at once, the earlier ones report them as unknown. Each operation takes the radio before it reads the active PHY, so a concurrent basic_radio_config() cannot change the PHY between the checks and the submission. TI_CC23X0_EXT_GET_STATS returns the RX and scheduler counters. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
Add a sample that transmits a packet every two seconds through the basic_radio API, on the default PHY of the radio. It runs on lp_em_cc2340r5. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
Add a sample that receives packets continuously through the basic_radio API, on the default PHY of the radio, and logs their length, timestamp, RSSI and payload. It runs on lp_em_cc2340r5. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
Add a sample that transmits a continuous wave for five seconds through the basic_radio API, at the frequency and TX power of the default PHY. It runs on lp_em_cc2340r5. Signed-off-by: David Fosca Gamarra <d-foscagamarra@ti.com>
e2dcfd0 to
8b16c12
Compare
Temporary commit for hardware testing, to be folded into the API, CC23x0 backend and radio_rx sample commits. - cc23x0: hand each drained RX buffer back to RCL right after its last entry is reported instead of after the whole drain, so long drains do not starve RCL of buffers. - cc23x0: report RX buffer exhaustion / RX FIFO overflow as -ENOBUFS instead of -EIO and count it in rx_overflow_count. - api: document that callbacks must be short and the RX_DONE status values, including -ENOBUFS. - radio_rx: only copy packets into a k_msgq in the callback, log from main() and restart reception when it ends.
| if (status_to_errno(cmd->status) == -ENOBUFS) { | ||
| data->rx_overflow_count++; | ||
| } |
There was a problem hiding this comment.
1. Overflow totals stay hidden from callers 🐞 Bug ◔ Observability
rx_callback() increments rx_overflow_count, but TI_CC23X0_EXT_GET_STATS does not copy that counter into the public statistics structure. Applications can see an individual reception end with -ENOBUFS, but cannot retrieve the cumulative overflow count alongside the other radio counters.
Agent Prompt
## Issue description
The new `rx_overflow_count` is incremented but never returned by the vendor statistics command, so callers cannot retrieve its cumulative value.
## Fix Focus Areas
- drivers/basic_radio/backends/ti/cc23x0/basic_radio_cc23x0.c[609-611]
- drivers/basic_radio/backends/ti/cc23x0/basic_radio_cc23x0.c[1298-1310]
- include/zephyr/drivers/basic_radio/ti_cc23x0.h[189-200]
## Recommended Fix
Add an RX overflow field to the public statistics structure and populate it in the interrupt-protected `TI_CC23X0_EXT_GET_STATS` snapshot. Update the command documentation to describe what the counter includes.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Add a vendor-neutral driver API for packet radios below the link layer, for applications that run their own protocol on a radio with no protocol-specific Zephyr API.
A PHY is as an opaque pointer and must only go to a radio of the backend that defined it. Frequency, sync word, TX power and maximum payload length are applied on top of the PHY; flags select the fields to apply, so any value, including 0, can be set. TX, RX and tone operations are asynchronous, take per-operation overrides and can be scheduled on the radio time base. get_caps() reports the optional operations and the frequency and power ranges of the active PHY; ext_ctl() carries vendor commands. Devicetree describes the radio hardware only.
The CC23x0 backend drives the on-chip radio through the Radio Control Layer (RCL) of hal_ti. A CC23x0 PHY names an LRF_Config generated by SysConfig, the phyFeatures word selecting its sub-PHY, its characterized frequency range and the default frequency, sync word and TX power applied when it is selected. The frame header layout and TX power range are read from the register list of the LRF_Config, so PHYs with different layouts can be switched at runtime. Only generic PBE configurations are accepted. The certified PHYs of the CC2340R5 are provided in a C catalog, whose default PHY is applied at init unless CONFIG_BASIC_RADIO_CC23X0_DEFAULT_PHY is disabled.
Signed-off-by: David Fosca Gamarra d-foscagamarra@ti.com
DO NOT MERGE