UART
The phyCORE-i.MX7 Development Kit is configured by default to use UART1 (ttymxc0 in the device tree) for console input and output. UART1 is routed to the micro-USB connector X6 for ease of use. UART5 is also available via the RS-232 serial interface at the connector X2 (ttymxc4). This guide will walk through the steps needed to verify the functionality of UART5. In order to follow this guide you will need a USB to RS-232 Serial Adapter (included with your kit).
The following instructions assume the use of a windows PC as the host machine when setting up your serial connection.
Step-by-Step Guide
- Connect the D-sub 9 ribbon cable (included with your kit) to the X2 connector (red line indicates Pin 1)
- Open the device manager on your host machine.
- Connect the USB to RS-232 Serial Adapter to your host computer and the D-sub 9 ribbon cable and make note of any new devices that appear under "Ports". We will need the COM port the device is listed under for the next step.
- Using your terminal emulator with a baud rate of 115200, begin a new connection using the COM port found in the previous step.
In your Linux console enter the following to set the communication rate for UART5:
Target (Linux)
stty -F /dev/ttymxc4 115200
CODENow try sending a message to your host machine using the UART5 connection:
Target (Linux)
echo 'Testing UART5!' > /dev/ttymxc4
CODEYou should see "Testing UART5!" output to the new UART5 console.
If you have trouble receiving or sending messages to a Console Terminal, ensure that you have the correct COM port set and the terminal is configured for 8 bit data, no parity bits, 1 stop bit, and a baud rate of 115200.
To receive messages from your host machine, set your Linux console to output any incoming data from the UART5 connection:
Target (Linux)
cat /dev/ttymxc4
CODENow type anything you want in the new UART5 console and watch it output to the Linux console once you hit enter.
Enter Ctrl + C in the Linux console to stop waiting for incoming data.
Enable UART5 as a Console in Linux
To enable UART5 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.
Target (Linux)
systemctl enable serial-getty@ttymxc4.service
systemctl start serial-getty@ttymxc4.service
Configuring UART5 as Default Console in U-Boot and Linux
If you would like to use UART5 as the console in U-Boot and Linux, halt the boot process by pressing any key within 3 seconds of applying power to enter U-Boot.
Now modify the Linux configuration by running the following commands:
Target (U-Boot)
=> env set console=ttymxc4
=> boot
You should see the normal Linux boot output on the UART5 serial console. You should also be able to login, send commands, and receive console output.
If you would like to enable UART5 as the default console in the BSP, 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:
Host (include/configs/mx7d_phyboard_zeta.h)
#define CONFIG_MXC_UART_BASE UART5_IPS_BASE_ADDR
Host (include/configs/mx7d_phyboard_zeta.h)
#define CONFIG_CONS_INDEX 5
Host (include/configs/mx7d_phyboard_zeta.h)
/* under the define for CONFIG_EXTRA_ENV_SETTINGS */
"console=ttymxc4\0"