Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IEEE802.15.4 support for nrf52 #11617

Merged
merged 4 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Documentation/applications/wireless/i8sak/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
==================================================

Description
-----------
===========

The i8sak app is a useful CLI for testing various IEEE 802.15.4 functionality.
It also serves as a starting place for learning how to interface with the NuttX
Expand All @@ -30,7 +30,8 @@ _sticky_, meaning, if you set the endpoint short address once, any future
operation using the endpoint short address can default to the previously used
address. This is particularly useful to keep the command lengths down.

## How To Use
How To Use
==========

The i8sak app has a series of CLI functions that can be invoked. The default
i8sak command is ``i8`` to make things quick and easy to type.
Expand All @@ -47,6 +48,11 @@ This will tell the MAC layer that it should now act as a PAN coordinator using
PAN ID CD:AB. For now, this function assumes that we are operating a non-beacon
enabled PAN, since, as of this writing, beacon-enabled networks are unfinished.

Configure PAN coordinator short address and EP short addres::

i8 set saddr 0A:00
i8 set ep_saddr 0B:00

Next, on the same device, run::

i8 acceptassoc
Expand Down Expand Up @@ -117,7 +123,7 @@ similar to the following::
Dest. Address - 0xDEADBEEF00FADE0C
Src. Address - 0xDEADBEEF00FADE0A
Command Type - Association Response
Assigned SADDR - 0x000C
Assigned SADDR - 0x000B
Assoc Status - Successful

3a) ACK
Expand Down
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> &
44 changes: 44 additions & 0 deletions Documentation/platforms/arm/nrf52/ieee802154.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
==========================
Nordic nRF52 IEEE 802.15.4
==========================

.. note::

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

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 they require more work):

* beacon transmision (periodic transmition works, but requires verification)
* slotted CSMA-CA
* GTS

Fetures not implemented:

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

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
141 changes: 79 additions & 62 deletions arch/arm/src/nrf52/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
############################################################################
# ##############################################################################
# arch/arm/src/nrf52/CMakeLists.txt
xiaoxiang781216 marked this conversation as resolved.
Show resolved Hide resolved
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http:https://www.apache.org/licenses/LICENSE-2.0
# http:https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# License for the specific language governing permissions and limitations under
# the License.
#
############################################################################
# ##############################################################################

xiaoxiang781216 marked this conversation as resolved.
Show resolved Hide resolved
set(SRCS
nrf52_start.c
Expand Down 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 nrf52_ieee802154_radio.c)
list(APPEND SRCS nrf52_ieee802154_tim.c)
list(APPEND SRCS nrf52_ieee802154.c)

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

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

if(CONFIG_NRF52_TIMER)
Expand Down Expand Up @@ -130,65 +144,68 @@ endif()

if(CONFIG_NRF52_SOFTDEVICE_CONTROLLER)

set(NRFXLIB_VER "2.3.0")
set(NRFXLIB_URL "https://github.com/nrfconnect/sdk-nrfxlib/archive")

if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/sdk-nrfxlib)
FetchContent_Declare(
sdk-nrfxlib
DOWNLOAD_NAME "sdk-nrfxlib-v${NRFXLIB_VER}.tar.gz"
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
URL "${NRFXLIB_URL}/v${NRFXLIB_VER}.tar.gz"
SOURCE_DIR
${CMAKE_CURRENT_LIST_DIR}/sdk-nrfxlib
BINARY_DIR
${CMAKE_BINARY_DIR}/arch/sdk-nrfxlib
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
TEST_COMMAND
""
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)

FetchContent_GetProperties(sdk-nrfxlib)

if(NOT sdk-nrfxlib_POPULATED)
FetchContent_Populate(sdk-nrfxlib)
set(NRFXLIB_VER "2.3.0")
set(NRFXLIB_URL "https://github.com/nrfconnect/sdk-nrfxlib/archive")

if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/sdk-nrfxlib)
FetchContent_Declare(
sdk-nrfxlib
DOWNLOAD_NAME "sdk-nrfxlib-v${NRFXLIB_VER}.tar.gz"
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
URL "${NRFXLIB_URL}/v${NRFXLIB_VER}.tar.gz"
SOURCE_DIR
${CMAKE_CURRENT_LIST_DIR}/sdk-nrfxlib
BINARY_DIR
${CMAKE_BINARY_DIR}/arch/sdk-nrfxlib
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
INSTALL_COMMAND
""
TEST_COMMAND
""
DOWNLOAD_NO_PROGRESS true
TIMEOUT 30)

FetchContent_GetProperties(sdk-nrfxlib)

if(NOT sdk-nrfxlib_POPULATED)
FetchContent_Populate(sdk-nrfxlib)
endif()
endif()
endif()

set(NRFXLIB_DIR "${NUTTX_CHIP_ABS_DIR}/sdk-nrfxlib")
set(NRFXLIB_DIR "${NUTTX_CHIP_ABS_DIR}/sdk-nrfxlib")

target_include_directories(arch PRIVATE ${NUTTX_CHIP_ABS_DIR}/sdc)
target_include_directories(arch PRIVATE ${NRFXLIB_DIR}/mpsl/include)
target_include_directories(arch PRIVATE ${NRFXLIB_DIR}/softdevice_controller/include)
target_include_directories(arch PRIVATE ${NUTTX_CHIP_ABS_DIR}/sdc)
target_include_directories(arch PRIVATE ${NRFXLIB_DIR}/mpsl/include)
target_include_directories(
arch PRIVATE ${NRFXLIB_DIR}/softdevice_controller/include)

list(APPEND SRCS nrf52_sdc.c)
list(APPEND SRCS nrf52_sdc.c)

add_compile_options(-DNRF52_SERIES)
add_compile_options(-DNRF52_SERIES)

if(CONFIG_ARCH_FPU)
set(NRFXLIB_LIB_VARIANT hard-float)
else ()
set(NRFXLIB_LIB_VARIANT soft-float)
endif()
if(CONFIG_ARCH_FPU)
set(NRFXLIB_LIB_VARIANT hard-float)
else()
set(NRFXLIB_LIB_VARIANT soft-float)
endif()

if(CONFIG_NRF52_SDC_PERIPHERAL)
set(SOFTDEVICE_LIB_VARIANT libsoftdevice_controller_peripheral.a)
elseif(CONFIG_NRF52_SDC_CENTRAL)
set(SOFTDEVICE_LIB_VARIANT libsoftdevice_controller_central.a)
elseif(CONFIG_NRF52_SDC_MULTIROLE)
set(SOFTDEVICE_LIB_VARIANT libsoftdevice_controller_multirole.a)
endif()
if(CONFIG_NRF52_SDC_PERIPHERAL)
set(SOFTDEVICE_LIB_VARIANT libsoftdevice_controller_peripheral.a)
elseif(CONFIG_NRF52_SDC_CENTRAL)
set(SOFTDEVICE_LIB_VARIANT libsoftdevice_controller_central.a)
elseif(CONFIG_NRF52_SDC_MULTIROLE)
set(SOFTDEVICE_LIB_VARIANT libsoftdevice_controller_multirole.a)
endif()

target_link_libraries(arch
${NRFXLIB_DIR}/mpsl/lib/cortex-m4/${NRFXLIB_LIB_VARIANT}/libmpsl.a)
target_link_libraries(arch
${NRFXLIB_DIR}/softdevice_controller/lib/cortex-m4/${NRFXLIB_LIB_VARIANT}/${SOFTDEVICE_LIB_VARIANT})
target_link_libraries(
arch ${NRFXLIB_DIR}/mpsl/lib/cortex-m4/${NRFXLIB_LIB_VARIANT}/libmpsl.a)
target_link_libraries(
arch
${NRFXLIB_DIR}/softdevice_controller/lib/cortex-m4/${NRFXLIB_LIB_VARIANT}/${SOFTDEVICE_LIB_VARIANT}
)

endif()

Expand Down
Loading
Loading