Skip to content

Commit

Permalink
wip: arch/nrf52: add initial support for IEEE 802.15.4
Browse files Browse the repository at this point in the history
  • Loading branch information
raiden00pl committed Feb 16, 2024
1 parent 3a87f1d commit f4857ed
Show file tree
Hide file tree
Showing 18 changed files with 4,913 additions and 5 deletions.
17 changes: 17 additions & 0 deletions Documentation/platforms/arm/nrf52/boards/nrf52840-dk/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,20 @@ usbnsh
------

Basic NuttShell configuration (CDCACM console enabled in USB Port, at 115200 bps).

ieee802154_6lowpan
------------------

Cheat Sheet. Here is a concise summary of all all the steps needed to
run the UDP test (C=Coordinator; E=Endpoint)::

C: nsh> i8 wpan0 startpan cd:ab
C: nsh> i8 set saddr 0A:00
C: nsh> i8 set ep_saddr 0B:00
C: nsh> i8 acceptassoc
E: nsh> i8 wpan0 assoc
C: nsh> ifup wpan0
C: nsh> ifconfig <-- To get the <server-ip>
E: nsh> ifup wpan0
C: nsh> udpserver &
E: nsh> udpclient <server-ip> &
47 changes: 47 additions & 0 deletions Documentation/platforms/arm/nrf52/ieee802154.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
==========================
Nordic nRF52 IEEE 802.15.4
==========================

.. note::

This driver is highly experimental.
Help with development and testing will be appreciated ;)

Basic support for IEEE 802.15.4 can be found in
``arch/arm/src/nrf52/ieee802154``.

Supported features:

* frame transmission
* frame reception and filtering
* immediate ACK (incoming and outgoing)
* promiscuous mode
* delayed transmision
* radio events trace
* setting pending bit for all incoming Data Request frames
* un-slotted CSMA-CA

Work in progres features (some logic is present, but needs more work):

* slotted CSMA-CA
* GTS
* beacon transmision

Fetures not implemented:

* enhanced ACK (Enh-ACK)
* enhanced beacon
* low power mode
* advanced features from IEEE 802.15.4e

Reserved peripherals
====================

This implementation reserves the following peripherals:

* ``RADIO`` - used for radio operations

* ``TIMER0`` - used as high resolution timer for ACK, IFS and other radio delays

* ``RTC0`` - if superframe support is enabled, used as low power timer to hande
superframe events
14 changes: 10 additions & 4 deletions Documentation/platforms/arm/nrf52/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Peripheral Support

The following list indicates peripherals supported in NuttX:

========== ======= =====
========== ======= ===============
Peripheral Support Notes
========== ======= =====
========== ======= ===============
GPIO Yes
GPIOTE Yes
I2S No
Expand All @@ -64,7 +64,7 @@ PPI Yes
PWM Yes
QDEC No
QSPI Yes
RADIO Yes Basic
RADIO Yes BLE, IEEE 802.15.4
RNG Yes
RTC Yes
SAADC Yes
Expand All @@ -78,7 +78,7 @@ UART Yes
UARTE No
USBD Yes
WDT Yes
========== ======= =====
========== ======= ===============

Peripherals such as AAR, ACL, CCM, ECB are not directly used by NuttX since they
are part of BLE controller implementation (link).
Expand Down Expand Up @@ -206,6 +206,11 @@ is provided with settings already set.
Note that in this case, some peripherals (mostly those related to BLE) will be unavailable. Some PPI
channels will also be ocuppied (``NRF52_PPI_NUM_CONFIGURABLE_CHANNELS`` will be set accordingly in this case).

IEEE 802.15.4 Support
=====================

Details about IEEE 802.15.4 support for nRF52 can be found in :doc:`ieee802154`.

Supported Boards
================

Expand All @@ -214,3 +219,4 @@ Supported Boards
:maxdepth: 1

boards/*/*
ieee802154.rst
14 changes: 14 additions & 0 deletions arch/arm/src/nrf52/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ endif()

if(CONFIG_NRF52_RADIO)
list(APPEND SRCS nrf52_radio.c)

if(CONFIG_NRF52_RADIO_IEEE802154)
list(APPEND SRCS ieee802154/nrf52_ieee802154_radio.c)
list(APPEND SRCS ieee802154/nrf52_ieee802154_tim.c)
list(APPEND SRCS ieee802154/nrf52_ieee802154.c)

if(CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME)
list(APPEND SRCS ieee802154/nrf52_ieee802154_rtc.c)
endif()

if(CONFIG_NRF52_RADIO_IEEE802154_TRACE)
list(APPEND SRCS ieee802154/nrf52_ieee802154_trace.c)
endif()
endif()
endif()

if(CONFIG_NRF52_TIMER)
Expand Down
34 changes: 34 additions & 0 deletions arch/arm/src/nrf52/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,40 @@ config NRF52_RADIO_CUSTOM
bool "RADIO uses custom IRQ handlers"
default n

config NRF52_RADIO_IEEE802154
bool "RADIO IEEE802.15.4 protocol"
default n
depends on NRF52_HAVE_IEEE802154
select ARMV7M_USEBASEPRI
select ARCH_RAMVECTORS
select ARCH_IRQPRIO
select NRF52_RADIO_CUSTOM
select NRF52_TIMER0

if NRF52_RADIO_IEEE802154

config NRF52_RADIO_IEEE802154_SUPERFRAME
bool "RADIO IEEE802.15.4 superframe support"
default n
select NRF52_RTC0
select NRF52_USE_LFCLK

config NRF52_RADIO_IEEE802154_GTS_SLOTS
int "RADIO IEEE802.15.4 GTS slots"
default 2
depends on NRF52_RADIO_IEEE802154_SUPERFRAME

config NRF52_RADIO_IEEE802154_TRACE
bool "RADIO IEEE802.15.4 trace support"
default n

config NRF52_RADIO_IEEE802154_TRACE_BUFSIZE
int "RADIO IEEE802.15.4 trace buffer size"
depends on NRF52_RADIO_IEEE802154_TRACE
default 1024

endif

endif #NRF52_RADIO

endmenu # "RADIO Configuration"
Expand Down
16 changes: 15 additions & 1 deletion arch/arm/src/nrf52/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,21 @@ CHIP_CSRCS += nrf52_ppi.c
endif

ifeq ($(CONFIG_NRF52_RADIO),y)
CHIP_CSRCS += nrf52_radio.c
CHIP_CSRCS += nrf52_radio.c

ifeq ($(CONFIG_NRF52_RADIO_IEEE802154),y)
CHIP_CSRCS += ieee802154/nrf52_ieee802154_radio.c
CHIP_CSRCS += ieee802154/nrf52_ieee802154_tim.c
CHIP_CSRCS += ieee802154/nrf52_ieee802154.c

ifeq ($(CONFIG_NRF52_RADIO_IEEE802154_SUPERFRAME),y)
CHIP_CSRCS += ieee802154/nrf52_ieee802154_rtc.c
endif

ifeq ($(CONFIG_NRF52_RADIO_IEEE802154_TRACE),y)
CHIP_CSRCS += ieee802154/nrf52_ieee802154_trace.c
endif
endif
endif

ifeq ($(CONFIG_NRF52_TIMER),y)
Expand Down
Loading

0 comments on commit f4857ed

Please sign in to comment.