Serial Programming Part 6 - Matching ttyS* node with Physical Port

Suppose, if you have multiple serial ports on your hardware, multiple /dev/ttyS* files will be created on Linux. Each corresponds to one physical port.

The problem is to find out which /dev/ttyS* file belongs to which serial port.

'/proc/tty/driver/serial' file will display the current state of various modem signals (DTR, RTS, CTS etc) and number of bytes that have been sent and received

1.Connect TX and RX pins of any serial port
2. Transmit the data on  the first ttyS* (eg. ttyS0) file using echo
3. If the 'serial' file shows rx bytes it means that ttyS* is the file of the physical port on which TX and RX is connected
4. If there are no rx bytes, try the next ttyS* node (e.g ttyS1), until you find rx bytes on the 'serial' file


Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PR, PN and PV Variable in Yocto