Commit graph

12 commits

Author SHA1 Message Date
Florian Grandel fce4788415 drivers: ieee802154: cc13xx_cc26xx_subg: fix oper. state
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>
2023-10-05 12:01:29 +03:00
Florian Grandel 016d3bed5c drivers: ieee802154: cc13xx_cc26xx_subg: improve locking
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>
2023-10-05 12:01:29 +03:00
Florian Grandel 128354ae17 drivers: ieee802154: cc13xx_cc26xx_subg: simplify static funcs
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>
2023-10-05 12:01:29 +03:00
Piotr Dymacz 22f6c87afc drivers: ieee802154: cc13xx_cc26xx{_subg}: fix reversed extended address
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>
2023-08-30 10:23:50 +02:00
Florian Grandel 0ea5658491 drivers: ieee802154: cc13/26xx_subg: remove unused radio commands
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>
2023-06-23 09:20:55 +02:00
Florian Grandel 81fa03f7a3 drivers: ieee802154: cc13/26xx_subg: clean up constants
The CC13xx/CC26xx Sub-GHz driver header file defined several constants
that were not used in the driver.

Other constants could be replaced with generic constants which were
introduced in the prior commit.

This change removes and/or replaces redundant definitions.

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-23 09:20:55 +02:00
Florian Grandel b224a099fd net: l2: ieee802154: standardize RSSI value
The RSSI value in net_pkt (net_pkt_cb_ieee802154.rssi) was used
inconsistently across drivers. Some drivers did cast a signed dBm value
directly to net_pkt's unsigned byte value. Others were assigning the
negative value of the signed dBm value and again others were offsetting
and stretching the signed dBm value linearly onto the full unsigned byte
range.

This change standardizes net_pkt's rssi attribute to represent RSSI on
the RX path as an unsigned integer ranging from 0 (–174 dBm) to 254 (80
dBm) and lets 255 represent an "unknown RSSI" (IEEE 802.15.4-2020,
section 6.16.2.8). On the TX path the rssi attribute will always be
zero. Out-of-range values will be truncated to max/min values.

The change also introduces conversion functions to and from signed dBm
values and introduces these consistently to all existing call sites. The
"unknown RSSI" value is represented as INT16_MIN in this case.

In some cases drivers had to be changed to calculate dBm values from
internal hardware specific representations.

The conversion functions are fully covered by unit tests.

Fixes: #58494

Signed-off-by: Florian Grandel <fgrandel@code-for-humans.de>
2023-06-17 07:16:32 -04:00
Stancu Florin e41de9235a drivers: ieee802154: cc13xx_cc26xx_subg: PA TX amplifier support
Enhance IEEE802154 Sub-GHz driver to support CC13x2P's internal power
amplifier (20dBm) for TX.

Note: requires board-specific antenna switching for it to work
properly.

Signed-off-by: Stancu Florin <niflostancu@gmail.com>
2023-01-27 17:44:38 +09:00
Florian Grandel c3b080166e drivers: ieee802154: introduce consistent MTU definition
This change applies the newly introduced consistent MTU definition to
all IEEE 802.15.4 radio drivers.

Signed-off-by: Florian Grandel <jerico.dev@gmail.com>
2022-08-31 21:52:37 +00:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Erik Larson 0a0404df29 drivers: ieee802154: cc13xx_cc26xx: raw mode support
This change adds IEEE802154_RAW_MODE support for the
cc1352r.

This allows using the cc1352r 2.4 GHz radio and Sub Ghz
radio as a transceiver (PHY) instead of using L2 networking.

Signed-off-by: Erik Larson <erik@statropy.com>
2020-11-23 09:46:49 +02:00
Christopher Friedt ec0e737b0c drivers: ieee802154: cc13xx_cc26xx: sub-ghz support
This change adds IEEE 802.15.4g (Sub GHz) support for the
cc1352r.

The 2.4 GHz radio and the Sub GHz radio are capable of
operating simultaneously.

Fixes #26315

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
2020-11-09 10:25:24 +02:00