This change slightly simplifies the configuration of a CSL receiver and
generalized CSL_RX_TIME to EXPECTED_RX_TIME as a re-usable primitive
across several timing-sensitive IEEE 802.15.4 standard sub-protocols
(namely BE-PANs/DSME/CSL/RIT/TSCH).
This API change is based on the rules outlined in RFC #61227.
Fixes: #62918
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Improves standard conformance of the IEEE802154_CONFIG_ENH_ACK_HEADER_IE
option and introduces certain "soft MAC" capabilities around header IEs:
* Introduces types and helpers that allow driver maintainers to
represent, parse, write and validate header IEs.
* Introduces helper functions to access non-aligned fields in header
IEs, namely element IDs.
Updates the only existing L2 and driver pair that uses
IEEE802154_CONFIG_ENH_ACK_HEADER_IE: OpenThread platform radio and nRF5
and improves header IE validation in the nRF5 driver.
This change should help further driver maintainers to support
OpenThread's CSL and vendor IE extensions. It is based on the rules
specified in RFC #61227.
It is also a precondition to generically support both, "soft MAC" and
"hard MAC", approaches to header IEs in the TSCH protocol, namely the
time synchronization IE.
Fixes: #62940
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
"Sleeping" has a well defined meaning in Zephyr related to threading and
power management. This differs from OpenThread's definition:
- Deprecates the "SLEEP_TO_TX" capability as it is redundant and
conflicts with all of Zephyr's nomenclature, #61227, RFC 2863, Thread
standard and IEEE 802.15.4. This binds the API to an implementation
detail of OpenThread, instead. See #63670 for the agreed migration path.
- Renames the "SLEEP" event to "RX_OFF" which conforms to the
nomenclature in Zephyr, this API and IEEE 802.15.4.
Fixes: #62995
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Introduces a (currently redundant) buffer length sanity check to prepare
for L2s that support PHYs with PHY payloads > 127 bytes.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Introduces a (currently redundant) buffer length sanity check to prepare
for L2s that support PHYs with PHY payloads > 127 bytes.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Not only the return code of TI's RF command queueing mechanism but also
the command status need to be checked to assert that a command was
executed successfully. This change introduces additional checking of the
command status.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The frequency synchronization command requires a proper frequency to be
set in order to be successfully executed. The command not being executed
leads to unnecessary internal error handling wrt command scheduling.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Moves the RX callback closer to where it's actually being used also
removing the necessity to declare a function prototype.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The driver API now distinguishes between operational UP/DOWN states as
required by Zephyr's network API and receiver on/off states as an
internal driver state for improved standard conformance.
This change closes the gap between the driver API requirements and the
implementation in this respect.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Replaces the mutex by a semaphore for ISR readiness as requested by the
driver API specification.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Checks whether the receiver is already on before trying to switch it on.
This also closes a gap wrt the driver API specification.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Restructuring and renaming of driver-internal functions for improved
readability and maintainability:
- distinguish between externally exposed API methods
(cc13xx_cc26xx_sub_* prefix) and internal helper methods
(drv_* prefix).
- extract a few functions to reduce complexity and improve re-use
Also removes unnecessary initial runtime blanking of static (.bss) data
in the newly introduced extracted buffer initialization functions.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
A little refactoring that simplifies dealing with nanosecond timestamp
values in packets and further decouples calling code from PTP:
Benefits:
- simplifies calling code by removing redundant conversions.
- prepares for removing PTP dependencies from net_pkt.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Replaces the previous approach to define bands via hardware capabilities
by the standard conforming concept of channel pages.
In the short term this allows us to correctly calculate the PHY specific
symbol rate and several parameters that directly depend from the symbol
rate and were previously not being correctly calculated for some of the
drivers whose channel pages could not be represented previously:
* We now support sub-nanosecond precision symbol rates for UWB. Rounding
errors are being minimized by switching from a divide-then-multiply
approach to a multiply-then-divide approach.
* UWB HRP: symbol rate depends on channel page specific preamble symbol
rate which again requires the pulse repetition value to be known
* Several MAC timings are being corrected based on the now correctly
calculated symbol rates, namely aTurnaroundTime, aUnitBackoffPeriod,
aBaseSuperframeDuration.
In the long term, this change unlocks such highly promising functional
areas as UWB ranging and SUN-PHY channel hopping in the SubG area (plus
of course any other PHY specific feature).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Aligns the name of the return value variable with what is used elsewhere
in the driver and the subsystem for improved readability and
consistency.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Preparative change to introduce build-time configured channel pages.
This fixes the description of the driver's available PHYs and makes
channel page and channel range independent from runtime attributes.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
When radio is set to promiscuous mode it is desirable to receive
invalid frames. This skip a few checks and allow an invalid and
non-standard frames be delivered for diagnose.
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
The at86rf231 frame buffer access mode read differs from all other
transceivers by only transfer one more byte after PSDU data instead
three. This difference is not evaluated in the current version of
the driver. The current change add the necessary check and read the
missing data (EQ, TRAC).
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Based on the 'Technical Reference Manual' for CC13x2/CC26x2 SimpleLink
MCU family, the device contains factory pre-programmed 64-bit IEEE MAC
address for 802.15.4 radio inside two FCFG 32-bit registers:
1. MAC_15_4_0: first 32-bit of the 64-bit IEEE MAC address
2. MAC_15_4_1: last 32-bit of the 64-bit IEEE MAC address
The way current version of the driver setups the address results in
incorrect bytes order (the address is reversed):
uart:~$ ieee802154 get_ext_addr
Extended address: AF:03:B7:25:00:4B:12:00
This fixes the problem in both drivers (also in the Sub-GHz version)
which results in use of proper EUI-64 address:
uart:~$ ieee802154 get_ext_addr
Extended address: 00:12:4B:00:25:B7:03:AF
IEEE MAC address was confirmed with UniFlash, nRF Sniffer for 802.15.4
and IEEE OUI database (00:12:4B is one of registered OUI for Texas
Instruments).
To prevent confusion in future, short notice about bytes order for
'mac' field in driver's data structures was also included.
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
The prototype of `nrf_802154_energy_detected` callout has changed.
This commit adjusts to this change.
Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Based on the standard based definitions given in previous commits, the
TX timestamp used for timed TX now refers to the start of PHR. As OT
continues to calculate timestamps based on a "start of SHR" definition,
the duration of the PHY specific SHR is added in the OT adaptation layer
to make up for this OT quirk.
Fixes: #59245
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Builds upon the newly introduced nrf_802154_phr_timestamp_get() function
to calculate RX timestamps according to the timestamp definitions
introduced in earlier commits and removes the prior workaround to
calculate the start-of-frame message timestamp point.
Fixes: #59245
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
OT does not have 64 bit timestamp support. This is a limitation of OT
and not of the IEEE 802.15.4 driver API. Therefore any workaround
related to such OT idiosyncracies should be encapsulated inside the OT
adapatation layer.
This change moves the OT-specific conversion of OT 32 bit timestamps to
Zephyr 64 bit timestamps into the OT adaptation layer.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The IEEE 802.15.4 API and networking subsystem were using several
inconsistent timestamp resolutions and types. This change defines all
timestamps with nanosecond resolution and reduces the number of
available types to represent timestamps to two:
* `struct net_ptp_time` for PTP timestamps
* `net_time_t` for all other high resolution timestamps
All timestamps (including PTP timestamps) are now referred to a
"virtual" local network subsystem clock source based on the well-defined
types above. It is the responsibility of network subsystem L2/driver
implementations (notably Ethernet and IEEE 802.15.4 L2 stacks) to ensure
consistency of all timestamps and radio timer values exposed by the
driver API to such a network subsystem uptime reference clock
independent of internal implementation details.
The "virtual" network clock source may be implemented based on arbitrary
hardware peripherals (e.g. a coarse low power RTC counter during sleep
time plus a high resolution/high precision radio timer while receiving
or sending). Such implementation details must be hidden from API
clients, as if the driver used a single high resolution clock source
instead.
For IEEE 802.15.4, whenever timestamps refer to packet send or receive
times, they are measured when the end of the IEEE 802.15.4 SFD (message
timestamp point) is present at the local antenna (reference plane).
Due to its limited range of ~290 years, net_time_t timestamps (and
therefore net_pkt timestamps and times) must not be used to represent
absolute points in time referred to an external epoch independent of
system uptime (e.g. UTC, TAI, PTP, NTP, ...).
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Adapts a return type to the API specification. The changed return type
is not referenced anywhere so it can be changed without breaking
backwards compatibility.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The support for capability IEEE802154_OPENTHREAD_HW_MULTIPLE_CCA is added
to the ieee802154_nrf5 driver.
Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
Use generic symbols defined in ieee802154.h for packet/FCS size instead
of redefining them in the driver header.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
In case upper layer does not follow the convention, and the net_pkt
provided to the nRF 15.4 driver had a payload larger than the maximum
payload size of an individual 15.4 frame, the driver would end up with
buffer overflow.
Fix this by adding an extra payload_len check before attempting to copy
the payload to the internal buffer.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The Kconfig IEEE802154_NRF5_MULTIPLE_CCA option is added.
The new functions `z_ieee802154_nrf5_extra_cca_attempts_set` and
`z_ieee802154_nrf5_extra_cca_attempts_get` are added.
The ieee802154_nrf5.c is updated allowing to pass extra cca attempts
to nRF 802.15.4 Radio Driver.
Signed-off-by: Andrzej Kuroś <andrzej.kuros@nordicsemi.no>
The code declares variables in switch-case blocks. This
seems to compile without an error on GCC 11 and newer,
but older compilers don't accept this code.
Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
PHY overrides have been checked against the latest version of TI's
SmartRF(TM) Studio. The result was regression tested (PER/performance)
against LAUNCHXL-CC1352P1 boards.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The length field in the header refers to the size of the MAC so it
shouldn't rely on constants describing PHY header length. While
currently both constants have the same value this will no longer be true
for enhanced PHYs and/or MAC frames as the number of FCS bytes may then
be four.
Also introduces an assertion that ensures that the given package buffer
does not exceed the TX buffer's length. An assertion is enough as the
package buffer is allocated at compile time.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The CMD_CLEAR_RX and CMD_SET_TX_POWER commands are declared and
initialized but not used anywhere. They are therefore removed to reduce
RAM/flash footprint.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
Switch the driver to the soft CSMA/CA algorithm as an intermediate
compromise for improved standard compliance (namely expontential
backoff) until true hardware support can be implemented by chaining
radio commands.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The driver's CCA method had various issues and would always return an
error code. This is fixed in this change.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This change introduces inline documentation with references to the
current version of the IEEE 802.15.4 standard.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The CC13xx/CC26xx Sub-GHz driver announces a hardware CSMA/CA capability
which it provides only partially. This change documents the gap.
The change also fixes two related issues with the current CCA
implementation:
- The given default ED threshold was above the allowed threshold
defined in the specification.
- The CCA timeout was not calculated according to the requirements
defined in the standard.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
This change introduces standard variable names used elsewhere in the
stack for improved naming consistency and readability.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The driver contained references to KConfig variables w/o the required
CONFIG_ prefix. This change introduces the missing prefixes.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
The low-level configuration of the chip's radio commands was mostly
redundant. This change removes redundant configuration code.
This is also relevant as a preparation to supporting further frequency
bands and operating modes on the same SUN FSK channel page with
similar but slightly different settings (center frequencies, channel
spacing, modulation index as defined in the standard). The SUN FSK
standard defines plenty of such variations with different physical
characteristics and trade-offs. Such variations are highly relevant in
industrial applications which will be targeted by TSCH. Using the
correct settings is required for additional features (e.g. frequency
hopping) and interoperability.
Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>