Difference between revisions of "ROM-6881 How to use UART"

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 UA...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  
= '''Overview''' =
+
== UART&nbsp; ==
  
<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 UART driver on different board.</font>
+
'''User Debian/Linux UART/serial port access is through the tty-devices. The ttydevices&nbsp;have different names depending on UART drivers for different boards.The&nbsp;default value is RS232.'''
  
== <font color="#0066cc">RS-485</font> ==
+
{| border="1" cellpadding="1" cellspacing="1" style="width: 500px;"
 
 
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 ==
 
 
 
{| style="border:undefined"
 
 
|-
 
|-
| '''COM Name'''
+
| '''ROM-6881 -Device Node'''
| '''Device Node'''
+
| '''SOM-DB2510 device-COM Port Name'''
| '''Remark'''
 
 
|-
 
|-
| COM1
 
 
| /dev/ttyS0
 
| /dev/ttyS0
| RS232 2-wire
+
| COM2_4的COM2(RS232 2-wire)
 
|-
 
|-
| COM2
 
 
| /dev/ttyS6
 
| /dev/ttyS6
| RS232 4-wire
+
| COM1_3的COM1(RS232 4-wire)
 
|-
 
|-
| COM3
 
 
| /dev/ttyS9
 
| /dev/ttyS9
| RS232 4-wire
+
| COM1_3的COM3(RS232 4-wire)
 
|}
 
|}
  
'''Note :'''
+
== SOM-DB2510 UART Setting&nbsp; ==
 
 
&nbsp;
 
 
 
= How to config RS232 or RS485 mode =
 
 
 
Enter U-boot interrupt mode
 
 
 
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 "ctrl + c" key before power up the device, until get the following information on debug console :
 
<pre>Hit any key to stop autoboot: 0
 
=> <INTERRUPT>
 
=></pre>
 
 
 
Then you can input the following cammand to config UART mode.
 
 
 
== Config Uart Mode ==
 
 
 
Only ttyUSB2 and ttyUSB3 support RS485 mode.
 
 
 
'''RS485 Mode:'''
 
<pre>setenv uart_mode 0x0c
 
saveenv
 
reset
 
</pre>
 
 
 
'''RS232 Mode:'''
 
<pre>setenv uart_mode 0x00
 
saveenv
 
reset
 
</pre>
 
 
 
'''Note :'''
 
  
The default value is RS232.
+
[[File:SOM-DB2510 SW1.PNG]][[File:SOM-DB2510 SW2.PNG]]
  
Cp210x support four port, but RSB4810 Only ttyUSB2 and ttyUSB3 support RS485 mode.
+
== Test ==
  
Above command "setenv uart_mode 0x0c", 0x0c means set bit2(ttyUSB2) and bit3(ttyUSB3) to 1 (0 means to RS232; 1 means to RS485).
+
1.&nbsp; 4-wire (Take SOM-DB2510&nbsp; COM1_3的COM1 for example)
 +
<pre># /tools/test/adv/uart/rs232_4_wire_test.sh /dev/ttyS6</pre>
  
If you just want ttyUSB2 (or ttyUSB3)to be RS485 mode, please change 0x0c to 0x04 (or 0x08).
+
2.&nbsp; 2-wire (Take SOM-DB2510 COM2_4的COM2 for example)
 +
<pre># /tools/test/adv/uart/rs232_2_wire_test.sh /dev/ttyS0</pre>

Latest revision as of 09:01, 3 January 2024

UART 

User Debian/Linux UART/serial port access is through the tty-devices. The ttydevices have different names depending on UART drivers for different boards.The default value is RS232.

ROM-6881 -Device Node SOM-DB2510 device-COM Port Name
/dev/ttyS0 COM2_4的COM2(RS232 2-wire)
/dev/ttyS6 COM1_3的COM1(RS232 4-wire)
/dev/ttyS9 COM1_3的COM3(RS232 4-wire)

SOM-DB2510 UART Setting 

SOM-DB2510 SW1.PNGSOM-DB2510 SW2.PNG

Test

1.  4-wire (Take SOM-DB2510  COM1_3的COM1 for example)

# /tools/test/adv/uart/rs232_4_wire_test.sh /dev/ttyS6

2.  2-wire (Take SOM-DB2510 COM2_4的COM2 for example)

# /tools/test/adv/uart/rs232_2_wire_test.sh /dev/ttyS0