PEB-D-RPI Expansion Board Interfaces
Use the following as a reference for the connector interfaces on the PEB-D-RPI expansion board that will be used in this document.
USB to Serial UART Interface
The i.MX7 is configured by default to use UART5 for console input and output over the carrier board X2 connector shown in the Connector Interfaces section of the i.MX7 Quickstart. The USB to Serial UART interface on the PEB-D-RPI expansion board allows the use of UART1 and UART2 for serial data over connector X6 shown in the above PEB-D-RPI Expansion Board Interfaces section. However, only UART1 is configured in the BSP by default because UART2 is used by the M4 core in PHYTEC's FreeRTOS software.
Sending Serial Data Over USB
To send console data over USB, first connect the USB cable to the expansion board connector X6 and your host PC and power on the i.MX7 to boot into Linux. After booting, your host PC should have access to a serial port that can be connected to with a standard serial console program. Connect to the new serial port and run the following commands on the target over the UART5 serial connection. The first command sets the baud rate for UART1 and the second sends character data to UART1.
You should see 'Testing UART1!' output on the UART1 USB serial console. If not, check the USB serial port settings on the host PC and ensure that it is configured for 115200 baud rate.
Enable UART1 as Console in Linux
To enable UART1 as an additional console in Linux, run the following commands. Note that this setting will persist between boots but will not affect the default console in U-Boot and Linux.
Configuring UART1 as Default Console in U-Boot and Linux
If you would like to use UART1 as the default console in U-Boot and Linux, boot into U-Boot and test the Linux configuration by running the following commands:
You should see the normal Linux boot output on the USB serial console. You should also be able to login, send commands, and receive expected output. If you would like to use UART1 as the default console, modify the U-Boot file 'include/configs/mx7d_phyboard_zeta.h' to match the following lines and recompile and re-deploy U-Boot onto your boot media:
This device allows you to use the I2C4 interface to write and read small amounts of persistent data. The EEPROM is registered under the 'i2c4' node in the expansion board Linux device tree file 'imx7-peb-d-rpi.dtsi' and is accessible as a file in Linux's sysfs directory structure. To write to and read from the 4KB EEPROM on the expansion board, run the following commands on the target:
You should see the values you wrote to the EEPROM displayed on your console in hexdump format.
These buttons (S1 and S2) serve as an example of using GPIO pins as inputs to facilitate user input. The two buttons are registered under their own node, 'phytec_buttons', in the expansion board Linux device tree file 'imx7-peb-d-rpi.dtsi' and their status is accessible in Linux's debugfs directory structure. To poll the status of the buttons, run the following command on the target:
You should see the current state of the GPIO pins connected to the active-low buttons displayed on your console. Additionally, you should see the change in state if you run this command with one, or both, of the buttons held down.
These LEDS (D1 and D2) serve as an example of using GPIO pins as outputs to control a device or devices. The two LEDs are registered under their own node, 'phytec_leds', in the expansion board Linux device tree file 'imx7-peb-d-rpi.dtsi' and their status and control are accessible in Linux's sysfs directory structure. To turn the LEDs on and off, run the following commands on the target:
You should see the individual LEDs turn off and on based upon which digit you echoed and to which LED you echoed. If you would like to impress your friends or co-workers with your technical prowess, run the following commands on the target:
Raspberry Pi-compatible 40-pin Header
This header (X11) serves as Raspberry Pi HAT hardware support and as a convenient location to connect to GPIO or other interface signals that are routed to the expansion board. If you are looking for information regarding Raspberry Pi HAT support, please see i.MX7: Raspberry Pi HAT Support with PEB-D-RPI Expansion Board.
GPIO and Interface Signals Map
The following tables show the GPIO bank and pin and Raspberry Pi-compatible interface signals mapping to the 40-pin header on the PEB-D-RPI expansion board:
|Pin Function||Pin Number||Pin Function|
|Pin Function||Pin Number||Pin Function|
The pin functions highlighted in blue are fixed and can not or should not be changed.
The 40-pin header also features a method to toggle the selection of specific Raspberry Pi-compatible interface signals to certain pins to support different Raspberry Pi HATs using soldered jumpers. The following table details the pins and signals that the jumpers control:
|Jumper||Pin||Default Signal (position 1+2)||Alternative Signal (position 2+3)|
Toggling GPIOs Connected to 40-pin Header
When a Raspberry Pi HAT isn't connected, you can use PHYTEC's RPi.GPIO Python library (included with BSP version PD18.2.0 or later) to control GPIOs connected to the 40-pin header. By default, only the following pins are configured for GPIO use in the PEB-D-RPI device tree file: 7, 11, 12, 13, 15, 16, 18, 22, 29, 32, 35, 40. For information on how to enable more GPIOs, please reference i.MX7: Raspberry Pi HAT Support with PEB-D-RPI Expansion Board.
To set pin 7 on the 40-pin header to be a GPIO output and toggle its value, open your Python interpreter on the target and input the following code:
Using a digital multimeter or other suitable device, you can see the value on pin 7 of the 40-pin header go from 0 to 3.3 V and back to 0 V using the above code. You can also toggle GPIOs using the libgpiod utilities installed to the BSP file system. To toggle the same pin using libgpiod utilities, run the following commands on the target:
The above commands toggle GPIO chip 4, pin 21, which is routed to pin 7 of the 40-pin header on the PEB-D-RPI expansion board.
ARM JTAG 20-pin Debug Interface Header
This header (X5) allows you to connect an ARM JTAG 20-pin compatible debugger to the i.MX7. PHYTEC has tested the JTAG header and interface using an ARM DSTREAM debugger along with ARM DS-5 Development Studio. You will need to reference the documentation provided by the manufacturer of your debugger to configure and connect your debugger to the debug header.
Unpopulated Expansion Signal Pin Headers
These unpopulated headers (X12 and X13) can be used to access expansion board signals that are not brought out to the Raspberry Pi-compatible 40-pin header. The following tables show the signals brought out to the unpopulated headers: