Skip to content

Commit da3f772

Browse files
committed
docs/solutions/reference-designs/ad-rpit1lpse-sl/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 da3f772

File tree

5 files changed

+259
-0
lines changed

5 files changed

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

docs/solutions/reference-designs/ad-rpi-t1lpse-sl/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,15 @@ Hardware Registration
489489
videos, and more when you :adi:`register <AD-RPI-T1LPSE-SL?&v=RevC>` your
490490
hardware.
491491

492+
Sample Application
493+
------------------
494+
495+
.. toctree::
496+
:maxdepth: 2
497+
:glob:
498+
499+
*/index
500+
492501
Help and Support
493502
-------------------
494503

0 commit comments

Comments
 (0)