Difference between revisions of "How to use UART RK3568"

From ESS-WIKI
Jump to: navigation, search
(remove dummy setenv cmd)
 
(11 intermediate revisions by 2 users not shown)
Line 13: Line 13:
 
= '''Boards''' =
 
= '''Boards''' =
  
== RSB4810 Borad ==
+
== RSB-4810 Borad ==
  
{| border="1" cellspacing="1" cellpadding="1"
+
{| border="1" cellpadding="1" cellspacing="1"
 
|-
 
|-
 
| '''COM Name'''
 
| '''COM Name'''
Line 21: Line 21:
 
| '''Remark'''
 
| '''Remark'''
 
|-
 
|-
| COM1<br/>
+
| COM1
| /dev/ttyS4<br/>
+
| /dev/ttyS4
| support RS232, no flow control<br/>
+
| RS232 2-wire
 
|-
 
|-
| COM2<br/>
+
| COM2
| /dev/ttyS7<br/>
+
| /dev/ttyS7
| support RS232, no flow control<br/>
+
| RS232 2-wire
 
|-
 
|-
| COM3<br/>
+
| COM3
| /dev/ttyUSB2<br/>
+
| /dev/ttyUSB2
| support RS232 and RS485<br/>
+
| RS232 4-wire and RS485
 
|-
 
|-
 
| COM4
 
| COM4
| /dev/ttyUSB3<br/>
+
| /dev/ttyUSB3
| support RS232&nbsp;and RS485<br/>
+
| RS232 4-wire&nbsp;and RS485
 
|-
 
|-
| COM5<br/>
+
| COM5
 
| /dev/ttyUSB0
 
| /dev/ttyUSB0
| support RS232
+
| RS232 4-wire
 
|-
 
|-
| COM6<br/>
+
| COM6
| /dev/ttyUSB1<br/>
+
| /dev/ttyUSB1
| support RS232<br/>
+
| RS232 4-wire
 
|}
 
|}
 +
 +
'''Note&nbsp;:&nbsp;'''
 +
 +
&nbsp;
  
  
 +
== KEDGE-350 Borad ==
 +
 +
'''Main Board'''
 +
 +
{| border="1" cellpadding="1" cellspacing="1"
 +
|-
 +
| '''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&nbsp;:&nbsp;'''
  
 +
1. Only COM0&nbsp;and COM1&nbsp;support RS485 mode.
  
 +
&nbsp;
  
 +
'''UIO-4031'''
  
 +
{| border="1" cellpadding="1" cellspacing="1"
 +
|-
 +
| '''COM Name'''
 +
| '''Device Node'''
 +
| '''Remark'''
 +
|-
 +
| COM0
 +
| /dev/ttyUSB2
 +
| RS485
 +
|-
 +
| COM1
 +
| /dev/ttyUSB3
 +
| RS485
 +
|-
 +
| COM2
 +
| /dev/ttyUSB0
 +
| RS485
 +
|-
 +
| COM3
 +
| /dev/ttyUSB1
 +
| RS485
 +
|-
 +
| COM4
 +
| /dev/ttyS7
 +
| RS232 2-wire
 +
|-
 +
| COM5
 +
| /dev/ttyS8
 +
| RS232 2-wire
 +
|}
  
 +
&nbsp;
 +
 +
 +
== ROM-5880 Borad ==
 +
 +
{| border="1" cellpadding="1" cellspacing="1"
 +
|-
 +
| '''COM Name'''
 +
| '''Device Node'''
 +
| '''Remark'''
 +
|-
 +
| COM1
 +
| /dev/ttyS3
 +
| RS232 4-wire
 +
|-
 +
| COM2
 +
| /dev/ttyS5
 +
| RS232 2-wire
 +
|-
 +
| COM3
 +
| /dev/ttyS4
 +
| RS232 4-wire
 +
|-
 +
| COM4
 +
| /dev/ttyS7
 +
| RS232 2-wire
 +
|}
  
 
'''Note&nbsp;:&nbsp;'''
 
'''Note&nbsp;:&nbsp;'''
  
1. Only USB2COM2 and&nbsp;USB2COM3&nbsp;support RSB485.
+
&nbsp;
 
 
2. COM2 is designed as debug port default.&nbsp;
 
  
 
= How to config RS232 or RS485 mode =
 
= How to config RS232 or RS485 mode =
Line 64: Line 153:
 
Enter U-boot interrupt mode
 
Enter U-boot interrupt mode
  
Connect device to debug port, and open debug console. See more&nbsp;:&nbsp;[http://ess-wiki.advantech.com.tw/view/How_to_debug_RK3568 How_to_debug].
+
Connect device to debug port, and open debug console. See more [http://ess-wiki.advantech.com.tw/view/How_to_debug_RK3568 How_to_debug].
  
Press&nbsp;"ctrl + c" key before power up the device, until get the following information on debug console&nbsp;:&nbsp;
+
Press "ctrl + c" key before power up the device, until get the following information on debug console :
 
<pre>Hit any key to stop autoboot: 0
 
<pre>Hit any key to stop autoboot: 0
 
=> <INTERRUPT>
 
=> <INTERRUPT>
 
=></pre>
 
=></pre>
  
Then you can&nbsp;input the following cammand to config UART mode.
+
Then you can input the following cammand to config UART mode.
  
== Config Uart Mode ==
+
== Config Uart coming from cpu ==
  
Only ttyUSB2 and ttyUSB3 support RS485 mode.
+
'''RS485 Mode(Taking Kedge-350 for example):'''
 +
<pre>setenv uart_mode_cpu 3:1,4:1
 +
saveenv
 +
reset
 +
</pre>
  
'''RS485 Mode:&nbsp;'''
+
'''RS232 Mode(Taking Kedge-350 for example):'''
 +
<pre>setenv uart_mode_cpu 3:0,4:0
 +
saveenv
 +
reset
 +
</pre>
 +
 
 +
'''Note&nbsp;:'''
 +
 
 +
The default value is RS485 for Kedge-350.
 +
 
 +
Above command "uart_mode_cpu 3:1,4:1", 3:1 means set ttyS3 to RS485(0 means to RS232; 1 means to RS485).
 +
 
 +
If you just want ttyS3(or ttyS4)to be RS485 mode, please change "3:1,4:1"to "3:1,4:0"(or "3:0,4:1").
 +
 
 +
== Config Uart coming from cp2108 ==
 +
 
 +
'''RS485 Mode:'''
 
<pre>setenv uart_mode 0x0c
 
<pre>setenv uart_mode 0x0c
 
saveenv
 
saveenv
Line 83: Line 192:
 
</pre>
 
</pre>
  
'''RS232&nbsp;Mode:&nbsp;'''
+
'''RS232 Mode:'''
 
<pre>setenv uart_mode 0x00
 
<pre>setenv uart_mode 0x00
 
saveenv
 
saveenv
Line 89: Line 198:
 
</pre>
 
</pre>
  
'''Note&nbsp;:&nbsp;'''
+
'''Note :'''
  
The default value is RS232.&nbsp;
+
The default value is RS232.
  
 
Cp210x support four port, but RSB4810 Only ttyUSB2 and ttyUSB3 support RS485 mode.
 
Cp210x support four port, but RSB4810 Only ttyUSB2 and ttyUSB3 support RS485 mode.

Latest revision as of 11:25, 22 May 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 RS232 2-wire
COM2 /dev/ttyS7 RS232 2-wire
COM3 /dev/ttyUSB2 RS232 4-wire and RS485
COM4 /dev/ttyUSB3 RS232 4-wire and RS485
COM5 /dev/ttyUSB0 RS232 4-wire
COM6 /dev/ttyUSB1 RS232 4-wire

Note : 

 


KEDGE-350 Borad

Main Board

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.

 

UIO-4031

COM Name Device Node Remark
COM0 /dev/ttyUSB2 RS485
COM1 /dev/ttyUSB3 RS485
COM2 /dev/ttyUSB0 RS485
COM3 /dev/ttyUSB1 RS485
COM4 /dev/ttyS7 RS232 2-wire
COM5 /dev/ttyS8 RS232 2-wire

 


ROM-5880 Borad

COM Name Device Node Remark
COM1 /dev/ttyS3 RS232 4-wire
COM2 /dev/ttyS5 RS232 2-wire
COM3 /dev/ttyS4 RS232 4-wire
COM4 /dev/ttyS7 RS232 2-wire

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 coming from cpu

RS485 Mode(Taking Kedge-350 for example):

setenv uart_mode_cpu 3:1,4:1
saveenv
reset

RS232 Mode(Taking Kedge-350 for example):

setenv uart_mode_cpu 3:0,4:0
saveenv
reset

Note :

The default value is RS485 for Kedge-350.

Above command "uart_mode_cpu 3:1,4:1", 3:1 means set ttyS3 to RS485(0 means to RS232; 1 means to RS485).

If you just want ttyS3(or ttyS4)to be RS485 mode, please change "3:1,4:1"to "3:1,4:0"(or "3:0,4:1").

Config Uart coming from cp2108

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).