Using i.MX 6SoloX UART Ports in Linux |
Unless you have reconfigured Linux to run the console on some interface other than the serial UART (UART1), the serial device driver is already enabled in your kernel configuration and Linux makes use of i.MX 6SoloX UART1 for the serial console and the high-level shell. This application note explains how to enable additional UART ports in Linux. Do not enable any UART interfaces except for those that you plan to use in your application. For one thing, unless an UART interface is actually required, you want to keep it in reset in order to save some power. Another consideration is that UART signals may conflict with other I/O interfaces on the i.MX 6SoloX pads. More on that right below. Allocation of the i.MX 6SoloX pins to specific I/O interfaces is defined in the projects/rootfs/rootfs.dts and linux/arch/arm/boot/dts/imx6sx.dtsi files. For example, UART5 is defined as follows:
There must be a device node in the target root file system for each UART port to allow accessing it using standard Linux interfaces. In the rootfs project, this device node is created by Linux automatically during the system bootup. Note that /dev/ttymxc0 corresponds to UART1, /dev/ttymxc1 to UART2 and so on. The appropriate alias is defined in linux/arch/arm/boot/dts/imx6sx.dtsi:
When you boot the Linux image on the target, there is a message in the kernel bootstrap print-out indicating that the UART interface is available: ... Typically, UART ports are used to connect various equipment such as modems, sensors, additional computers and so on. In Linux, serial ports are accessed from C-level user space code using the standard POSIX APIs. These APIs are extensively defined in various materials available in the Internet. For instance, try googling for something like this "How to access serial ports in C". The UART5 port is available at the P12 connector of the Emcraft SLX-SOM-BSB development baseboard, so you may connect your USB-UART converter as follows:
As a very simple test you may just loopback the RX and TX lines of UART5 on the Emcraft SLX-SOM-BSB board (short P12.10 and P12.8), and use the following commands to send/receive text to/from UART5:
/ # stty -echo raw speed 115200 < /dev/ttymxc4 / # echo "Hello from IMX6SoloX over UART" > /dev/ttymxc4 |