Difference between revisions of "How to use UART RK3568"

From ESS-WIKI
Jump to: navigation, search
Line 11: Line 11:
 
Usually the UART RTS signal is used to switch the transmitter on and off.
 
Usually the UART RTS signal is used to switch the transmitter on and off.
  
= '''Boards''' =
+
<h1> <b>Boards</b> </h1>
 +
<h2> RSB-4810 Borad </h2>
 +
<table border="1" cellpadding="1" cellspacing="1">
  
 +
<tr>
 +
<td> <b>COM Name</b>
 +
</td>
 +
<td> <b>Device Node</b>
 +
</td>
 +
<td> <b>Remark</b>
 +
</td></tr>
 +
<tr>
 +
<td> COM1
 +
</td>
 +
<td> /dev/ttyS4
 +
</td>
 +
<td> support RS232, no flow control
 +
</td></tr>
 +
<tr>
 +
<td> COM2
 +
</td>
 +
<td> /dev/ttyS7
 +
</td>
 +
<td> support RS232, no flow control
 +
</td></tr>
 +
<tr>
 +
<td> COM3
 +
</td>
 +
<td> /dev/ttyUSB2
 +
</td>
 +
<td> support RS232 and RS485
 +
</td></tr>
 +
<tr>
 +
<td> COM4
 +
</td>
 +
<td> /dev/ttyUSB3
 +
</td>
 +
<td> support RS232&#160;and RS485
 +
</td></tr>
 +
<tr>
 +
<td> COM5
 +
</td>
 +
<td> /dev/ttyUSB0
 +
</td>
 +
<td> support RS232
 +
</td></tr>
 +
<tr>
 +
<td> COM6
 +
</td>
 +
<td> /dev/ttyUSB1
 +
</td>
 +
<td> support RS232
 +
</td></tr></table>
 +
<p><b>Note&#160;:&#160;</b>
 +
</p><p>1. Only USB2COM2 and&#160;USB2COM3&#160;support RS485 mode.
 +
</p><p>2. COM2 is designed as debug port default.&#160;
 +
</p>
 +
<h2> KEDGE-350 Borad </h2>
 +
<table border="1" cellpadding="1" cellspacing="1">
  
== RSB-4810 Borad ==
+
<tr>
 +
<td> <b>COM Name</b>
 +
</td>
 +
<td> <b>Device Node</b>
 +
</td>
 +
<td> <b>Remark</b>
 +
</td></tr>
 +
<tr>
 +
<td> COM0
 +
</td>
 +
<td> /dev/ttyS3
 +
</td>
 +
<td> RS232 2-wire and RS485
 +
</td></tr>
 +
<tr>
 +
<td> COM1
 +
</td>
 +
<td> /dev/ttyS4
 +
</td>
 +
<td> RS232 2-wire and RS485
 +
</td></tr>
 +
<tr>
 +
<td> COM2(UIO)
 +
</td>
 +
<td> /dev/ttyS7
 +
</td>
 +
<td> RS232 2-wire
 +
</td></tr>
 +
<tr>
 +
<td> COM3(UIO)
 +
</td>
 +
<td> /dev/ttyS8
 +
</td>
 +
<td> RS232 2-wire
 +
</td></tr></table>
 +
<p><b>Note&#160;:&#160;</b>
 +
</p><p>1. Only COM0&#160;and COM1&#160;support RS485 mode.
 +
</p>
 +
<h2> ROM-5880 Borad </h2>
 +
<table border="1" cellpadding="1" cellspacing="1">
  
{| border="1" cellpadding="1" cellspacing="1"
+
<tr>
|-
+
<td> <b>COM Name</b>
| '''COM Name'''
+
</td>
| '''Device Node'''
+
<td> <b>Device Node</b>
| '''Remark'''
+
</td>
|-
+
<td> <b>Remark</b>
| COM1
+
</td></tr>
| /dev/ttyS4
+
<tr>
| support RS232, no flow control
+
<td> COM1
|-
+
</td>
| COM2
+
<td> /dev/ttyS3
| /dev/ttyS7
+
</td>
| support RS232, no flow control
+
<td> support RS232,
|-
+
</td></tr>
| COM3
+
<tr>
| /dev/ttyUSB2
+
<td> COM2
| support RS232 and RS485
+
</td>
|-
+
<td> /dev/ttyS7
| COM4
+
</td>
| /dev/ttyUSB3
+
<td> support RS232,&#160;no flow control
| support RS232&nbsp;and RS485
+
</td></tr>
|-
+
<tr>
| COM5
+
<td> COM3
| /dev/ttyUSB0
+
</td>
| support RS232
+
<td> /dev/ttyS4
|-
+
</td>
| COM6
+
<td> support RS232
| /dev/ttyUSB1
+
</td></tr>
| support RS232
+
<tr>
|}
+
<td> COM4
 
+
</td>
'''Note&nbsp;:&nbsp;'''
+
<td> /dev/ttyS5
 
+
</td>
1. Only USB2COM2 and&nbsp;USB2COM3&nbsp;support RS485 mode.
+
<td> support RS232,&#160;no flow control
 
+
</td></tr></table>
2. COM2 is designed as debug port default.&nbsp;
+
<p><b>Note&#160;:&#160;</b>
 
+
</p><p>&#160;
== ROM-5880 Borad ==
+
</p>
 
 
{| border="1" cellpadding="1" cellspacing="1"
 
|-
 
| '''COM Name'''
 
| '''Device Node'''
 
| '''Remark'''
 
|-
 
| COM1
 
| /dev/ttyS3
 
| support RS232,
 
|-
 
| COM2
 
| /dev/ttyS7
 
| support RS232,&nbsp;no flow control
 
|-
 
| COM3
 
| /dev/ttyS4
 
| support RS232
 
|-
 
| COM4
 
| /dev/ttyS5
 
| support RS232,&nbsp;no flow control
 
|}
 
 
 
'''Note&nbsp;:&nbsp;'''
 
 
 
&nbsp;
 
  
 
= How to config RS232 or RS485 mode =
 
= How to config RS232 or RS485 mode =

Revision as of 11:33, 19 March 2024

Overview

The Android/Linux UART/serial port access from user is through the tty-devices. The tty-devices have different names depending on UART driver on different board.

RS-485

RS-485 uses half-duplex communication, which means that one medium is shared for transmitting and receiving data.

Therefore the system needs to control the RS-485 transceiver's transmit mode.

Usually the UART RTS signal is used to switch the transmitter on and off.

Boards

RSB-4810 Borad

COM Name Device Node Remark
COM1 /dev/ttyS4 support RS232, no flow control
COM2 /dev/ttyS7 support RS232, no flow control
COM3 /dev/ttyUSB2 support RS232 and RS485
COM4 /dev/ttyUSB3 support RS232 and RS485
COM5 /dev/ttyUSB0 support RS232
COM6 /dev/ttyUSB1 support RS232

Note : 

1. Only USB2COM2 and USB2COM3 support RS485 mode.

2. COM2 is designed as debug port default. 

KEDGE-350 Borad

COM Name Device Node Remark
COM0 /dev/ttyS3 RS232 2-wire and RS485
COM1 /dev/ttyS4 RS232 2-wire and RS485
COM2(UIO) /dev/ttyS7 RS232 2-wire
COM3(UIO) /dev/ttyS8 RS232 2-wire

Note : 

1. Only COM0 and COM1 support RS485 mode.

ROM-5880 Borad

COM Name Device Node Remark
COM1 /dev/ttyS3 support RS232,
COM2 /dev/ttyS7 support RS232, no flow control
COM3 /dev/ttyS4 support RS232
COM4 /dev/ttyS5 support RS232, no flow control

Note : 

 

How to config RS232 or RS485 mode

Enter U-boot interrupt mode

Connect device to debug port, and open debug console. See more : How_to_debug.

Press "ctrl + c" key before power up the device, until get the following information on debug console : 

Hit any key to stop autoboot: 0
=> <INTERRUPT>
=>

Then you can input the following cammand to config UART mode.

Config Uart Mode

Only ttyUSB2 and ttyUSB3 support RS485 mode.

RS485 Mode: 

setenv uart_mode 0x0c
saveenv
reset

RS232 Mode: 

setenv uart_mode 0x00
saveenv
reset

Note : 

The default value is RS232. 

Cp210x support four port, but RSB4810 Only ttyUSB2 and ttyUSB3 support RS485 mode.

Above command "setenv uart_mode 0x0c", 0x0c means set bit2(ttyUSB2) and bit3(ttyUSB3) to 1 (0 means to RS232; 1 means to RS485).

If you just want ttyUSB2 (or ttyUSB3)to be RS485 mode, please change 0x0c to 0x04 (or 0x08).