Skip to content

Commit 308640c

Browse files
committed
Small improvements, hello world with linux and python improved
1 parent 5ff1649 commit 308640c

File tree

1 file changed

+59
-33
lines changed
  • content/hardware/04.pro/carriers/portenta-hat-carrier/tutorials/user-manual

1 file changed

+59
-33
lines changed

content/hardware/04.pro/carriers/portenta-hat-carrier/tutorials/user-manual/content.md

Lines changed: 59 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,21 @@ The Portenta Hat Carrier can be powered according to one of the following method
189189

190190
For clarity on the connection points, please refer to the [board pinout section](#pinout) of the user manual. Ensure the supplied current meets the specification for all components, as shown in the operating conditions table reported later on.
191191

192-
- Using an external __5 V power supply__ to the _5V_ pin located on the 40-pin male header connectors pins or available on the screw terminal of the board, you can effectively power the Portenta Hat Carrier, the SOM, and any connected hat.
192+
- Using an external __5 V power supply__ to:
193+
* The _5V_ pin located on the 40-pin male header connectors pins
194+
* The _5V_ pin located on the screw terminal of the board
195+
196+
You can effectively power the Portenta Hat Carrier, the SOM, and any connected hat.
193197

194198
For more details on this connection, kindly consult the [board pinout section](#pinout) of the user manual. Again, ensure that the power supply's maximum current respects all components' specifications.
195199

196-
- Using a USB-C® cable (not included) connected to the Portenta core board of your choice powers not only the selected core board, like the Portenta X8, H7, or C33, but also the Portenta Hat Carrier, the SOM, and any connected hat which does not require a dedicated external power supply.
200+
- Using a USB-C® cable (not included) connected to the Portenta core board of your choice powers not only the selected core board, like the Portenta X8, H7, or C33, but also the Portenta Hat Carrier, and any connected hat that does not require a dedicated external power supply.
197201

198202
***The Portenta Hat Carrier can deliver a __maximum__ of 1.5 A.***
199203

200204
![Portenta Hat Carrier Power Connection Overview](assets/portentaHATcarrier_powerSource.png)
201205

202-
The image below magnifies the location of the terminal block for 7 - 32 V and 5 V power source of the Portenta Hat Carrier:
206+
The image below magnifies the location of the terminal block for the 7 - 32 V and 5 V power source of the Portenta Hat Carrier:
203207

204208
![Portenta Hat Carrier Power Source within Terminal Block](assets/portentaHATcarrier_powerSource_block.png)
205209

@@ -211,32 +215,32 @@ Subsequently, you can check how the Portenta Hat Carrier distributes power resou
211215

212216
To ensure the safety and longevity of the board, it is essential to understand the carrier's operating conditions. The table below provides the recommended operating conditions for the carrier:
213217

214-
| **Parameter** | **Symbol** | **Min** | **Typ** | **Max** | **Unit** |
215-
|:------------------------------------------------------:|-------------|---------|---------|---------|----------|
216-
| VIN from onboard screw terminal* of the Carrier | VINTERMINAL | 7.0 | - | 32.0 | V |
217-
| +5 VDC from the carrier's onboard screw terminal | V5TERMINAL | - | 5.0 | - | V |
218-
| USB-C® input from the connected Portenta family board | V5USBC | - | 5.0 | - | V |
219-
| Current supplied by the carrier | ICARRIER | - | - | 1.5 | A |
220-
| +5 VDC from the 40-pin header connector on the carrier | V5HEADER | - | 5.0 | - | V |
221-
| Ambient operating temperature | TOP | -40 | - | 85 | °C |
218+
| **Parameter** | **Min** | **Typ** | **Max** | **Unit** |
219+
| :----------------------------------------------------: | :-----: | :-----: | :-----: | :------: |
220+
| VIN from onboard screw terminal* of the Carrier | 7.0 | - | 32.0 | V |
221+
| USB-C® input from the connected Portenta family board | - | 5.0 | - | V |
222+
| +5 VDC from the 40-pin header connector on the carrier | - | 5.0 | - | V |
223+
| +5 VDC from the carrier's onboard screw terminal | - | 5.0 | - | V |
224+
| Current supplied by the carrier | - | - | 1.5 | A |
225+
| Ambient operating temperature | -40 | - | 85 | °C |
222226

223227
***The onboard screw terminal powers both the carrier and any connected Portenta board. Additionally, this terminal connector includes reverse polarity protection for enhanced safety.***
224228

225229
### Carrier Characteristics Highlight
226230

227231
The Portenta Hat Carrier provides different functionalities based on the connected Portenta family board, as shown in the table below:
228232

229-
| **Features** | **Portenta X8** | **Portenta H7** | **Portenta 33** |
230-
|:---------------|:------------------|:-------------------|:-------------------|
231-
| 40-Pin Header | Compatible | Compatible | Compatible |
232-
| 16-Pin Header | Compatible | Compatible | Compatible |
233-
| MIPI Camera | Compatible | Incompatible | Incompatible |
234-
| Ethernet | 1 Gbit (DIP: OFF) | 100 Mbit (DIP: ON) | 100 Mbit (DIP: ON) |
235-
| PWM Fan | Available | Available | Available |
236-
| JTAG Debug | Available | Available | Available |
237-
| Storage Exp. | MicroSD slot | MicroSD slot | MicroSD slot |
238-
| CAN FD | Available | Available | Available |
239-
| USB-A Support | Available | Available | Available |
233+
| **Features** | **Portenta X8** | **Portenta H7** | **Portenta 33** |
234+
| :-----------: | :---------------: | :----------------: | :----------------: |
235+
| 40-Pin Header | Compatible | Compatible | Compatible |
236+
| 16-Pin Header | Compatible | Compatible | Compatible |
237+
| MIPI Camera | Compatible | Incompatible | Incompatible |
238+
| Ethernet | 1 Gbit (DIP: OFF) | 100 Mbit (DIP: ON) | 100 Mbit (DIP: ON) |
239+
| PWM Fan | Available | Available | Available |
240+
| JTAG Debug | Available | Available | Available |
241+
| Storage Exp. | MicroSD slot | MicroSD slot | MicroSD slot |
242+
| CAN FD | Available | Available | Available |
243+
| USB-A Support | Available | Available | Available |
240244

241245
***The Portenta X8 is the specific Portenta family board that offers compatibility with Raspberry Pi® Hats on the 40-pin Header.***
242246

@@ -260,7 +264,7 @@ To use the Portenta Hat Carrier with the Portenta X8, you will have to align the
260264
#### Hello World With Portenta X8 Shell
261265
<br></br>
262266

263-
A series of _Hello World_ examples will be used to ensure the Portenta Hat Carrier is correctly operating with the paired Portenta X8. These examples, using Linux commands, Python® scripts, Docker, and the Arduino IDE, aim to trigger the user-programmable LED connected to GPIO3 leveraging different methods and platforms.
267+
A series of _Hello World_ examples will be used to ensure the Portenta Hat Carrier is correctly operating with the paired Portenta X8. These examples, using Linux commands, Python® scripts, and the Arduino IDE, aim to trigger the user-programmable LED connected to GPIO3 leveraging different methods and platforms.
264268

265269
We will begin with a _Hello World_ example using Linux commands. The user programmable LED can be controlled using commands within the Portenta X8's shell. Learn how to connect with Portenta X8 shell [here](https://docs.arduino.cc/tutorials/portenta-x8/user-manual#first-use-of-your-portenta-x8).
266270

@@ -273,7 +277,11 @@ adb shell
273277
sudo su -
274278
```
275279

276-
When you execute the _sudo su -_ command, you will be prompted for a password. The default password is `fio`. This command grants you access as the root user, loading the root user's environment settings such as `$HOME` and `$PATH`.
280+
When you execute the _sudo su -_ command, you will be prompted for a password:
281+
282+
***The default password is `fio`***
283+
284+
This command grants you access as the root user, loading the root user's environment settings such as `$HOME` and `$PATH`.
277285

278286
The aforementioned commands allow you to access the Portenta X8's shell with elevated privileges. This allows you to modify system configurations that require administrative permissions.
279287

@@ -301,7 +309,7 @@ The GPIO can now be configured verifying that GPIO3 elements were successfully e
301309
echo <I/O> >/sys/class/gpio/gpio163/direction
302310
```
303311

304-
For this example, we will replace the `I/O` field with `out` value within the following command.
312+
For this example, we will replace the `<I/O>` field with `out` value within the following command:
305313

306314
```
307315
echo out >/sys/class/gpio/gpio163/direction
@@ -315,13 +323,20 @@ cat /sys/class/gpio/gpio163/direction
315323

316324
The GPIO is now set as an output, thus it can now be controlled by setting its state.
317325

318-
To set the pin High, you need to assign the value `1`, or `0` to set the pin Low. The command will require the `value` at the end to ensure the pin's state is controlled.
326+
To set the pin High, you need to assign the value `1`, or `0` to set the pin `HIGH` or `LOW`. The command will require the `value` at the end to ensure the pin's state is controlled.
327+
319328

329+
To set the pin to `HIGH`:
320330
```
321331
echo 1 >/sys/class/gpio/gpio163/value
322332
echo 0 >/sys/class/gpio/gpio163/value
323333
```
324334

335+
To set the pin to `LOW`:
336+
```
337+
echo 0 >/sys/class/gpio/gpio163/value
338+
```
339+
325340
If you have finished controlling the GPIO, you can use the following command to _unexport_ it, ensuring it no longer appears in the userspace:
326341

327342
```
@@ -336,7 +351,7 @@ ls /sys/class/gpio
336351

337352
This step helps you to prevent unintentional modifications to the element configuration.
338353

339-
#### Hello World Using Linux and Python® Script
354+
#### Hello World Using Linux and Python® Scripts
340355
<br></br>
341356

342357
Previously, we manually toggled the LED linked to _GPIO3_ on the Portenta X8 via the command-line. However, to automate this process and potentially extend our control logic, we can employ a Python® script for this purpose.
@@ -390,28 +405,39 @@ def main():
390405
gpio.set_direction("out")
391406
if gpio.read_direction() == "out":
392407
print("GPIO set as output.")
408+
print("User LED Blinking 20 times")
409+
393410

394411
# Turn on (set to 1) and then off (set to 0)
395-
while True:
412+
for i in range(1,20,1):
396413
gpio.set_value(1)
397414
time.sleep(1)
398415
gpio.set_value(0)
399416
time.sleep(1)
400-
401-
# Unexport (if you want to unexport at some point, you can uncomment this)
402-
# gpio.unexport()
417+
418+
419+
print("GPIO Unexport")
420+
gpio.unexport()
421+
print("End of the program")
422+
exit()
403423

404424
if __name__ == "__main__":
405425
main()
406426
```
407427

408-
The script can be named as `hello_world_python.py` for example. It can then be pushed to Portenta X8 using the following command on computer terminal:
428+
The script can be named as `hello_world_python.py` for example. It can then be pushed to Portenta X8 using the following command on a computer terminal:
409429

410430
```bash
411431
adb push hello_world_python.py /home/fio
412432
```
413433

414-
The file is uploaded to `/home/fio` directory. Navigate to the directory using ADB shell and use the following command to run the script:
434+
The file is uploaded to `/home/fio` directory. Navigate to the directory using ADB shell:
435+
436+
```bash
437+
cd python3 hello_world_python.py
438+
```
439+
440+
Now use the following command to run the script:
415441

416442
```bash
417443
python3 hello_world_python.py

0 commit comments

Comments
 (0)