Personal tools

StarSBC-6ULL RS232 example

From SomLabs Wiki

Jump to: navigation, search

StarSBC-6ULL RS232 example


This tutorial shows how to send and receive data using RS232 interface on StarSBC-6ULL with communication extension board. The default Yocto image contains all required software tools.

Loop test

The extension board has two RS232 interfaces available so they may be connected to perform the test in a loop. All signals are available on the J101 and J201 connectors. They should be connected according to the following table:

RS232-1 signal RS232-2 signal
RS232-1 TXD (J101 pin 3) RS232-2 RXD (J201 pin 8)
RS232-1 RXD (J101 pin 4) RS232-2 TXD (J201 pin 7)
RS232-1 CTS (J101 pin 1) RS232-2 RTS (J201 pin 10)
RS232-1 RTS (J101 pin 2) RS232-2 CTS (J201 pin 9)

Both interfaces are already defined in the default module device-tree and are recognized as /dev/ttymxc2 and /dev/ttymxc6 devices. The device files may be used directly for reading and writing and the bitrate may be set using the stty tool:

root@starsbc-6ull:~# stty -F /dev/ttymxc2 9600 crtscts
root@starsbc-6ull:~# stty -F /dev/ttymxc6 9600 crtscts
root@starsbc-6ull:~# cat /dev/ttymxc2 &
[1] 465
root@starsbc-6ull:~# echo "123" > /dev/ttymxc6
123