Search code examples
serializationtcpportforwardingsocat

Serial port not working when using SOCAT in linux


I want to make a serial to ethernet and vice versa converter using Linux based board (Nano Pi board with Debian OS). For this I am using socat tool and making my board as TCP server. Using the below command in terminal I am Piping the serial port to TCP.

sudo socat TCP4-LISTEN:33888 /dev/ttyS1

The above code is working only when once the ttyS1 serial port was opened and closed with minicom with the default settings I saved before. I want to make it work by without opening minicom, so how can I set the serial parameters like baud rate, parity etc in the above command and how to make it to work automatically without opening minicom.

Please help me. And thanks in advance.


Solution

  • I achieved the serial to ethernet conversion using below command with socat tool.

    sudo socat TCP-L:33888 GOPEN:/dev/ttyS1,ispeed=4800,ospeed=4800,b4800,raw,echo=0