UART
Update time:2018-04-13 Views:2204
Intro
ROC-RK3328-CC development board supports 3 independent UART
controller:UART0,UART1and UART2,each with two 64-byte FIFO
buffers for data reception and transmission.
among them:
UART0 for Bluetooth transmission, UART2 for debugging serial port, only UART0 and UART3 support hardware automatic flow control.
Support bit rate 115.2Kbps, 460.8Kbps, 921.6Kbps, 1.5Mbps, 3Mbps, 4Mbps.
Supports programmable baud rates even,even with non-integer clock divider.
Supports interrupt-based or DMA-based modes
Support 5-8 bit width transfer
Our ROC-RK3328-CC development board for the convenience of users, leads
to a row of general-purpose GPIO, the corresponding schematic is as
follows:
RX2, TX2 for UART2 debug serial port, RX1, TX1 as UART1 can be used as an external serial port.
Debugging method
You can now communicate with the uart4 via a USB-to-serial adapter in your host PC. Follow the steps below:
(1) Connect the uart port.
Connect the TX, RX, GND pins of uart4 to the serial adapter's TX, RX, GND pins respectively.
(2) Open a serial terminal in host PC.
Run kermit in a shell window, and set baud rate:
$ sudo kermit C-Kermit> set line /dev/ttyUSB0 C-Kermit> set speed 9600 C-Kermit> set flow-control none C-Kermit> connect
* /dev/ttyUSB0 is the device file of USB-to-serial adapter. * baud is the "current-speed" attribute in the DTS node.
(3) Transmit data.
The device file for uart1 is /dev/ttyS1. Run the following command in device:
echo firefly uart1 test... > /dev/ttyS1
The serial terminal in the host PC will receive string "firefly uart1 test...".
(4) Receive data.
First, run the following command in device:
cat /dev/ttyS1
Then input string "Firefly uart1 test..." in the serial terminal.You can see the same string received in the device.
FAQs
Q1: Why is the system error after connecting to the serial adapter?
A1:ROC-RK3328-CC development board's TX and RX, respectively, corresponding to the serial port adapter's TX and RX, If confused, it will lead to serial communication error.