Skip to content

Commit a1bb4d1

Browse files
committed
Examples improvements, small text additions to improve user experience
1 parent 308640c commit a1bb4d1

File tree

1 file changed

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

1 file changed

+32
-28
lines changed

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

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ The Portenta Hat Carrier features a USB interface suitable for data logging and
557557

558558
![Portenta Hat Carrier USB-A Port](assets/portentaHATcarrier_USBA.png)
559559

560-
If you are interested in USB-A port pinout, the following table may serve to understand its connection distribution:
560+
If you are interested in the USB-A port pinout, the following table may serve to understand its connection distribution:
561561

562562
| **Pin number** | **Power Net** | **Portenta HD Standard Pin** | **High-Density Pin** | **Interface** |
563563
|:--------------:|:-------------:|:----------------------------:|:--------------------------------------------------------------------:|:-------------:|
@@ -571,49 +571,42 @@ Devices with a USB-A interface, such as storage drives, can be used for logging
571571
#### Using Linux
572572
<br></br>
573573

574-
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.
574+
As an example, the following command on Portenta X8's shell can be used to test a write command with a USB memory drive. To write a file, the following sequence of commands can help you to accomplish such task.
575575

576576
```bash
577-
dmesg -w
577+
sudo su -
578578
```
579-
580-
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.
579+
First of all let's enter in root mode to have the right permissions to mount and unmount related peripherals like our USB memory drive.
581580

582581
```bash
583582
lsblk
584583
```
585584

586-
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.
585+
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 will be probably the partition designation of the USB drive you just plugged in. A common trick to identify and check the USB drive connected is to execute the `lsblk` command twice; once with the USB disconnected and the next one to the USB connected, to compare both results and spot easily the new connected USB drive. Additionally, the command `lsusb` can be used to gather more information about the connected USB drive.
587586

588587
```bash
589588
mkdir -p /mnt/USBmount
590589
```
591590

592-
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.
591+
The `mkdir -p` command creates the directory `/mnt/USBmount`. This directory will be used as a mount point for the USB drive.
593592

594593
```bash
595594
mount -t vfat /dev/sda1 /mnt/USBmount
596595
```
597596

598-
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.
597+
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 with `cd`:
599598

600599
```bash
601-
dd if=/dev/urandom of=/mnt/USBmount/random.bin bs=1K count=16
600+
cd /mnt/USBmount
602601
```
603602

604-
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.
605-
606-
To read the _random.bin_ file with random data, you can use the following command:
603+
Now if you do and `ls` you can see the actual content of the connected USB Drive.
607604

608605
```bash
609-
dd if=/mnt/USBmount/random.bin bs=1K count=16 | hexdump -C
606+
ls
610607
```
611608

612-
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`.
613-
614-
***Reading the entire _random.bin_ file with the `hexdump` command will produce a large output on the console. Use with caution.***
615-
616-
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:
609+
Let's create a simple text file containing the message `Hello, World!` in the already connected USB memory drive using the following command:
617610

618611
```bash
619612
dd if=<(echo -n "Hello, World!") of=/mnt/USBmount/helloworld.txt
@@ -626,10 +619,12 @@ Subsequently, the message gets inscribed into a file named _helloworld.txt_ situ
626619
After creating the file, if you wish to retrieve its contents and display them on the shell, you can use:
627620

628621
```bash
629-
dd if=/mnt/USBmount/helloworld.txt bs=1K count=1
622+
cat helloworld.txt
630623
```
631624

632-
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.
625+
This command `cat` prompts in the terminal the content of a file, in this case the words `Hello, World!`.
626+
627+
Now that you know how to locate, mount, write and read information from an external USB stick or hard drive you can expand the possibilities of your solution with the additional storage connected to the Portenta Hat Carrier.
633628

634629
#### Using Arduino IDE
635630
<br></br>
@@ -939,9 +934,9 @@ void loop() {
939934

940935
### Analog Pins
941936

942-
The 16-pin header connector of the Portenta Hat Carrier integrates the analog channels. The analog pins `A0`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, and `A7` are accessible through these connectors.
937+
The 16-pin header connector of the Portenta Hat Carrier integrates the analog channels. The analog `A0`, `A1`, `A2`, `A3`, `A4`, `A5`, `A6`, and `A7` are accessible through these pins.
943938

944-
![Portenta Hat Carrier CAN Interface](assets/portentaHATcarrier_analogIOs.png)
939+
![Portenta Hat Carrier Analog Pins](assets/portentaHATcarrier_analogIOs.png)
945940

946941
| **Pin number** | **Silkscreen** | **Portenta HD Standard Pin** | **High-Density Pin** |
947942
|:--------------:|:--------------:|:----------------------------:|:--------------------:|
@@ -966,6 +961,11 @@ Using the Portenta X8, you can obtain a voltage reading that falls within a _0 -
966961
```
967962
cat /sys/bus/iio/devices/iio\:device0/in_voltage<adc_pin>_raw
968963
```
964+
Where `<adc_pin>` is the number of the analog pin to read. For example, in the case of `A0`:
965+
966+
```
967+
cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw
968+
```
969969

970970
If you are working in Python®, the command can be implemented as shown in the script below:
971971

@@ -984,6 +984,10 @@ if __name__ == "__main__":
984984

985985
if value is not None:
986986
print(f"Value from ADC pin {adc_pin}: {value}")
987+
988+
# Mapping between 0-3.3 V
989+
new_value = (float) (value/65535)*3.3
990+
print(f"Value mapped between 0-3.3 V: {new_value}")
987991
```
988992

989993
#### Using Arduino IDE
@@ -3160,11 +3164,11 @@ The CAN bus, short for Controller Area Network bus, is a resilient communication
31603164

31613165
This approach ensures system continuity even if one device fails and is especially effective in electrically noisy settings like in vehicles, where various devices need reliable communication.
31623166

3163-
The Portenta Hat Carrier is equipped with CAN bus communication capabilities, powered by the TJA1049 module - a high-speed CAN FD transceiver. With this, developers can leverage the robustness and efficiency of CAN communication in their projects.
3167+
The Portenta Hat Carrier is equipped with CAN bus communication capabilities, powered by the TJA1049 module, a high-speed CAN FD transceiver. With this, developers can leverage the robustness and efficiency of CAN communication in their projects.
31643168

31653169
![Portenta Hat Carrier CAN Bus Port](assets/portentaHATcarrier_CAN.png)
31663170

3167-
Since the CAN bus pins are integrated within the High-Density connectors, they are conveniently accessible on the carrier through the screw terminal. This provides flexibility in connection, allowing developers to design and troubleshoot their systems easierly.
3171+
Since the CAN bus pins are integrated within the High-Density connectors, they are conveniently accessible on the carrier through the screw terminal. This provides flexibility in connection, allowing developers to design and troubleshoot their systems easily.
31683172

31693173
| **Pin number** | **Silkscreen** | **High-Density Pin** | **Interface** |
31703174
|:--------------:|:--------------:|:--------------------------------------------------------------------:|:------------------:|
@@ -3178,15 +3182,15 @@ Since the CAN bus pins are integrated within the High-Density connectors, they a
31783182
#### Using Linux
31793183
<br></br>
31803184

3181-
For Portenta X8, the following instructions can help control CAN bus protocol. The CAN transceiver is enabled using following command:
3185+
For Portenta X8, the following instructions can help control CAN bus protocol. The CAN transceiver is enabled using the following command:
31823186

31833187
```
31843188
echo 164 > /sys/class/gpio/export && echo out > /sys/class/gpio/gpio164/direction && echo 0 > /sys/class/gpio/gpio164/value
31853189
```
31863190

3187-
This command sequence activates the CAN transceiver. It does so by exporting _GPIO 164_, setting its direction to "`out`", and then writing a value of "`0`" to it. Writing 0 as a value to GPIO 164 means, it will set GPIO to LOW state.
3191+
This command sequence activates the CAN transceiver. It does so by exporting _GPIO 164_, setting its direction to "`out`", and then writing a value of "`0`" to it. Writing 0 as a value to GPIO 164 means that it will set the GPIO to a LOW state.
31883192

3189-
For Portenta X8, it is possible to use following commands:
3193+
For Portenta X8, it is possible to use the following commands:
31903194

31913195
```
31923196
sudo modprobe can-dev
@@ -3199,7 +3203,7 @@ echo "can-dev" | sudo tee > /etc/modules-load.d/can-dev.conf
31993203
sudo systemctl reboot
32003204
```
32013205

3202-
Within the Portenta X8's shell, Docker containers offer a streamlined environment for specific tasks, such as command-based CAN bus operations. The _cansend_ command is one such utility that facilitates sending CAN frames. The command to issue such task is as followss:
3206+
Within the Portenta X8's shell, Docker containers offer a streamlined environment for specific tasks, such as command-based CAN bus operations. The _cansend_ command is one such utility that facilitates sending CAN frames. The command to issue such task is as follows:
32033207

32043208
```bash
32053209
cansend

0 commit comments

Comments
 (0)