Skip to content

Commit

Permalink
mpsl: cx: Matched nrf7002 with nrf700x coex implementation
Browse files Browse the repository at this point in the history
This commit does the following:
- Adds the nrf700x CX implentation (based on the old
  generic three pin interface), mostly renames
- Deleted the legacy generic three pin interface
- Modified the nrf7002dk_nrf5340 devicetree files and nrf7002_ek
  device tree overlays to allow the usage of nRF700x coexistence
  interface.
- Enable seamless using of the nRF700x Coexistence interface by
  so that the coexistence interface is enabled by default if
  it is supported in the device tree, CONFIG_WIFI is selected
  and one of the SR radio protocols is used
- Update documentation

Signed-off-by: Artur Hadasz <[email protected]>
  • Loading branch information
ahasztag authored and nordicjm committed Sep 21, 2022
1 parent 67dd359 commit 80f056a
Show file tree
Hide file tree
Showing 11 changed files with 183 additions and 73 deletions.
1 change: 0 additions & 1 deletion boards/arm/nrf7002dk_nrf5340/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ config BOARD

# By default, if we build for a Non-Secure version of the board,
# force building with TF-M as the Secure Execution Environment.

config BUILD_WITH_TFM
# Temporarily disable building Non-Secure images with TF-M support by
# default.
Expand Down
13 changes: 9 additions & 4 deletions boards/arm/nrf7002dk_nrf5340/nrf5340_cpuapp_common.dts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
};
};

nrf_radio_coex: nrf7002-coex {
status = "okay";
compatible = "nordic,nrf700x-coex";
req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
grant-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
};

/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
Expand Down Expand Up @@ -189,10 +198,6 @@ arduino_i2c: &i2c1 {
iovdd-ctrl-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
bucken-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
host-irq-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
coex-req-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
coex-status0-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
coex-grant-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
};
};

Expand Down
9 changes: 9 additions & 0 deletions boards/arm/nrf7002dk_nrf5340/nrf7002dk_nrf5340_cpunet.dts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
<21 0 &gpio1 3 0>; /* D15 */
};

nrf_radio_coex: nrf7002-coex {
status = "okay";
compatible = "nordic,nrf700x-coex";
req-gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
status0-gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
grant-gpios = <&gpio0 24 GPIO_ACTIVE_HIGH>;
swctrl1-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
};

/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
Expand Down
12 changes: 4 additions & 8 deletions boards/shields/nrf7002_ek/nrf7002_ek.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
#include <freq.h>
#include "nrf7002_ek_coex.overlay"

&arduino_spi {
status = "okay";
Expand All @@ -15,13 +16,8 @@
label = "NRF7002";
spi-max-frequency = <DT_FREQ_M(8)>;

iovdd-ctrl-gpios = <&arduino_header 6 GPIO_ACTIVE_HIGH>; /* D0 */
bucken-gpios = <&arduino_header 7 GPIO_ACTIVE_HIGH>; /* D1 */
host-irq-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */

coex-req-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; /* D2 */
coex-status0-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */
coex-grant-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D6 */
iovdd-ctrl-gpios = <&arduino_header 6 GPIO_ACTIVE_HIGH>; /* D0 */
bucken-gpios = <&arduino_header 7 GPIO_ACTIVE_HIGH>; /* D1 */
host-irq-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>; /* D7 */
};
};
15 changes: 15 additions & 0 deletions boards/shields/nrf7002_ek/nrf7002_ek_coex.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Copyright (c) 2022 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/ {
nrf_radio_coex: nrf7002-coex {
status = "okay";
compatible = "nordic,nrf700x-coex";
req-gpios = <&arduino_header 8 GPIO_ACTIVE_HIGH>; /* D2 */
status0-gpios = <&arduino_header 9 GPIO_ACTIVE_HIGH>; /* D3 */
grant-gpios = <&arduino_header 10 GPIO_ACTIVE_HIGH>; /* D4 */
swctrl1-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>; /* D6 */
};
};
88 changes: 73 additions & 15 deletions doc/nrf/ug_radio_coex.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ To enable Wi-Fi Coexistence, do as follows:
#. On the nRF5340, you must apply the settings to the Kconfig options mentioned in steps 1 and 2 also to the network core.
See :ref:`ug_multi_image`.

.. note::
When using the :ref:`ug_radio_cx_nrf700x_impl` implementation manually selecting the :kconfig:option:`CONFIG_MPSL_CX` Kconfig option is not needed.
If a ``nordic,nrf700x-coex`` compatible node is present in the device tree and :kconfig:option:`CONFIG_WIFI` is set to ``y``, :kconfig:option:`CONFIG_MPSL_CX` and :kconfig:option:`MPSL_CX_NRF700X` will be selected by default.

.. _ug_radio_cx_hardware_description:

Hardware description
Expand All @@ -71,19 +75,71 @@ To enable CX support for the currently supported CX implementation, you must add
You can also provide the node using the devicetree source file of the target board or an overlay file.
See :ref:`zephyr:dt-guide` for more information about the DTS data structure, and :ref:`zephyr:dt_vs_kconfig` for information about differences between DTS and Kconfig.

For the CX implementation currently supported, the ``nrf_radio_coex`` node has the ``compatible`` property set to ``generic-radio-coex-three-wire``.
Devicetree nodes compatible with ``generic-radio-coex-three-wire`` can be used when a three-wire interface to the PTA is provided (like the one shown in the following image).
The following CX hardware interfaces are currently supported:

* :ref:`ug_radio_cx_nrf700x_hw_if`
* :ref:`ug_radio_cx_generic_3_wire_hw_if`

Both supported hardware interfaces can be used when a three-wire interface to the PTA is provided (like the one shown in the following image).
However, the role of each of the pins is dependent on the Wi-Fi Coexistence implementation used.

.. note::
* When using one of the supported implementations, you must use the ``nrf_radio_coex`` name for the node.
However, if you add a custom user implementation, you can also use a different name.

* You can add a new device binding and use it as the ``compatible`` property for the node, if ``generic-radio-coex-three-wire`` is unsuitable.
* You can add a new device binding and use it as the ``compatible`` property for the node, if the provided hardware interfaces are unsuitable.

.. figure:: images/coex_generic_3pin_pta.svg
:alt: PTA interface supported by the ``nrf_radio_coex`` node with an nRF52 Series SoC


.. _ug_radio_cx_nrf700x_hw_if:

nRF700x Coexistence hardware interface
======================================

To configure the hardware for a PTA inside the nRF700x series chips:

1. Add the following node in the devicetree source file:

.. code-block::
/ {
nrf_radio_coex: nrf7002-coex {
status = "okay";
compatible = "nordic,nrf700x-coex";
req-gpios = <&gpio0 24 (GPIO_ACTIVE_HIGH)>;
status0-gpios = <&gpio0 14 (GPIO_ACTIVE_HIGH)>;
grant-gpios = <&gpio0 25 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
};
};
#. Optionally replace the node name ``nrf7002-coex`` with a custom one.
#. Replace the pin numbers provided for each of the required properties:

* ``req-gpios`` - GPIO characteristic of the device that controls the ``REQUEST`` signal of the PTA.
* ``status0-gpios`` - GPIO characteristic of the device that controls the ``PRIORITY`` signal of the PTA.
* ``grant-gpios`` - GPIO characteristic of the device that controls the ``GRANT`` signal of the PTA (RF medium access granted).
Note that ``GPIO_PULL_UP`` is added to avoid a floating input pin and is required on some boards only.
If the target board is designed to avoid this signal being left floating, you can remove ``GPIO_PULL_UP`` to save power.

The ``phandle-array`` type is used, as it is commonly used in Zephyr's devicetree to describe GPIO signals.
The first element ``&gpio0`` indicates the GPIO port (``port 0`` has been selected in the example shown).
The second element is the pin number on that port.

#. On the nRF5340, you must also apply the same devicetree node mentioned in step 1 to the network core.
To do so, apply the overlay to the correct network-core child image by creating an overlay file named :file:`child_image/*childImageName*.overlay` in your application directory, for example :file:`child_image/multiprotocol_rpmsg.overlay`.

The ``*childImageName*`` string must assume one of the following values:

* ``multiprotocol_rpmsg`` for multiprotocol applications having support for both 802.15.4 and Bluetooth.
* ``802154_rpmsg`` for applications having support for 802.15.4, but not for Bluetooth.
* ``hci_rpmsg`` for application having support for Bluetooth, but not for 802.15.4.

.. _ug_radio_cx_generic_3_wire_hw_if:

Generic three wire Coexistence hardware interface
=================================================

To configure the hardware for a PTA using a 3-wire interface:

1. Add the following node in the devicetree source file:
Expand Down Expand Up @@ -113,7 +169,7 @@ To configure the hardware for a PTA using a 3-wire interface:
The first element ``&gpio0`` indicates the GPIO port (``port 0`` has been selected in the example shown).
The second element is the pin number on that port.

#. On the nRF5340, you must also apply the same devicetree node mentioned in step 2 to the network core.
#. On the nRF5340, you must also apply the same devicetree node mentioned in step 1 to the network core.
To do so, apply the overlay to the correct network-core child image by creating an overlay file named :file:`child_image/*childImageName*.overlay` in your application directory, for example :file:`child_image/multiprotocol_rpmsg.overlay`.

The ``*childImageName*`` string must assume one of the following values:
Expand All @@ -129,18 +185,18 @@ Wi-Fi Coexistence implementations

The following CX implementations are available:

* :ref:`ug_radio_cx_generic_3pin_impl`
* :ref:`ug_radio_cx_nrf700x_impl`
* :ref:`ug_radio_cx_thread_impl`

Each implementation is a plugin composed of one or more C source files interfacing with the MPSL API, which, in turn, communicates with the SR protocol drivers.

When one of the CX variants is enabled, the driver requests access to the RF medium from the PTA and informs it about the operation it is about to perform.
It also reacts properly to the information from the PTA that access to the RF medium was either granted or denied.

.. _ug_radio_cx_generic_3pin_impl:
.. _ug_radio_cx_nrf700x_impl:

Generic 3-pin interface implementation
======================================
nRF700x interface implementation
================================

This implementation uses the following pins to communicate with the PTA:

Expand All @@ -149,21 +205,23 @@ This implementation uses the following pins to communicate with the PTA:
It can be configured by setting the ``req-gpios`` property of the ``nrf_radio_coex`` devicetree node.
* PRIORITY pin - It is the output controlled by the protocol driver.
It contains information about the type of operation (either RX or TX) to perform.
It can be configured by setting the ``pri-dir-gpios`` property of the ``nrf_radio_coex`` devicetree node.
It can be configured by setting the ``status0-gpios`` property of the ``nrf_radio_coex`` devicetree node.
* GRANT pin - It is the input of the SoC controlled by the PTA.
It asserts when PTA grants access to the RF to the 802.15.4 and deasserts when it denies the access.
It can be configured by setting the ``grant-gpios`` property of the ``nrf_radio_coex`` devicetree node.

The support for this interface is provided in a single-file plugin located in the sdk-nrf repo, in the :file:`subsys/mpsl/cx` directory.

Adding support for the CX generic 3-pin interface
-------------------------------------------------
Adding support for the CX nRF700x interface
-------------------------------------------

The generic 3-pin interface is supported out of the box.
The nRF700x interface is supported out of the box.
To use it, complete the following steps:

1. Set the :kconfig:option:`CONFIG_MPSL_CX_GENERIC_3PIN` Kconfig option to ``y``.
2. Add the devicetree `nrf_radio_coex` node as described in :ref:`ug_radio_cx_hardware_description`.
1. Add the devicetree `nrf_radio_coex` node as described in :ref:`ug_radio_cx_nrf700x_hw_if`.
2. If :kconfig:option:`CONFIG_WIFI` is set to ``y`` and one of the supported SR protocols is enabled no additional steps are needed.
If you do not wish to use the radio coexistence implementation, you must set :kconfig:option:`CONFIG_MPSL_CX` to ``n``
3. If :kconfig:option:`CONFIG_WIFI` is disabled or none of the supported SR protocols are enabled the implementation must be enabled manually with :kconfig:option:`CONFIG_MPSL_CX` and :kconfig:option:`CONFIG_MPSL_CX_NRF700X`

.. _ug_radio_cx_thread_impl:

Expand Down
37 changes: 37 additions & 0 deletions dts/bindings/radio_coex/nordic,nrf700x-coex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

description: |
This is a representation of an external radio coexistence setup for coexistence
with nRF700x WiFi chips.
compatible: "nordic,nrf700x-coex"

include: base.yaml

properties:
req-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC connected to the PTA's REQUEST pin.
status0-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC connected to the PTA's PRIORITY pin.
This GPIO is also used to indicate direction (TX/RX).
grant-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC connected to the PTA's GRANT pin.
swctrl1-gpios:
type: phandle-array
required: false
description: |
GPIO of the SOC controlling the Priority (STATUS1) pin (in 4-wire
coex case) of the nRF7002
21 changes: 0 additions & 21 deletions dts/bindings/wifi/nordic,nrf7002.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,3 @@ properties:
required: true
description: |
GPIO of the SOC controlling the HOST IRQ pin of the nRF7002
coex-req-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC controlling SR Coexistence REQ pin of the nRF7002
coex-status0-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC controlling SR Coexistence STATUS pin of the nRF7002
coex-grant-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC controlling SR Coexistence GRANT pin of the nRF7002
swctrl1-gpios:
type: phandle-array
required: true
description: |
GPIO of the SOC controlling the Priority (STATUS1) pin (in 4-wire
coex case) of the nRF7002
4 changes: 2 additions & 2 deletions subsys/mpsl/cx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

if (CONFIG_MPSL_CX_THREAD OR CONFIG_MPSL_CX_BT_1WIRE OR CONFIG_MPSL_CX_BT_3WIRE OR CONFIG_MPSL_CX_GENERIC_3PIN)
if (CONFIG_MPSL_CX_THREAD OR CONFIG_MPSL_CX_BT_1WIRE OR CONFIG_MPSL_CX_BT_3WIRE OR CONFIG_MPSL_CX_NRF700X)
zephyr_library()

zephyr_library_sources_ifdef(CONFIG_MPSL_CX_THREAD thread/mpsl_cx_thread.c)
zephyr_library_sources_ifdef(CONFIG_MPSL_CX_BT_1WIRE bluetooth/mpsl_cx_1w_bluetooth.c)
zephyr_library_sources_ifdef(CONFIG_MPSL_CX_BT_3WIRE bluetooth/mpsl_cx_3w_bluetooth.c)
zephyr_library_sources_ifdef(CONFIG_MPSL_CX_GENERIC_3PIN generic_3pin/mpsl_cx_generic_3pin.c)
zephyr_library_sources_ifdef(CONFIG_MPSL_CX_NRF700X nrf700x/mpsl_cx_nrf700x.c)
endif()
28 changes: 20 additions & 8 deletions subsys/mpsl/cx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

DT_COMPAT_CX_NRF700X := nordic,nrf700x-coex

config MPSL_CX_ANY_SUPPORT
bool
default $(dt_nodelabel_enabled,nrf_radio_coex)

config MPSL_CX_NRF700X_SUPPORT
bool
default $(dt_nodelabel_has_compat,nrf_radio_coex,$(DT_COMPAT_CX_NRF700X))

config MPSL_CX
bool "Radio Coexistence interface support"
depends on MPSL_CX_ANY_SUPPORT
default WIFI && (BT || NRF_802154_RADIO_DRIVER || NRF_802154_SER_HOST)
help
Controls if Radio Coexistence interface is to be configured and enabled
when MPSL is initialized.
Expand All @@ -31,6 +43,14 @@ config MPSL_CX_INIT_PRIORITY
choice MPSL_CX_CHOICE
prompt "Radio Coexistence interface implementation"

config MPSL_CX_NRF700X
depends on MPSL_CX_NRF700X_SUPPORT
select NRFX_GPIOTE if !MPSL_CX_PIN_FORWARDER
select GPIO if !MPSL_CX_PIN_FORWARDER
bool "nRF700x Radio Coexistence"
help
Radio Coexistence supporting nRF700x interface.

config MPSL_CX_THREAD
select NRFX_GPIOTE if !MPSL_CX_PIN_FORWARDER
select GPIO if !MPSL_CX_PIN_FORWARDER
Expand Down Expand Up @@ -63,14 +83,6 @@ config MPSL_CX_BT_1WIRE
Radio Coexistence interface implementation using a simple 1-wire PTA
implementation for co-located radios.

config MPSL_CX_GENERIC_3PIN
select NRFX_GPIOTE if !MPSL_CX_PIN_FORWARDER
select GPIO if !MPSL_CX_PIN_FORWARDER
bool "Generic 3-pin Radio Coexistence support [EXPERIMENTAL]"
select EXPERIMENTAL
help
Radio Coexistence supporting Generic 3-pin interface.

endchoice # MPSL_CX_CHOICE

endif # MPSL_CX
Expand Down
Loading

0 comments on commit 80f056a

Please sign in to comment.