Date added: June 29, 2018
Affected Products: EDM1-CF-IMX6 , EDM1-CF-IMX6SX , EDM1-IMX6PLUS , EDM1-IMX6UL , EDM1-IMX7D , EDM2-IMX6PLUS , PICO-IMX6 , PICO-IMX6UL , PICO-IMX6UL-NAND , PICO-IMX6UL-NOR , PICO-IMX7 , PICO-IMX8M , TC-0700 , TC-0710 , TC-1010 , TEK3-IMX6 , TEK3-IMX6UL , TEP-0500-IMX6UL , TEP-0500-IMX7 , TEP-0700-IMX6UL , TEP-0700-IMX7 , TEP-1010-IMX6 , TEP-1560-IMX6 , TWP-1010-IMX6 , TWP-1560-IMX6 , WANDPI-8M , WBDUAL , WBQUAD , WBSOLO
This guide explains how to use a serial port using linux shell. It shows how to set and read serial port settings, and how to send and receive data on a serial port.
To follow this guide, a terminal/shell is needed on the TechNexion development kit. The easiest way is to use the debug console facility, but can also be achieved using
UART naming and numbering
In hardware manuals, schematics and the like, the UARTs are often named “UART1” or “UART2” and so forth. Typically, there is no “UART0”. Software on the other handtypically numbers the serial port devices starting with the number 0.
To make a long story short, what in schematics or user guides is called “UART1” is
/dev/ttymxc0 in software, “UART2” is
/dev/ttymxc1, and so on.
Setting and reading UART parameters
UART parameters are read and set with the
To set the baud rate on UART3 to 115200, use the command
# stty -F /dev/ttymxc2 115200
To enable RTS/CTS flow control, use
# stty -F /dev/ttymxc2 crtscts
and disable flow control with
# stty -F /dev/ttymxc2 -crtscts.
To view the current settings for UART3, use
# stty -a -F /dev/ttymxc2
/dev/ttymxc2 with the name of the UART device.
Sending and Receiving data
This is very easy, sending is done by writing data to the device file, for instance by
# echo "Hello world" > /dev/ttymxc2
and to receive is to read the device file
# cat /dev/ttymxc2
Please note that the receiving terminal can have buffering enabled, so the data read might not be displayed immediately. The buffer is flushed once enough data is entered, or when enough newlines are encountered.