Difference between revisions of "How to use UART for RK3399 RSB4710"
Yanwei.cao (talk | contribs) |
|||
| Line 106: | Line 106: | ||
If you just want ttyUSB2 (or ttyUSB3)to be RSB485 mode, please change 0x0c to 0x04 (or 0x08). | If you just want ttyUSB2 (or ttyUSB3)to be RSB485 mode, please change 0x0c to 0x04 (or 0x08). | ||
| + | |||
| + | |||
| + | |||
| + | == ADS-B3399G Borad == | ||
| + | |||
| + | The uart value have 4 digital total. 0xWXYZ | ||
| + | <pre>W : port3 - COM5 - /dev/ttyUSB3 | ||
| + | X : port2 - COM4 - /dev/ttyUSB2 | ||
| + | Y : port1 - - /dev/ttyUSB1 | ||
| + | Z : port0 - - /dev/ttyUSB0 | ||
| + | </pre> | ||
| + | |||
| + | There are 5 uart mode different with RSB4710 on ADS-B3399G board. | ||
| + | <pre>0 : LOOPBACK | ||
| + | 1 : RS232 | ||
| + | 2 : RS485 HALF DUPLEX | ||
| + | 3 : RS422/RS485 FULL DUPLEX | ||
| + | 4 : SHUTDOWN | ||
| + | </pre> | ||
| + | |||
| + | For example : 0x32ff | ||
| + | <pre>setenv uart_mode 0x32ff</pre> | ||
| + | |||
| + | It means set port3 to be RS422/RS485 FULL DUPLEX and set port2 to be RS485 HALF DUPLEX | ||
Revision as of 04:39, 29 September 2021
Contents
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
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).
ADS-B3399G Borad
The uart value have 4 digital total. 0xWXYZ
W : port3 - COM5 - /dev/ttyUSB3 X : port2 - COM4 - /dev/ttyUSB2 Y : port1 - - /dev/ttyUSB1 Z : port0 - - /dev/ttyUSB0
There are 5 uart mode different with RSB4710 on ADS-B3399G board.
0 : LOOPBACK 1 : RS232 2 : RS485 HALF DUPLEX 3 : RS422/RS485 FULL DUPLEX 4 : SHUTDOWN
For example : 0x32ff
setenv uart_mode 0x32ff
It means set port3 to be RS422/RS485 FULL DUPLEX and set port2 to be RS485 HALF DUPLEX