You need to log in to create posts and topics.

Serial Port component and virtual terminal like /dev/pts/12 on linux

Hi. I would like to test the link between a Serial Port component and a window terminal on Linux. I run the terminal with the command:

xterm -baudrate 9600

related with the virtual device /dev/pts/12. I used the same device as port name for the Serial Port. Also I connected the Tx and Rx of the Serial Port with the Rx and Tx of Arduino uno board and opened the Serial Monitor of both the Serial Port and the Arduino. I can open the Serial Port and the Tx and Rx became red but when I start the simulation, nothing appends.

What I am doing wrong?

Massimo

Hi.

I think you can't use the same port in xterm and simulide.
You need to create a link between 2 virtual serial ports and connect each app to one end.
For example in Linux you can use socat:

sudo socat PTY,link=/dev/ttyS1,mode=0666 PTY,link=/dev/ttyS2,mode=0666

Then connect xterm to /dev/ttyS1 and simulide to /dev/ttyS2

Hola,

I run as root:

socat -v   PTY,link=/dev/ttyS1,mode=0666   PTY,link=/dev/ttyS2,mode=0666

I connected

Screen (Linux)-> /dev/ttyS1

screen /dev/ttyS1 38400

I connected:

Serial Port (SimulIDE) -> /dev/ttyS2

I set Baudrate to 38400.

I started simulation and open the Serial Port of SimulIDE.

I verified that both serial port have 38400 baudrate:

root@margherita:/tmp# stty -F /dev/ttyS1
speed 38400 baud; line = 0;
min = 100; time = 2;
-icrnl -imaxbel
-opost -onlcr
-isig -icanon -echo

root@margherita:/tmp# stty -F /dev/ttyS2
speed 38400 baud; line = 0;
min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -iexten -echo

I wrote "Ciao" on the Screen terminal and I read "Ciao" on the right panel of Serial Monitor of SimulIDE. That is OK!

Socat prints:

root@margherita:/tmp# socat -v PTY,link=/dev/ttyS1,mode=0666 PTY,link=/dev/ttyS2,mode=0666
> 2025/02/05 02:54:17.509435 length=1 from=0 to=0
C> 2025/02/05 02:54:18.055627 length=1 from=1 to=1
i> 2025/02/05 02:54:18.199646 length=1 from=2 to=2
a> 2025/02/05 02:54:18.470713 length=1 from=3 to=3
o>

I wrote "Ciao" on the letf panel of Serial Monitor of SimulIDE but NOTHINGS appears on the the Screen terminal. Also socat doesn't print anything. The connection appears to be not bidirectional. Why?

Massimo