Skip to content

Commit 5d4459f

Browse files
pyhysjhedberg
authored andcommitted
docs: Describe the different shield interfaces
Add descriptions of the most popular shield interfaces. I moved the section on shield activation to the top of the page. Signed-off-by: Jonas Berg <[email protected]>
1 parent fa0d623 commit 5d4459f

File tree

1 file changed

+293
-18
lines changed

1 file changed

+293
-18
lines changed

doc/hardware/porting/shields.rst

Lines changed: 293 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,293 @@ to extend its features and services for easier and modularized prototyping.
88
In Zephyr, the shield feature provides Zephyr-formatted shield
99
descriptions for easier compatibility with applications.
1010

11+
Shield activation
12+
*****************
13+
14+
Activate support for one or more shields by adding the matching ``--shield`` arguments
15+
to the west command:
16+
17+
.. zephyr-app-commands::
18+
:app: your_app
19+
:board: your_board
20+
:shield: x_nucleo_idb05a1,x_nucleo_iks01a1
21+
:goals: build
22+
23+
24+
Alternatively, it could be set by default in a project's CMakeLists.txt:
25+
26+
.. code-block:: cmake
27+
28+
set(SHIELD x_nucleo_iks01a1)
29+
30+
31+
Shield interfaces
32+
*****************
33+
34+
A shield is defined by two key characteristics:
35+
36+
#. **Physical connectors** - the mechanical interface
37+
#. **Electrical signals** - what each pin actually does
38+
39+
The connection between a shield and a board happens through Devicetree files:
40+
41+
- Board side: The board's devicetree file uses a :ref:`GPIO nexus node <gpio-nexus-node>` to map
42+
connector pins to the microcontroller's actual GPIO pins. It also defines labels for buses exposed
43+
through the connector (like ``arduino_i2c``, ``arduino_spi``, ``arduino_uart``).
44+
45+
- Shield side: The shield's .overlay file references these same labels to describe how its
46+
components connect to the board.
47+
48+
At build time, the board's devicetree and the shield's overlay are combined to create a complete
49+
picture of the hardware setup.
50+
51+
For example, let's say you have a board with an Arduino connector but no built-in accelerometer.
52+
You can add one using an Arduino shield:
53+
54+
#. The board's Devicetree defines an ``arduino_i2c`` label: it is the I2C bus made available on the
55+
Arduino connector
56+
57+
#. The accelerometer shield's overlay file also references ``arduino_i2c`` to indicate it uses that
58+
same I2C bus. If it needs to use GPIO pins from the connector, it references the GPIO nexus node
59+
defined by the board's Devicetree (e.g. ``arduino_header``).
60+
61+
When you then build for this board with this shield, Zephyr automatically "wires them" together.
62+
63+
.. note::
64+
65+
Some boards and shields may only support a limited set of features of a shield hardware
66+
interface. Refer to their documentation for more details.
67+
68+
69+
Arduino MKR
70+
-----------
71+
72+
This is the form factor of the Arduino MKR boards.
73+
74+
.. figure:: ../../../boards/arduino/mkrzero/doc/img/arduino_mkrzero.jpg
75+
:align: center
76+
:width: 200px
77+
:alt: Arduino MKR Zero
78+
79+
Arduino MKR Zero, an example of a board with the Arduino MKR shield interface
80+
81+
Relevant devicetree node labels:
82+
83+
- ``arduino_mkr_header`` See :dtcompatible:`arduino-mkr-header` for details on GPIO pin definitions
84+
and includes for use in devicetree files.
85+
- ``arduino_mkr_i2c``
86+
- ``arduino_mkr_spi``
87+
- ``arduino_mkr_serial``
88+
89+
90+
Arduino Nano
91+
------------
92+
93+
This is the form factor of the Arduino Nano boards.
94+
95+
.. figure:: ../../../boards/arduino/nano_33_iot/doc/img/nano_33_iot.jpg
96+
:align: center
97+
:width: 300px
98+
:alt: Arduino Nano 33 IOT
99+
100+
Arduino Nano 33 IOT, an example of a board with the Arduino Nano shield interface
101+
102+
Relevant devicetree node labels:
103+
104+
- ``arduino_nano_header`` See :dtcompatible:`arduino-nano-header` for details on GPIO pin definitions
105+
and includes for use in devicetree files.
106+
- ``arduino_nano_i2c``
107+
- ``arduino_nano_spi``
108+
- ``arduino_nano_serial``
109+
110+
111+
Arduino Uno R3
112+
--------------
113+
114+
This is the form factor of the Arduino Uno R3 board.
115+
116+
.. figure:: ../../../boards/shields/mcp2515/doc/keyestudio_can_bus_ks0411.jpg
117+
:align: center
118+
:width: 300px
119+
:alt: Keyestudio CAN-BUS Shield (KS0411)
120+
121+
Keyestudio CAN-BUS, an example of an Arduino shield (Credit: Keyestudio)
122+
123+
Relevant devicetree node labels:
124+
125+
- ``arduino_header`` See :dtcompatible:`arduino-header-r3` for details on GPIO pin definitions
126+
and includes for use in devicetree files.
127+
- ``arduino_adc`` See :dtcompatible:`arduino,uno-adc`
128+
- ``arduino_pwm`` See :dtcompatible:`arduino-header-pwm`
129+
- ``arduino_serial``
130+
- ``arduino_i2c``
131+
- ``arduino_spi``
132+
133+
For technical details, see `Arduino Uno R3 pinout`_.
134+
135+
136+
Camera and display connectors
137+
-----------------------------
138+
139+
These describe connections to cameras and displays (strictly speaking not shields).
140+
141+
- :dtcompatible:`arducam,dvp-20pin-connector`
142+
- :dtcompatible:`nxp,cam-44pins-connector`
143+
- :dtcompatible:`nxp,parallel-lcd-connector`
144+
- :dtcompatible:`raspberrypi,csi-connector`
145+
- :dtcompatible:`weact,dcmi-camera-connector`
146+
147+
148+
Feather
149+
-------
150+
151+
This is the form factor of the Adafruit Feather series of boards.
152+
Shields intended for Feather boards are called Featherwings.
153+
154+
.. figure:: ../../../boards/shields/adafruit_adalogger_featherwing/doc/adafruit_adalogger_featherwing.webp
155+
:align: center
156+
:width: 300px
157+
:alt: Adafruit Adalogger Featherwing Shield
158+
159+
Adafruit Adalogger, an example of a Featherwing (Credit: Adafruit)
160+
161+
Relevant devicetree node labels:
162+
163+
- ``feather_header`` See :dtcompatible:`adafruit-feather-header` for GPIO pin definitions.
164+
- ``feather_adc``
165+
- ``feather_i2c``
166+
- ``feather_serial``
167+
- ``feather_spi``
168+
169+
170+
Microbit
171+
--------
172+
173+
This is for the edge connector of the Microbit boards.
174+
175+
.. figure:: ../../../boards/bbc/microbit_v2/doc/img/bbc_microbit2.jpg
176+
:align: center
177+
:width: 500px
178+
:alt: Microbit V2 board
179+
180+
Microbit V2 board uses the Microbit shield interface
181+
182+
See :dtcompatible:`microbit,edge-connector` for GPIO pin definitions and
183+
links to technical requirements.
184+
185+
186+
mikroBUS |trade|
187+
----------------
188+
189+
This is an interface standard for add-on boards, developed by Mikroe.
190+
191+
.. figure:: ../../../boards/shields/mikroe_3d_hall_3_click/doc/images/mikroe_3d_hall_3_click.webp
192+
:align: center
193+
:alt: 3D Hall 3 Click
194+
:height: 300px
195+
196+
3D Hall 3 Click, an example of a mikroBUS |trade| shield
197+
198+
Relevant devicetree node labels:
199+
200+
- ``mikrobus_header`` See :dtcompatible:`mikro-bus` for GPIO pin definitions and links to
201+
technical specifications.
202+
- ``mikrobus_adc``
203+
- ``mikrobus_i2c``
204+
- ``mikrobus_spi``
205+
- ``mikrobus_serial``
206+
207+
Note that boards with several mikroBUS |trade| connectors might define for
208+
example ``mikrobus_2_spi``.
209+
210+
211+
Pico
212+
----
213+
214+
This is the form factor of the Raspberry Pi Pico boards.
215+
216+
.. figure:: ../../../boards/shields/waveshare_ups/doc/waveshare_pico_ups_b.jpg
217+
:align: center
218+
:width: 300px
219+
:alt: Waveshare Pico UPS-B shield
220+
221+
Waveshare Pico UPS-B, an example of a Pico shield
222+
223+
Relevant devicetree node labels:
224+
225+
- ``pico_header`` See :dtcompatible:`raspberrypi,pico-header` for GPIO pin definitions.
226+
- ``pico_i2c0``
227+
- ``pico_i2c1``
228+
- ``pico_serial``
229+
- ``pico_spi``
230+
231+
232+
ST Morpho
233+
---------
234+
235+
Development boards from ST Microelectronics often uses the ST Morpho shield interface.
236+
237+
.. figure:: ../../../boards/shields/x_nucleo_gfx01m2/doc/x_nucleo_gfx01m2.webp
238+
:align: center
239+
:width: 300px
240+
:alt: X-NUCLEO-GFX01M2
241+
242+
X-NUCLEO-GFX01M2, an example of an ST Morpho shield
243+
244+
Relevant devicetree node labels:
245+
246+
- ``st_morpho_header`` See :dtcompatible:`st-morpho-header` for details on GPIO pin definitions
247+
and includes for use in devicetree files.
248+
- ``st_morpho_lcd_spi``
249+
- ``st_morpho_flash_spi``
250+
251+
252+
Xiao
253+
----
254+
255+
This is the form factor of the Seeeduino XIAO boards.
256+
257+
.. figure:: ../../../boards/shields/seeed_xiao_expansion_board/doc/img/seeed_xiao_expansion_board.webp
258+
:align: center
259+
:width: 300px
260+
:alt: Seeed Studio XIAO Expansion Board
261+
262+
Seeed Studio XIAO Expansion Board, an example of a Xiao shield (Credit: Seeed Studio)
263+
264+
Relevant devicetree node labels:
265+
266+
- ``xiao_d`` See :dtcompatible:`seeed,xiao-gpio` for GPIO pin definitions.
267+
- ``xiao_spi``
268+
- ``xiao_i2c``
269+
- ``xiao_serial``
270+
- ``xiao_adc``
271+
- ``xiao_dac``
272+
273+
274+
zephyr_i2c / Stemma QT / Quiic
275+
------------------------------
276+
277+
These are four-pin I2C connectors. SparkFun calls these connectors "Qwiic", and Adafruit
278+
calls them "Stemma QT". The I2C connectors have four pins; GND, +3.3 Volt, I2C data and I2C
279+
clock. The most common physical connector is the 1.0 mm pitch JST-SH.
280+
281+
Due to the different brand names, the interface is labeled "zephyr_i2c".
282+
283+
.. figure:: ../../../boards/shields/adafruit_vcnl4040/doc/adafruit_vcnl4040.webp
284+
:align: center
285+
:width: 200px
286+
:alt: Adafruit VCNL4040 Shield
287+
288+
Adafruit VCNL4040, an example of a zephyr_i2c shield (Credit: Adafruit)
289+
290+
See :dtcompatible:`stemma-qt-connector` and :dtcompatible:`grove-header` for descriptions
291+
and links to further details.
292+
293+
Relevant devicetree node labels:
294+
295+
- ``zephyr_i2c``
296+
297+
11298
.. _shield_porting_guide:
12299

13300
Shield porting and configuration
@@ -134,24 +421,6 @@ board or board revision overriding files to a shield, as follows:
134421
└── <board>.conf
135422
136423
137-
Shield activation
138-
*****************
139-
140-
Activate support for one or more shields by adding the matching ``--shield`` arguments
141-
to the west command:
142-
143-
.. zephyr-app-commands::
144-
:app: your_app
145-
:shield: x_nucleo_idb05a1,x_nucleo_iks01a1
146-
:goals: build
147-
148-
149-
Alternatively, it could be set by default in a project's CMakeLists.txt:
150-
151-
.. code-block:: cmake
152-
153-
set(SHIELD x_nucleo_iks01a1)
154-
155424
Shield variants
156425
***************
157426

@@ -188,6 +457,8 @@ revision:
188457
├── <board>.overlay
189458
└── <board>.defconfig
190459
460+
.. _gpio-nexus-node:
461+
191462
GPIO nexus nodes
192463
****************
193464

@@ -254,3 +525,7 @@ bits of the flags are copied over, so the SOC GPIO reference becomes
254525
``<&gpiob 4 1>`` as intended.
255526

256527
See `nexus node`_ for more information about this capability.
528+
529+
530+
.. _Arduino Uno R3 pinout:
531+
https://docs.arduino.cc/resources/pinouts/A000066-full-pinout.pdf

0 commit comments

Comments
 (0)