There is an application which wirtes to a serial connection and reads from a serial connection. I am testing it and can not change it. My test environment contains two computers and applications on that two computers send something to each other over the serial connection. I want to create a pseudo serial connection in order to test on only one computer. So that, one application will write to that pseudo serial connection and the other one, which is on the same computer, will read it.
Is such a pseudo serial connection possible? My test computer has only one serial connection but if it is required I can use a virtual machine which has got two serial connections.
i found this com0com. http://sourceforge.net/projects/com0com/files/com0com/3.0.0.0/
It will create two virtual serial ports. You can test it by using two Putty windows. Just chose different COM port.
Let me know if it was helpful.
You could use USB-to-RS232 adapters to get additional COM ports. Hook your two COM ports together with a null modem cable. Then your test program can open one port and talk to your app under test.
Related
I need to write a program (C++) that uses a serial port to communicate with another device. The other device isn't even built yet so I need a software emulator For various reasons there is no point going into here, the software emulator needs to run on a different machine. I would like to send the data via UDP from the software emulator to the machine my program is running on and have it received by another serial interface type program that in some way acts as a serial port (serial tty device).
I also want to test my program in an automated fashion in a VM. Ideally my test program would also use UDP and would use the same UDP-serial interface program to forward the data back and forwards between my test program and the program under test.
Time is very tight. I don't really have time to learn to write and install kernel level device drivers.
I would be very grateful for any pointers as to how I can create some sort of "pipe" or "loopback" pseudo-serial device.
I am working on Linux.
Credit to meuh for his tip-off.
socat UDP:127.0.0.1:5001,bind=127.0.0.1:5000 \
PTY,link=/dev/ttyS0,raw,echo=0,waitslave
This listens on UDP port 5000 on the loopback network interface. All data received is sent to the virtual serial device at /dev/ttyS0. All data received on the virtual serial device is sent to UDP address 127.0.0.1:5001.
The IP address can be remote.
The command must be run as root, as must the process connecting to the serial port. To avoid this use a different file path, e.g. /tmp/ttyS99.
Apparently the file path specified must not already exist. However my PC has /dev/ttyS0 all the way to /dev/ttyS31 despite not having any serial ports, and using /dev/ttyS0 works fine. I suppose if I actually had a real serial port this wouldn't work.
I am writing a python pyserial app and need to debug it. It is not getting anything on its rx beyond the prompt. I would like to open up a parallel minicom on same tty and be able to see the port rx.
Is this possible without hardware logging ? Can I simply use a serial settings to allow 2 apps to run simultaneously on ttyUSB0 ?
Short answer: No, you can't access your serial ports from two processes at the same time.
There are workarounds that can give you a much cheaper solution than purchasing a hardware sniffer or a scope with serial decoding capabilities though.
You will have to define a couple of virtual serial ports and use port forwarding. This procedure has been explained here: on Linux and Windows 1, 2.
I am writing two applications one is continuosly listening to "COM3" port and printing data.
When i run other application which should write to that "COM3" port i am getting error serial port does not exist for writing.
can 2 applications open handle to access the same serial COM port in our system at the time
This is not possible, Windows doesn't allow a serial port to be shared between processes. Once one process opens a port, another will get error 5 (access denied) when it tries to open the same port. Serial ports are far too primitive to allow any kind of sharing protocol.
You need a null modem. Either in hardware by using two ports, connect RxD to Txd. Or in software, a device driver that emulates serial ports. Like this one.
I am trying to use scilab for a project and I need to pass on some values to a robot via a serial port.
I had done this successfully on Matlab. I have ported almost everything to Scilab now but I don't know how to pass those parameter through serial port.
On the Sclilab site there are some modules, but they only work under Windows
http://atoms.scilab.org/
I am the maintainer for the Serial Communication toolbox in Scilab. This works on Linux as well. You can find it here: http://atoms.scilab.org/toolboxes/serial. This is fairly easy to use- it has functions to establish communication with the serial port, to read from and write to the serial port, and to terminate communication with the serial port. Please let me know about any feedback or questions you may have. Thanks.
Well, there are two pc's connected via Wi-Fi and one of those (let's call it A) has a serial port printer (in ttys0) and a measure serial port device (in ttys1) connected too. So B needs to read some values from the mesure device connected on A and then write to the printer connected on A using a network connection.
ser2net is a good solution for this
aptitude install ser2net
Then edit the config in /etc/ser2net.conf
You can then make a tcp connection to a defined port and be connected to the serial port on the remote computer - very useful.
I don't know if Ubuntu has anything built-in, but you could run a couple of daemons using netcat. Of course, if you want it to be secure, you'd need to do a little more work.