Difference between revisions of "How to use UART RK3588"
Yunjin.jiang (talk | contribs) (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 UA...") |
Zhihao.zhu (talk | contribs) (→AOM-3821 Borad) |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 32: | Line 32: | ||
| COM3 | | COM3 | ||
| /dev/ttyS9 | | /dev/ttyS9 | ||
| + | | RS232 4-wire | ||
| + | |} | ||
| + | |||
| + | '''Note : ''' | ||
| + | |||
| + | | ||
| + | |||
| + | == ASR-A501 Borad == | ||
| + | |||
| + | '''Main Board''' | ||
| + | |||
| + | {| border="1" cellpadding="1" cellspacing="1" | ||
| + | |- | ||
| + | | '''COM Name''' | ||
| + | | '''Device Node''' | ||
| + | | '''Remark''' | ||
| + | |- | ||
| + | | COM1 | ||
| + | | /dev/ttyS6 | ||
| + | | RS232 4-wire or RS485 | ||
| + | |- | ||
| + | | COM2 | ||
| + | | /dev/ttyS5 | ||
| + | | RS485 | ||
| + | |- | ||
| + | | COM3 | ||
| + | | /dev/ttyS9 | ||
| + | | RS232 4-wire or RS485 | ||
| + | |- | ||
| + | | COM4 | ||
| + | | /dev/ttyS3 | ||
| + | | RS485 | ||
| + | |} | ||
| + | |||
| + | '''Note : ''' 1. Only COM1 and COM3 support RS232 4-wire. | ||
| + | |||
| + | 2. The COM1 and COM3 default mode is RS232 4-wire. | ||
| + | |||
| + | | ||
| + | |||
| + | '''EG90/RM01/RM02''' | ||
| + | |||
| + | {| border="1" cellpadding="1" cellspacing="1" | ||
| + | |- | ||
| + | | '''COM Name''' | ||
| + | | '''Device Node''' | ||
| + | | '''Remark''' | ||
| + | |- | ||
| + | | COM1 | ||
| + | | /dev/ttyS7 | ||
| + | | RS232 2-wire | ||
| + | |} | ||
| + | |||
| + | '''Note : ''' | ||
| + | |||
| + | | ||
| + | |||
| + | |||
| + | == AOM-3821 Borad == | ||
| + | |||
| + | {| border="1" cellpadding="1" cellspacing="1" | ||
| + | |- | ||
| + | | '''COM Name''' | ||
| + | | '''Device Node''' | ||
| + | | '''Remark''' | ||
| + | |- | ||
| + | | COM1 | ||
| + | | /dev/ttyS0 | ||
| + | | RS232 2-wire | ||
| + | |- | ||
| + | | M.2 E-Key | ||
| + | | /dev/ttyS6 | ||
| RS232 4-wire | | RS232 4-wire | ||
|} | |} | ||
| Line 52: | Line 124: | ||
Then you can input the following cammand to config UART mode. | Then you can input the following cammand to config UART mode. | ||
| − | == Config Uart | + | == Config Uart coming from cpu == |
| + | |||
| + | '''RS485 Mode(Taking ASR-A501 for example):''' | ||
| + | <pre>setenv uart_mode_cpu 6:1,9:1 | ||
| + | saveenv | ||
| + | reset | ||
| + | </pre> | ||
| − | + | '''RS232 Mode(Taking ASR-A501 for example):''' | |
| + | <pre>setenv uart_mode_cpu 6:0,9:0 | ||
| + | saveenv | ||
| + | reset | ||
| + | </pre> | ||
| + | |||
| + | '''Note :''' | ||
| + | |||
| + | The default value is RS232 for ASR-A501 ttyS6 and ttyS9. | ||
| + | |||
| + | Above command "uart_mode_cpu 6:1,9:1", 6:1 means set ttyS6 to RS485(0 means to RS232; 1 means to RS485). | ||
| + | |||
| + | If you just want ttyS6(or ttyS9)to be RS485 mode, please change "6:1,9:1"to "6:1,9:0"(or "6:0,9:1"). | ||
| + | |||
| + | == Config Uart coming from cp2108 == | ||
'''RS485 Mode: ''' | '''RS485 Mode: ''' | ||
| Line 69: | Line 161: | ||
'''Note : ''' | '''Note : ''' | ||
| − | |||
| − | |||
| − | |||
| − | |||
Above command "setenv uart_mode 0x0c", 0x0c means set bit2(ttyUSB2) and bit3(ttyUSB3) to 1 (0 means to RS232; 1 means to RS485). | 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). | If you just want ttyUSB2 (or ttyUSB3)to be RS485 mode, please change 0x0c to 0x04 (or 0x08). | ||
Latest revision as of 06:38, 28 April 2025
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
ROM-6881 Borad
| COM Name | Device Node | Remark |
| COM1 | /dev/ttyS0 | RS232 2-wire |
| COM2 | /dev/ttyS6 | RS232 4-wire |
| COM3 | /dev/ttyS9 | RS232 4-wire |
Note :
ASR-A501 Borad
Main Board
| COM Name | Device Node | Remark |
| COM1 | /dev/ttyS6 | RS232 4-wire or RS485 |
| COM2 | /dev/ttyS5 | RS485 |
| COM3 | /dev/ttyS9 | RS232 4-wire or RS485 |
| COM4 | /dev/ttyS3 | RS485 |
Note : 1. Only COM1 and COM3 support RS232 4-wire.
2. The COM1 and COM3 default mode is RS232 4-wire.
EG90/RM01/RM02
| COM Name | Device Node | Remark |
| COM1 | /dev/ttyS7 | RS232 2-wire |
Note :
AOM-3821 Borad
| COM Name | Device Node | Remark |
| COM1 | /dev/ttyS0 | RS232 2-wire |
| M.2 E-Key | /dev/ttyS6 | RS232 4-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 ASR-A501 for example):
setenv uart_mode_cpu 6:1,9:1 saveenv reset
RS232 Mode(Taking ASR-A501 for example):
setenv uart_mode_cpu 6:0,9:0 saveenv reset
Note :
The default value is RS232 for ASR-A501 ttyS6 and ttyS9.
Above command "uart_mode_cpu 6:1,9:1", 6:1 means set ttyS6 to RS485(0 means to RS232; 1 means to RS485).
If you just want ttyS6(or ttyS9)to be RS485 mode, please change "6:1,9:1"to "6:1,9:0"(or "6:0,9:1").
Config Uart coming from cp2108
RS485 Mode:
setenv uart_mode 0x0c saveenv reset
RS232 Mode:
setenv uart_mode 0x00 saveenv reset
Note :
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).