Skip to content

Commit eac40be

Browse files
authored
Merge pull request #1442 from arduino/taddy/hatCarrier_user_manual_update
Portenta Hat Carrier: User Manual Content Patch
2 parents f1e0039 + 7ffe32e commit eac40be

File tree

1 file changed

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

1 file changed

+49
-17
lines changed

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

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -417,17 +417,7 @@ The file is uploaded to `/home/fio` directory. Navigate to the directory using A
417417
python3 hello_world_python.py
418418
```
419419

420-
Portenta Hat Carrier's user programmable LED will start blinking whenever the script is running. If you wish to upload to a containerized environment, as a Docker container, the following command can be used to do so:
421-
422-
```bash
423-
docker cp hello_world_python.py mycontainer:/app/
424-
```
425-
426-
Then the script can be used by accessing the container with the following command:
427-
428-
```bash
429-
docker exec -it mycontainer sh
430-
```
420+
Portenta Hat Carrier's user programmable LED will start blinking whenever the script is running.
431421

432422
#### Hello World Using Linux and Docker
433423
<br></br>
@@ -766,24 +756,66 @@ Devices with a USB-A interface, such as storage drives, can be used for logging
766756
#### Using Linux
767757
<br></br>
768758

769-
As an example, following command on Portenta X8's shell can be used to test write command with a USB memory drive.
759+
As an example, following command on Portenta X8's shell can be used to test write command with a USB memory drive. To write a file, following sequence of commands can help you accomplish such task.
760+
761+
```bash
762+
dmesg -w
763+
```
764+
765+
The `dmesg -w` command displays kernel messages, helping you monitor system events in real-time. It is particularly useful to see if it has recognized the USB drive when plugged in.
770766

771767
```bash
772-
dd if=/dev/urandom of=random.bin bs=1M count=128
768+
lsblk
773769
```
774770

775-
This command will create a _random.bin_ file filled with 128 Megabytes of random data. It reads data from the system's pseudo-random number generator `/dev/urandom` and writes it to the file in chunks of 1 Megabyte.
771+
The `lsblk` command lists all available block devices, such as hard drives and USB drives. It helps in identifying the device name, like `/dev/sda1` which is the partition designation, of the plugged-in USB drive.
772+
773+
```bash
774+
mkdir -p /mnt/USBmount
775+
```
776+
777+
The `mkdir -p` command creates the directory `/mnt/USBmount`. If the directory already exists, this command won't produce an error. This directory will be used as a mount point for the USB drive.
778+
779+
```bash
780+
mount -t vfat /dev/sda1 /mnt/USBmount
781+
```
782+
783+
This mount command mounts the USB drive, assumed to have a FAT filesystem (`vfat`), located at `/dev/sda1` to the directory `/mnt/USBmount`. Once mounted, the content of the USB drive can be accessed from the `/mnt/USBmount` directory.
784+
785+
```bash
786+
dd if=/dev/urandom of=/mnt/USBmount/random.bin bs=1K count=16
787+
```
788+
789+
This command will create a _random.bin_ file filled with 16 Kilobytes of random data. It reads data from the system's pseudo-random number generator `/dev/urandom` and writes it to the file in chunks of 1 Kilobyte.
776790

777791
To read the _random.bin_ file with random data, you can use the following command:
778792

779793
```bash
780-
dd if=random.bin bs=1M count=128 | hexdump -C
794+
dd if=/mnt/USBmount/random.bin bs=1K count=16 | hexdump -C
781795
```
782796

783-
This will read the previously generated _random.bin_ file and displays its content in a hexadecimal format on the console. Data is read in chunks of 1 Megabyte up to 128 Megabytes and then processed for display using `hexdump`.
797+
This will read the previously generated _random.bin_ file and displays its content in a hexadecimal format on the console. Data is read in chunks of 1 Kilobyte up to 16 Kilobytes and then processed for display using `hexdump`.
784798

785799
***Reading the entire _random.bin_ file with the `hexdump` command will produce a large output on the console. Use with caution.***
786800

801+
In the Portenta X8's shell, if you aim to create a text file containing the message `Hello, World!` on a USB memory drive, you can employ the command:
802+
803+
```bash
804+
dd if=<(echo -n "Hello, World!") of=/mnt/USBmount/helloworld.txt
805+
```
806+
807+
This command uses the `dd` utility, combined with process substitution. Specifically, it seizes the output of the `echo` command, responsible for generating the `Hello, World!` message, and channels it as an input stream to `dd`.
808+
809+
Subsequently, the message gets inscribed into a file named _helloworld.txt_ situated in the `/mnt/USBmount` directory.
810+
811+
After creating the file, if you wish to retrieve its contents and display them on the shell, you can use:
812+
813+
```bash
814+
dd if=/mnt/USBmount/helloworld.txt bs=1K count=1
815+
```
816+
817+
This command directs `dd` to peruse the contents of _helloworld.txt_. With a specified block size of 1 Kilobyte, the reading is confined to a single block—adequate given the brevity of the `Hello, World!` message. Upon executing this command, the content of the text file will be displayed on your shell.
818+
787819
#### Using Arduino IDE
788820
<br></br>
789821

@@ -2762,7 +2794,7 @@ It can interact with up to four relay ports on the board. Among its various feat
27622794
```python
27632795
from __future__ import print_function
27642796

2765-
import smbus
2797+
import smbus2 import SMBus
27662798

27672799
# The number of relay ports on the relay board.
27682800
# This value should never change!

0 commit comments

Comments
 (0)