[AIOT] COM Use for Tinker Board 3N

stty loopback: http://gist.github.com/midnight-wonderer/781facfe2fb6ee108a0e

Note:

switch_com3_protocol.zip

test.zip

1. Test for COM1

Set baudrate to 115200

stty -F /dev/ttyS0 115200
 

Transfer data to pc putty (String which input from device will display on putty.)

echo "test" > /dev/ttyS0
 

Receive pc putty data (String which input from putty will display on device.)

cat /dev/ttyS0
 

2. Test for COM2

Set baudrate to 115200

stty -F /dev/ttyS8 115200
 

Transfer data to pc putty (String which input from device will display on putty.)

echo "test" > /dev/ttyS8
 

Receive pc putty data (String which input from putty will display on device.)

cat /dev/ttyS8
 

3. Test for COM3

Push switch_uart3_protocol.sh into device by adb tool or copy the switch_uart3_protocol.sh to Desktop by usb flash

#Debian
adb push switch_com3_protocol.sh /home/linaro/Desktop

#androids
adb push switch_com3_protocol.sh sdcard
 

Change mode of switch_uart3_protocol.sh before using it

#Debian
chmod a+x /home/linaro/Desktop/switch_com3_protocol.sh

#androids
chmod a+x sdcard/switch_com3_protocol.sh
 

Switch protocol to rs232/rs422/rs485

#Debian
./home/linaro/Desktop/switch_com3_protocol.sh 232
./home/linaro/Desktop/switch_com3_protocol.sh 422
./home/linaro/Desktop/switch_com3_protocol.sh 485

#androids
su
sh sdcard/switch_com3_protocol.sh 232
sh sdcard/switch_com3_protocol.sh 422
sh sdcard/switch_com3_protocol.sh 485
 

Set baudrate to 115200

stty -F /dev/ttyS3 115200
 

Transfer data to pc putty (String which input from device will display on putty.)

echo "test" > /dev/ttyS3
 

Receive pc putty data (String which input from putty will display on device.)

cat /dev/ttyS3
 

4. Test with com_port_test.sh

chmod 777 com_port_test_tinker3.sh
chmod 777 com_port_test   
chmod 777 switch_com3_protocol.sh
 
com_port_test.sh [COM1] [COM2] [PROTOCOL] [FLOW_CONTROL]
com_port_test.sh [COM1] [FLOW_CONTROL]

example: #COM1<=>COM2 without flow control
         sudo ./com_port_test_tinker3.sh /dev/ttyS0 /dev/ttyS8 0 0
         #COM1<=>COM2 with flow control
         sudo ./com_port_test_tinker3.sh /dev/ttyS0 /dev/ttyS8 0 1
         #COM1<=>COM3(232) with flow control
         sudo ./com_port_test_tinker3.sh /dev/ttyS0 /dev/ttyS3 232 1
         #COM1 self test with flow control
         sudo ./com_port_test_tinker3.sh /dev/ttyS0 1
 
  • COM3 RS232 to usb converter

  • COM3 RS422 to RS232 converter

  • COM3 RS485 to RS232 converter