Skip to content

Commit 6bb1a7d

Browse files
committed
docs/solutions/reference-designs/eval-cn0575-rpiz/sample_application: Add blinky sample application
- Add blinky sample application page with instructions for the user to recreate the example at home - Provide images that showcase the way this application functions - Add images with the system setup Signed-off-by: Evelyn Plesca <evelyn-iulia.plesca@analog.com>
1 parent f3cdd13 commit 6bb1a7d

File tree

5 files changed

+258
-0
lines changed

5 files changed

+258
-0
lines changed

docs/solutions/reference-designs/eval-cn0575-rpiz/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,15 @@ Hardware Registration
479479
Receive software update notifications, documentation updates, view the latest
480480
videos, and more when you :adi:`register <EVAL-CN0575-RPIZ?&v=RevC>` your hardware.
481481

482+
Sample Application
483+
------------------
484+
485+
.. toctree::
486+
:maxdepth: 2
487+
:glob:
488+
489+
*/index
490+
482491
Help and Support
483492
-------------------
484493

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
12.3 MB
Loading
Lines changed: 243 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
Blinky Application
2+
=================
3+
4+
This sample application demonstrates a basic Blinky application using two :adi:`EVAL-CN0575-RPIZ` HATs,
5+
an :adi:`AD-RPI-T1LPSE-SL` HAT as a communication interface, and three Raspberry Pi computers.
6+
These are set up in a parent-child configuration, where the :adi:`AD-RPI-T1LPSE-SL` HAT acts as the parent device,
7+
and the two :adi:`EVAL-CN0575-RPIZ` HATs act as child devices.
8+
The application toggles the on-board LED of a :adi:`EVAL-CN0575-RPIZ` HAT when the button is pressed on the
9+
other :adi:`EVAL-CN0575-RPIZ` HAT and vice versa.
10+
11+
Prerequisites
12+
-------------
13+
14+
- Python 3.8 or newer (3.8–3.11 tested with pyadi-iio).
15+
Ensure that a compatible version is installed on your system before continuing.
16+
Older versions (<3.8) may not work reliably with pyadi-iio.
17+
18+
- Git command-line tools installed.
19+
20+
- Three Raspberry Pi computers with :adi:`Kuiper 2` image installed.
21+
Follow the instructions in the `Kuiper 2 User Guide <https://github.com/analogdevicesinc/adi-kuiper-gen/releases>`_
22+
to prepare the Raspberry Pi.
23+
24+
Hardware Setup
25+
--------------
26+
27+
.. figure:: eval-cn0575-rpiz-sample-application-blinky-system.png
28+
:align: center
29+
:width: 500
30+
31+
Hardware Setup for Blinky Application
32+
33+
**Equipment Needed**
34+
35+
- 1x :adi:`AD-RPI-T1LPSE-SL` Board
36+
37+
- 2x :adi:`EVAL-CN0575-RPIZ` Boards
38+
39+
- 3x Raspberry Pi 5 computers running Kuiper 2
40+
41+
- 1x USB Type-C Power Supply (15V, 3A)
42+
43+
- 2x T1L Cables
44+
45+
**Setup Procedure**
46+
47+
1. Connect the :adi:`AD-RPI-T1LPSE-SL` board and both :adi:`EVAL-CN0575-RPIZ` boards to Raspberry Pis via the 40-pin header.
48+
49+
2. Connect the power supply to the :adi:`AD-RPI-T1LPSE-SL` HAT using the USB Type-C port.
50+
51+
3. Connect the two Raspberry Pi that are interfaced with the :adi:`EVAL-CN0575-RPIZ` HATs to the :adi:`AD-RPI-T1LPSE-SL` HAT
52+
using T1L cables.
53+
54+
5. Power on the Raspberry Pi computers.
55+
56+
Software Setup
57+
--------------
58+
59+
When running commands with *sudo*, you might be prompted to enter the password for the **analog** user.
60+
If you have not changed it, the default password is **analog**.
61+
62+
Repository Cloning
63+
~~~~~~~~~~~~~~~~~~
64+
65+
1. Clone the repository on both Raspberry Pi computers:
66+
67+
.. shell::
68+
:user: analog
69+
:group: analog
70+
:show-user:
71+
72+
$ git clone https://github.com/analogdevicesinc/pyadi-iio.git
73+
$ cd pyadi-iio
74+
75+
2. Install Python dependencies and open a virtual environment:
76+
77+
.. shell::
78+
:user: analog
79+
:group: analog
80+
:show-user:
81+
82+
$ python3 -m venv ./venv
83+
$ source venv/bin/activate
84+
$ pip install -e .
85+
86+
Applying Overlays
87+
~~~~~~~~~~~~~~~~~
88+
89+
Overlays are required to enable the proper device tree configurations for the HATs.
90+
91+
In order to apply the overlays, open a terminal on each Raspberry Pi and follow these steps:
92+
93+
1. For the parent Raspberry Pi:
94+
95+
.. shell::
96+
:user: analog
97+
:group: analog
98+
:show-user:
99+
100+
$ sudo tee -a /boot/firmware/config.txt <<'EOF'
101+
dtoverlay=rpi-t1lpse-apl
102+
dtoverlay=rpi-t1lpse-class12
103+
EOF
104+
105+
2. For each child Raspberry Pi:
106+
107+
.. shell::
108+
:user: analog
109+
:group: analog
110+
:show-user:
111+
112+
$ sudo tee -a /boot/firmware/config.txt <<'EOF'
113+
dtoverlay=rpi-cn0575
114+
EOF
115+
116+
Reboot the Raspberry Pi computers to apply the changes:
117+
118+
.. shell::
119+
:user: analog
120+
:group: analog:
121+
:show-user:
122+
123+
$ sudo reboot
124+
125+
Hostname Setup
126+
~~~~~~~~~~~~~~
127+
128+
Each Raspberry Pi must have a unique hostname to avoid network conflicts.
129+
130+
1. On each Raspberry Pi, open a terminal and enter the following command to edit the hostname file.
131+
132+
Keep in mind that *<new_hostname>* should be replaced with a unique name for each Raspberry Pi. We used
133+
**analog** for the parent Raspberry Pi, **cn0575a** for the first child Raspberry Pi, and **cn0575b** for the second child Raspberry Pi.
134+
135+
.. shell::
136+
:user: analog
137+
:group: analog
138+
:show-user:
139+
140+
$ hostnamectl set-hostname <new_hostname>
141+
142+
Network Setup
143+
~~~~~~~~~~~~~
144+
145+
Each Raspberry Pi must be configured with a static IP address to ensure reliable communication.
146+
147+
For our demo, we will use the following IP addresses:
148+
149+
- The Raspberry Pi with :adi:`AD-RPI-T1LPSE-SL` HAT (parent): **192.168.10.1/25** on **eth1** and **192.168.10.129/25** on **eth2**
150+
151+
- First Raspberry Pi with :adi:`EVAL-CN0575-RPIZ` HAT (first child): **192.168.10.2/25** on **eth1**
152+
153+
- Second Raspberry Pi with :adi:`EVAL-CN0575-RPIZ` HAT (second child): **192.168.10.130/25** on **eth1**
154+
155+
Open the terminal and write the following commands:
156+
157+
1. On the parent Raspberry Pi, with the :adi:`AD-RPI-T1LPSE-SL` HAT:
158+
159+
.. shell::
160+
:user: analog
161+
:group: analog
162+
:show-user:
163+
164+
$ sudo nmcli con add type ethernet ifname eth1 con-name t1l-cn0575a \
165+
ipv4.method manual ipv4.addresses 192.168.10.1/25 \
166+
connection.autoconnect yes
167+
$ sudo nmcli con add type ethernet ifname eth2 con-name t1l-cn0575b \
168+
ipv4.method manual ipv4.addresses 192.168.10.129/25 \
169+
connection.autoconnect yes
170+
$ sudo nmcli con up t1l-cn0575a
171+
$ sudo nmcli con up t1l-cn0575b
172+
173+
2. On the first child Raspberry Pi, with the first :adi:`EVAL-CN0575-RPIZ` HAT:
174+
175+
.. shell::
176+
:user: analog
177+
:group: analog
178+
:show-user:
179+
180+
$ sudo nmcli con add type ethernet ifname eth1 con-name t1l-master \
181+
ipv4.method manual ipv4.addresses 192.168.10.2/25 \
182+
connection.autoconnect yes
183+
$ sudo nmcli con up t1l-master
184+
185+
3. On the second child Raspberry Pi, with the second :adi:`EVAL-CN0575-RPIZ` HAT:
186+
187+
.. shell::
188+
:user: analog
189+
:group: analog
190+
:show-user:
191+
192+
$ sudo nmcli con add type ethernet ifname eth1 con-name t1l-master \
193+
ipv4.method manual ipv4.addresses 192.168.10.130/25 \
194+
connection.autoconnect yes
195+
$ sudo nmcli con up t1l-master
196+
197+
4. Reboot all the Raspberry Pi computers to apply the changes:
198+
199+
.. shell::
200+
:user: analog
201+
:group: analog:
202+
:show-user:
203+
204+
$ sudo reboot
205+
206+
5. Verify that the new connections are active on each Raspberry Pi:
207+
208+
.. shell::
209+
:user: analog
210+
:group: analog
211+
:show-user:
212+
213+
$ nmcli connection show
214+
215+
.. figure:: eval-cn0575-rpiz-sample-application-nm-nmcli-conn-show.png
216+
:align: center
217+
:width: 500
218+
219+
Example of active NetworkManager connections
220+
221+
Application Execution
222+
~~~~~~~~~~~~~~~~~~~~~
223+
224+
When executed, the demo continously reads the state of the button the :adi:`CN0575` HAT and
225+
toggles the LED on the other :adi:`CN0575` HAT if pressed and vice versa. The code is run on the
226+
parent only, which communicates with both child devices using *libiio*.
227+
228+
Run the application the parent Raspberry Pi only, which will handle communication with both child devices.
229+
230+
.. shell::
231+
:user: analog
232+
:group: analog
233+
:show-user:
234+
235+
$ cd examples/cn0575
236+
$ source venv/bin/activate
237+
$ python3 cn0591_2x_cn0575_button_blinky.py
238+
239+
.. figure:: eval-cn0575-rpiz-sample-application-terminal-result.gif
240+
:align: center
241+
:width: 500
242+
243+
Running Blinky Application with Button Presses

0 commit comments

Comments
 (0)