Difference between revisions of "RSB-3730 UART(RS-232/RS-485)"
Xingxing.li (talk | contribs) |
Xingxing.li (talk | contribs) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | |||
+ | === '''UART''' === | ||
+ | |||
+ | The Linux UART/serial port access from user is through the tty-devices. The ttydevices have different names depending on UART driver on different board.<br/> 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. | ||
=== '''How to Config RS232 or RS485 Mode''' === | === '''How to Config RS232 or RS485 Mode''' === | ||
Line 62: | Line 66: | ||
# echo test > /dev/ttymxc2</pre> | # echo test > /dev/ttymxc2</pre> | ||
− | [[File:RSB-3730 RS485 for Adam-4520I.png]] | + | Receive “test” on PC terminal. |
+ | |||
+ | [[File:RSB-3730 RS485 for Adam-4520I.png|1100x500px|RSB-3730 RS485 for Adam-4520I.png]] |
Latest revision as of 09:13, 10 November 2023
UART
The Linux UART/serial port access from user is through the tty-devices. The ttydevices have different names depending on UART driver on different board.
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.
How to Config RS232 or RS485 Mode
COM Name | Device Node | Remark |
UIO2 com1 | /dev/ttymxc0 | support RS232 |
COM1/DEBUG2 | /dev/ttymxc1 | Debug Port |
COM | /dev/ttymxc2 | support RS232/RS485 |
UIO2 com4 | /dev/ttymxc3 | support RS232 |
Enter U-boot interrupt mode Connect device to debug port, and open debug console.
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.
RS485 Mode:
=> setenv uart_mode 2:1 => saveenv => reset
RS232 Mode:
=> setenv uart_mode 2:0 => saveenv => reset
Note:The default value is RS232.
The above command "setenv uart_mode 2:1", 2:1 means to set ttymxc2 to RS485 standard mode, and 2:0 means to set ttymxc2 to RS232 mode.
The following RS232 testing method is shared by "/dev/ttymxc0, /dev/ttymxc2, /dev/ ttymxc3",and only needs to be replaced Uart Name.
RS232- Loopback Test
# stty -F /dev/ttymxc0 -echo -onlcr 115200 # cat /dev/ttymxc0 & # echo "Serial Port Test" > /dev/ttymxc0
RS-485 Test
Test RS-485 with Adam-4520I. Connect Adam-4520I to PC with DB9 cable.Connect Adam-4520I to COMX DB9.
# stty -F /dev/ttymxc2 speed 115200 ignbrk -brkint \ -icrnl -imaxbel -opost -onlcr -isig -icanon \ -iexten -echo -echoe -echok -echoctl -echoke # cat /dev/ttymxc2 & # echo test > /dev/ttymxc2
Receive “test” on PC terminal.