Skip to content

Commit 0812af5

Browse files
committed
User manual dtb overlay content & minor update
1 parent de71806 commit 0812af5

File tree

1 file changed

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

1 file changed

+100
-4
lines changed

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

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ adb shell
278278
sudo su -
279279
```
280280

281-
When you execute the _sudo su -_ command, you will be prompted for a password:
281+
When you execute the _sudo su -_ command, you will be prompted for a password:
282282

283283
***The default password is `fio`***
284284

@@ -2241,7 +2241,6 @@ For a comprehensive understanding of these connectivity options, kindly refer to
22412241
- Portenta H7 connectivity: [Wi-Fi® access point](https://docs.arduino.cc/tutorials/portenta-h7/wifi-access-point) and [BLE connectivity](https://docs.arduino.cc/tutorials/portenta-h7/ble-connectivity)
22422242
- Portenta C33 User Manual: [Wi-Fi®](https://docs.arduino.cc/tutorials/portenta-c33/user-manual#wi-fi) and [Bluetooth®](https://docs.arduino.cc/tutorials/portenta-c33/user-manual#bluetooth)
22432243

2244-
22452244
## Pins
22462245

22472246
The Portenta Hat Carrier is a versatile platform, and a significant feature of this carrier is its extensive pin availability. These pins provide a range of functionalities, including power, I/Os, communication, and more.
@@ -2327,11 +2326,30 @@ Next conditions will help you properly set the hardware to test GPIO controls:
23272326

23282327
1. Begin by positioning the Portenta-X8 securely onto the Portenta Hat Carrier. Make sure the High-Density connectors are securely connected.
23292328

2330-
2. Each GPIO on the Portenta Hat Carrier is versatile and robust, designed to safely accept input voltages ranging between 0.0 V and 3.3 V. This wide range ensures compatibility with a variety of sensors and external devices.
2329+
2. Each GPIO on the Portenta Hat Carrier is versatile and robust, designed to safely accept input voltages ranging between 0.0 V and 3.3 V. This input range ensures compatibility with an array of sensors and external devices.
23312330

23322331
3. To prevent floating states and offer a consistent and predictable behavior, internal pull-ups are automatically enabled on all input pins. This default configuration means that, unless actively driven low, the pins will naturally read as high (or 3.3 V).
23332332

2334-
When all conditions are set and in place, use the following script to read all available GPIOs on 40-Pin header:
2333+
When all conditions are set and in place, access the ADB shell on the Portenta X8 as follows:
2334+
2335+
```bash
2336+
adb shell
2337+
sudo su -
2338+
```
2339+
2340+
Enter the password `fio` when prompted. Next, access the `x8-devel` Docker container with the command:
2341+
2342+
```bash
2343+
docker exec -it x8-devel sh
2344+
```
2345+
2346+
Navigate to the directory containing the GPIO example, named `gpios.py`:
2347+
2348+
```bash
2349+
cd root/examples/portenta-hat-carrier
2350+
```
2351+
2352+
Run the `gpios.py` script to read the status of all available GPIOs on the 40-pin header:
23352353

23362354
```python
23372355
#!/usr/bin/env python3
@@ -2553,6 +2571,84 @@ The pins used for the JTAG debug port on the Portenta Hat Carrier are the follow
25532571
| 9 | | JTAG_TRST | J1-80 | JTAG TRST |
25542572
| 10 | | JTAG_RST | J1-73 | JTAG RST |
25552573

2574+
## Understanding Device Tree Blobs (DTB) Overlays
2575+
2576+
In the world of embedded systems, _U-boot_ and the _Linux kernel_ use a concept called __Device Tree Blobs (DTB)__ to describe a board's hardware configuration. This allows for a unified main source tree to be used across different board configurations, ensuring consistency.
2577+
2578+
The boards, acting as carriers, allow various peripherals to be connected, such as temperature sensors or accelerometers. These carriers serve as expansion connectors. Users might want to connect various peripherals and be able to add or remove them easily.
2579+
2580+
The concept of modularity is applied to the _DTB_, resulting in __DTB overlays__. The hardware configuration is split into multiple small files, each representing a different peripheral or function.
2581+
2582+
During the early boot stage, these overlays are merged together into a single DTB and loaded into RAM. This approach enables to select and change configurations with ease. However, it is important to note that changing the hardware configuration requires a system reboot to maintain system stability.
2583+
2584+
The Device Tree Blob (DTB) overlays can be modified and maintained through a couple of methods. In builds that do not prioritize security, the file located at the following location can be edited.
2585+
2586+
```
2587+
/boot/devicetree/overlays.txt
2588+
```
2589+
2590+
After making the desired changes, it is necessary to save and reboot the system to apply desired changes.
2591+
2592+
On the other hand, the builds that prioritizes security, the *fw_setenv tool* accessible in user space must be used to apply according changes to the U-boot settings as follows:
2593+
2594+
```
2595+
fw_setenv overlays=name_ov1 name_ov2
2596+
```
2597+
2598+
While the current implementation does not allow passing parameters directly to the overlays, this functionality will be introduced in the future through enhancements to U-boot.
2599+
2600+
U-boot can be configured to automatically load specific DTB overlays based on the carrier board it detects, in this case Portenta Hat Carrier, either by probing specific hardware or by reading an identification ID from an EEPROM.
2601+
2602+
The configuration was done by logging into the board and executing commands on the shell. For instance, for a Portenta-X8 placed on a Portenta HAT Carrier, the expected output is as follows:
2603+
2604+
```bash
2605+
fw_printenv overlays
2606+
overlays=ov_som_lbee5kl1dx ov_som_x8h7 ov_carrier_rasptenta_base
2607+
2608+
fw_printenv carrier_name
2609+
carrier_name=rasptenta
2610+
2611+
fw_printenv is_on_carrier
2612+
is_on_carrier=yes
2613+
```
2614+
2615+
This information is written by U-boot during boot in a step referred to as _auto carrier detection_. The variables can be modified from user space, but after a reboot, it reverts to its default state unless the `carrier_custom` variable is set to `1`.
2616+
2617+
```bash
2618+
fw_setenv carrier_custom 1
2619+
```
2620+
2621+
This serves as an escape mechanism to enable user-based configurations.
2622+
2623+
```bash
2624+
fw_setenv carrier_custom 1
2625+
fw_setenv carrier_name rasptenta
2626+
fw_setenv is_on_carrier yes
2627+
fw_setenv overlays "ov_som_lbee5kl1dx ov_som_x8h7 ov_carrier_rasptenta_base ov_carrier_rasptenta_pwm_fan ov_carrier_rasptenta_ov5647_camera_mipi ov_rasptenta_iqaudio_codec"
2628+
```
2629+
2630+
The commands above enables functionalities such as a speed-controlled fan connector, an OV5647 based RPi v1.3 camera, and an IQ Audio Codec Zero audio HAT.
2631+
2632+
Hardware configuration is divided into following layers:
2633+
2634+
- __Layer 0__: System on Module (SoM), prefixed with `ov_som_`.
2635+
- __Layer 1__: Carrier boards, prefixed with `ov_carrier_`.
2636+
- __Layer 2__: HATs and Cameras, which is usually a concatenation of the carrier name and the hat name or functionality.
2637+
2638+
EEPROMs, which store identification IDs, are typically defined on _Layer 1_ and accessible on _I2C1_. Some HATs may also have EEPROMs according to the Raspberry Pi® standard (*ID_SD*, *ID_SC*), accessible on _I2C0_.
2639+
2640+
Some overlays, such as:
2641+
2642+
- `ov_som_lbee5kl1dx`: Adds Wi-Fi®
2643+
- `ov_som_x8h7`: Adds the Portenta H7 external microcontroller
2644+
- `ov_carrier_rasptenta_base`: Base support for Portenta Hat Carrier
2645+
2646+
add functionalities like Wi-Fi® and external microcontroller support. If no known carrier is detected, the first two overlays are applied by default if the Portenta X8 is mounted as the main board.
2647+
2648+
The distinction between system and hardware configuration is crucial. System configuration includes settings such as user creation and Wi-Fi® passwords, whereas hardware configuration is explicitly defined through the device tree.
2649+
2650+
In production environments, the addition of custom compiled device tree overlays is restricted to maintain system integrity and security.
2651+
25562652
## Raspberry Pi® HAT
25572653

25582654
The Portenta Hat Carrier is notable for its compatibility with __Hardware Attached on Top (HAT)__ add-on boards.

0 commit comments

Comments
 (0)