Difference between revisions of "How to use UART for RK3399 RSB4710"

From ESS-WIKI
Jump to: navigation, search
(Created page with "= '''Overview''' = <font color="#000000">The Android/Linux UART/serial port access from user is through the tty-devices. The tty-devices have different names depending on UAR...")
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
 
= '''Overview''' =
 
= '''Overview''' =
  
Line 5: Line 6:
 
== <font color="#0066cc">RS-485</font> ==
 
== <font color="#0066cc">RS-485</font> ==
  
RS-485 uses half-duplex communication, which means that one medium is shared for transmitting and receiving data.  
+
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.  
+
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.
 
Usually the UART RTS signal is used to switch the transmitter on and off.
Line 15: Line 16:
 
== RSB4710 Borad ==
 
== RSB4710 Borad ==
  
{| border="1" cellspacing="1" cellpadding="1"
+
{| border="1" cellpadding="1" cellspacing="1"
 
|-
 
|-
 
| '''COM Name'''
 
| '''COM Name'''
Line 22: Line 23:
 
|-
 
|-
 
| COM0
 
| COM0
| /dev/ttyS0<br/>
+
| /dev/ttyS0
| for BT Data<br/>
+
| pull to M2 interface for BT using
 
|-
 
|-
| COM2<br/>
+
| COM1
| /dev/ttyS2<br/>
+
| /dev/ttyS4
| Debug Port<br/>
+
| support RS232, no flow control
 
|-
 
|-
| COM4<br/>
+
| COM2
| /dev/ttyS4<br/>
+
| /dev/ttyS2
| support RS232, no flow control<br/>
+
| Debug Port
 
|-
 
|-
| USB2COM0<br/>
+
| COM3
| /dev/ttyUSB0<br/>
+
| /dev/ttyUSB0
| support RS232<br/>
+
| support RS232
 
|-
 
|-
| USB2COM1
+
| COM4
| /dev/ttyUSB1<br/>
+
| /dev/ttyUSB1
| support RS232<br/>
+
| support RS232
 
|-
 
|-
| USB2COM2<br/>
+
| COM5
 
| /dev/ttyUSB2
 
| /dev/ttyUSB2
 
| support RS232 and RS485
 
| support RS232 and RS485
 
|-
 
|-
| USB2COM3<br/>
+
| COM6
| dev/ttyUSB3<br/>
+
| /dev/ttyUSB3
| support RS232 and RS485<br/>
+
| support RS232 and RS485
 
|}
 
|}
 
 
 
 
  
 
'''Note&nbsp;:&nbsp;'''
 
'''Note&nbsp;:&nbsp;'''
Line 61: Line 58:
  
 
3. COM2 is designed as debug port default.&nbsp;
 
3. COM2 is designed as debug port default.&nbsp;
 
 
  
 
= How to config RS232 or RS485 mode =
 
= How to config RS232 or RS485 mode =
  
== 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_for_RK3399_RSB4710 How_to_debug].
 
Connect device to debug port, and open debug console. See more&nbsp;:&nbsp;[http://ess-wiki.advantech.com.tw/view/How_to_debug_for_RK3399_RSB4710 How_to_debug].
Line 78: Line 73:
  
 
== Config Uart Mode ==
 
== Config Uart Mode ==
<pre>setenv ttyUSB2 RS485
+
 
setenv ttyUSB3 RS485
+
Only ttyUSB2 and ttyUSB3 support RS485 mode.
 +
 
 +
'''RS485 Mode:&nbsp;'''
 +
<pre>setenv uart_mode 0x0c
 +
saveenv
 +
reset
 +
</pre>
 +
 
 +
'''RS232&nbsp;Mode:&nbsp;'''
 +
<pre>setenv uart_mode 0x00
 
saveenv
 
saveenv
 
reset
 
reset
 
</pre>
 
</pre>
  
'''Note :&nbsp;'''
+
'''RS422&nbsp;Mode: (ADS-B3399G)'''
 +
<pre>setenv uart_mode 0xf
 +
saveenv
 +
reset
 +
</pre>
 +
 
 +
'''Note&nbsp;:&nbsp;'''
 +
 
 +
The default value is RS232.&nbsp;
 +
 
 +
Cp210x support four port, but RSB4710 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).
  
The default value is RS232.
+
If you just want ttyUSB2 (or ttyUSB3)to be RSB485 mode, please change 0x0c to 0x04 (or 0x08).

Latest revision as of 03:26, 11 May 2022

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

RSB4710 Borad

COM Name Device Node Remark
COM0 /dev/ttyS0 pull to M2 interface for BT using
COM1 /dev/ttyS4 support RS232, no flow control
COM2 /dev/ttyS2 Debug Port
COM3 /dev/ttyUSB0 support RS232
COM4 /dev/ttyUSB1 support RS232
COM5 /dev/ttyUSB2 support RS232 and RS485
COM6 /dev/ttyUSB3 support RS232 and RS485

Note : 

1. Only COM4、USB2COM0、USB2COM1、USB2COM2、USB2COM3 are designed for custom using.

2. Only USB2COM2 and USB2COM3 support RSB485.

3. COM2 is designed as debug port default. 

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

RS422 Mode: (ADS-B3399G)

setenv uart_mode 0xf
saveenv
reset

Note : 

The default value is RS232. 

Cp210x support four port, but RSB4710 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 RSB485 mode, please change 0x0c to 0x04 (or 0x08).