Skip to content

Commit 9ad5e8d

Browse files
pdgendtnashif
authored andcommitted
boards: shields: Add OpenThread RCP over Arduino header
Create a virtual shield to connect an OpenThread RCP radio device with a host using the UART or SPI bus. Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
1 parent a540ee6 commit 9ad5e8d

File tree

6 files changed

+229
-0
lines changed

6 files changed

+229
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2025 Basalte bv
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SHIELD_OPENTHREAD_RCP_ARDUINO_SERIAL || SHIELD_OPENTHREAD_RCP_ARDUINO_SPI
5+
6+
if OPENTHREAD
7+
8+
config SERIAL
9+
default y if SHIELD_OPENTHREAD_RCP_ARDUINO_SERIAL
10+
11+
config SPI
12+
default y if SHIELD_OPENTHREAD_RCP_ARDUINO_SPI
13+
14+
config HDLC_RCP_IF
15+
default y
16+
17+
endif # OPENTHREAD
18+
19+
endif
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2025 Basalte bv
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SHIELD_OPENTHREAD_RCP_ARDUINO_SERIAL
5+
def_bool $(shields_list_contains,openthread_rcp_arduino_serial)
6+
7+
config SHIELD_OPENTHREAD_RCP_ARDUINO_SPI
8+
def_bool $(shields_list_contains,openthread_rcp_arduino_spi)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
.. _openthread_rcp_arduino_shield:
2+
3+
OpenThread RCP over Arduino header
4+
##################################
5+
6+
Overview
7+
********
8+
9+
This (virtual) shield can be used to connect a board with an Arduino R3 compatible header to an
10+
external `OpenThread RCP`_ device. The RCP device would function as the Thread radio, while another
11+
board can function as the OpenThread host.
12+
13+
Requirements
14+
************
15+
16+
An RCP radio device is needed for this shield to work. As an example, the reference from
17+
OpenThread using the :zephyr:board:`nrf52840dk` is chosen as a demonstration. Refer to the
18+
`OpenThread on nRF52840 Example website`_.
19+
20+
Both UART and SPI can be used as the transport, depending on the board connections.
21+
22+
The following was executed on Ubuntu 24.04 to build and flash the RCP firmware:
23+
24+
Preparation
25+
===========
26+
27+
.. code-block:: bash
28+
29+
git clone https://github.com/openthread/ot-nrf528xx.git --recurse-submodules
30+
cd ot-nrf528xx
31+
python3 -m venv .venv
32+
source .venv/bin/activate
33+
./script/bootstrap
34+
35+
Building
36+
========
37+
38+
.. tabs::
39+
40+
.. group-tab:: UART
41+
42+
.. code-block:: bash
43+
44+
# Set -DOT_PLATFORM_DEFINES="UART_HWFC_ENABLED=1" to enable flow control
45+
./script/build nrf52840 UART_trans -DOT_PLATFORM_DEFINES="UART_HWFC_ENABLED=0"
46+
47+
.. group-tab:: SPI
48+
49+
.. code-block:: bash
50+
51+
./script/build nrf52840 SPI_trans_NCP
52+
53+
Flashing
54+
========
55+
56+
.. code-block:: bash
57+
58+
arm-none-eabi-objcopy -O ihex build/bin/ot-rcp build/bin/ot-rcp.hex
59+
nrfjprog -f nrf52 --chiperase --program build/bin/ot-rcp.hex --reset
60+
61+
Pins Assignments
62+
================
63+
64+
The RCP firmware comes with default pins assigned, the following table lists both the Arduino header
65+
pins and the nRF52840DK pins.
66+
67+
.. tabs::
68+
69+
.. group-tab:: UART
70+
71+
+-----------------------+-----------------------+-----------------------+
72+
| Arduino Header Pin | Function (host) | nRF52840 DK Pin |
73+
+=======================+=======================+=======================+
74+
| D0 | UART RX | P0.06 |
75+
+-----------------------+-----------------------+-----------------------+
76+
| D1 | UART TX | P0.08 |
77+
+-----------------------+-----------------------+-----------------------+
78+
| Host specific | UART CTS | P0.05 (flow control) |
79+
+-----------------------+-----------------------+-----------------------+
80+
| Host specific | UART RTS | P0.07 (flow control) |
81+
+-----------------------+-----------------------+-----------------------+
82+
83+
.. group-tab:: SPI
84+
85+
+-----------------------+-----------------------+-----------------------+
86+
| Arduino Header Pin | Function | nRF52840 DK Pin |
87+
+=======================+=======================+=======================+
88+
| D8 | RSTn | P0.18/RESET |
89+
+-----------------------+-----------------------+-----------------------+
90+
| D9 | INTn | P0.30 |
91+
+-----------------------+-----------------------+-----------------------+
92+
| D10 | SPI CSn | P0.29 |
93+
+-----------------------+-----------------------+-----------------------+
94+
| D11 | SPI MOSI | P0.04 |
95+
+-----------------------+-----------------------+-----------------------+
96+
| D12 | SPI MISO | P0.28 |
97+
+-----------------------+-----------------------+-----------------------+
98+
| D13 | SPI SCK | P0.03 |
99+
+-----------------------+-----------------------+-----------------------+
100+
101+
Programming
102+
***********
103+
104+
Include ``--shield openthread_rcp_arduino_serial`` or ``--shield openthread_rcp_arduino_spi``
105+
when you invoke ``west build`` for projects utilizing this shield. For example:
106+
107+
.. tabs::
108+
109+
.. group-tab:: UART
110+
111+
.. zephyr-app-commands::
112+
:zephyr-app: samples/net/sockets/echo_client
113+
:board: stm32h573i_dk/stm32h573xx
114+
:shield: openthread_rcp_arduino_serial
115+
:conf: "prj.conf overlay-ot-rcp-host-uart.conf"
116+
:goals: build
117+
118+
.. group-tab:: SPI
119+
120+
.. zephyr-app-commands::
121+
:zephyr-app: samples/net/sockets/echo_client
122+
:board: stm32h573i_dk/stm32h573xx
123+
:shield: openthread_rcp_aduino_spi
124+
:conf: "prj.conf overlay-ot-rcp-host-uart.conf"
125+
:goals: build
126+
127+
References
128+
**********
129+
130+
.. target-notes::
131+
132+
.. _OpenThread RCP:
133+
https://openthread.io/platforms/co-processor
134+
135+
.. _OpenThread on nRF52840 Example website:
136+
https://github.com/openthread/ot-nrf528xx/blob/main/src/nrf52840/README.md
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2025 Basalte bv
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* Overlay to enable support for OpenThread's RCP over UART communication
9+
*/
10+
11+
/ {
12+
chosen {
13+
zephyr,hdlc-rcp-if = &hdlc_rcp_if;
14+
zephyr,ot-uart = &arduino_serial;
15+
};
16+
17+
hdlc_rcp_if: hdlc_rcp_if {
18+
compatible = "uart,hdlc-rcp-if";
19+
};
20+
};
21+
22+
&arduino_serial {
23+
status = "okay";
24+
current-speed = <115200>;
25+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2025 Basalte bv
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/**
8+
* Overlay to enable support for OpenThread's RCP over SPI communication
9+
*/
10+
11+
/ {
12+
chosen {
13+
zephyr,hdlc-rcp-if = &hdlc_rcp_if;
14+
};
15+
};
16+
17+
&arduino_spi {
18+
status = "okay";
19+
20+
hdlc_rcp_if: hdlc_rcp_if@0 {
21+
compatible = "spi,hdlc-rcp-if";
22+
status = "okay";
23+
reg = <0>;
24+
25+
spi-max-frequency = <1000000>; /* 1 MHz to support most devices */
26+
int-gpios = <&arduino_header 15 GPIO_ACTIVE_LOW>; /* D9 */
27+
reset-gpios = <&arduino_header 14 GPIO_ACTIVE_LOW>; /* D8 */
28+
};
29+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
shields:
2+
- name: openthread_rcp_arduino_serial
3+
full_name: OpenThread RCP over Arduino UART
4+
vendor: others
5+
supported_features:
6+
- hdlc_rcp_if
7+
8+
- name: openthread_rcp_arduino_spi
9+
full_name: OpenThread RCP over Arduino SPI
10+
vendor: others
11+
supported_features:
12+
- hdlc_rcp_if

0 commit comments

Comments
 (0)