MX28: How to use kernel command to test AUART

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MX28: How to use kernel command to test AUART

1,866 Views
PeterChan
NXP Employee
NXP Employee

Find out the available AUART devices

To list the serial port, use:

$ dmesg | grep -i tty

Kernel command line: -e noinitrd console=ttyAM0,115200 root=/dev/mmcblk0p3 rw rootwait ip=none gpmi

console [ttyAM0] enabled

mxs-duart.0: ttyAM0 at MMIO 0x80074000 (irq = 47) is a DebugUART

mxs-auart.0: ttySP0 at MMIO 0x8006a000 (irq = 112) is a mxs-auart.0

mxs-auart.1: ttySP1 at MMIO 0x8006c000 (irq = 113) is a mxs-auart.1

mxs-auart.2: ttySP2 at MMIO 0x8006e000 (irq = 114) is a mxs-auart.2

mxs-auart.3: ttySP3 at MMIO 0x80070000 (irq = 115) is a mxs-auart.3

mxs-auart.4: ttySP4 at MMIO 0x80072000 (irq = 116) is a mxs-auart.4

From the above information, we know that the serial port for mxs-auart.0 is /dev/ttySP0 and

mxs-auart.1 is /dev/ttySP1 etc.



Configure the serial port

Use the stty command to configure the serial port for UART communication. For example, to configure the serial port 0 for baud rate 115200, use


$ stty -F /dev/ttySP0 115200 raw

Please also configure the UART device at the other end with the same settings. After this, the serial port is ready to send and receive data.



Read from Serial Port

Simply use the cat command to read the serial port and everything received from the serial port will be printed out in the console.


$ cat /dev/ttySP0



Write to Serial Port

It is just redirect any data to the serial port device


$ cat <file> > /dev/ttySP0

$ echo "hello" > /dev/ttySP0


and you should see the file content and the hello string at the other end.



Hardware Flow Control

To enable the hardware flow control of the UART, simply append the "crtscts" setting in the stty command.


$ stty -F /dev/ttySP0 115200 raw crtscts


If you have enable flow control, please notice that the CTS signal of one end must be connected to RTS of the other end or else the transimission will not start.

Labels (1)
0 Kudos
0 Replies