Serial Port Emulation

I'm working to improve a test program for the hardware I use to test some b oards I make. These boards are tested using a test fixture controlled over an RS-232 port from the PC. So I don't need to lug hardware around with m e I emulate the test fixture on the same PC I run the test program. I need comm port emulation software that will emulate a bridge between two serial ports to connect the test program and the test fixture emulator.

One I've been using is called, oddly enough, "Free Virtual Serial Ports". It is free to use, but only in a limited configuration which will do the jo b, but just barely. I have also noticed that if my programs are not closed properly (or some other cause) this bridge software will hang one of the p orts.

I don't want to emulate the serial port connection in my test fixture emula tor because if I take the program down a lot while testing, I will have to continually restart both the test program and the emulator program. There are a few initialization steps that become tedious after doing them a few d ozen times.

Is there a serial port bridge program that works well and is not expensive?

Rick C.

Reply to
gnuarm.deletethisbit
Loading thread data ...

Have you considered simply having two serial ports and connecting them physically? It might not be quite as elegant as a "virtual" solution, but it would be very realistic (regarding timing and such). A couple of FTDI cables would cost something like $10.

If you are running Linux, a "virtual serial port" is just a pipe, if you don't need virtual baud rates and the like. Windows is always more complicated - I am afraid I don't know of any suitable software as I've never had the need.

Reply to
David Brown

Hardware seems like the best route, since that includes modem control lines, xon/xoff etc. Many laptops don't have serial ports these days, but all Panasonic Toughbooks do. There are also usb to serial and network based serial ports available and have used both in the past with no issues, StarTech making some of the best "work out of the box" examples...

Chris

Reply to
Chris

Get a USB serial port adapter and a null modem cable, so the test program does see any difference.

The virtual serial ports are probably more part of the problem set than part of the solution set.

--

-TV
Reply to
Tauno Voipio

Den 2019-02-17 kl. 11:08, skrev snipped-for-privacy@gmail.com:

Why not have a switch so that you open a socket instead of a serial port?

BR AP

Reply to
A.P.Richelieu

"Null modem cable" ? He doesn't need RS-232 converters and 9-pin DSUBs here. A couple of USB to TTL Uart cables is what he needs, with the wires tied together.

Reply to
David Brown

duminic?, 17 februarie 2019, 12:08:11 UTC+2, snipped-for-privacy@gmail.com a scris:

boards I make. These boards are tested using a test fixture controlled ov er an RS-232 port from the PC. So I don't need to lug hardware around with me I emulate the test fixture on the same PC I run the test program. I ne ed comm port emulation software that will emulate a bridge between two seri al ports to connect the test program and the test fixture emulator.

It is free to use, but only in a limited configuration which will do the job, but just barely. I have also noticed that if my programs are not clos ed properly (or some other cause) this bridge software will hang one of the ports.

lator because if I take the program down a lot while testing, I will have t o continually restart both the test program and the emulator program. Ther e are a few initialization steps that become tedious after doing them a few dozen times.

e?

Google for "com0com"

Reply to
raimond.dragomir

On Monday, February 18, 2019 at 12:56:14 AM UTC-5, snipped-for-privacy@gmail.com wr ote:

a scris:

me boards I make. These boards are tested using a test fixture controlled over an RS-232 port from the PC. So I don't need to lug hardware around wi th me I emulate the test fixture on the same PC I run the test program. I need comm port emulation software that will emulate a bridge between two se rial ports to connect the test program and the test fixture emulator.

". It is free to use, but only in a limited configuration which will do th e job, but just barely. I have also noticed that if my programs are not cl osed properly (or some other cause) this bridge software will hang one of t he ports.

mulator because if I take the program down a lot while testing, I will have to continually restart both the test program and the emulator program. Th ere are a few initialization steps that become tedious after doing them a f ew dozen times.

ive?

Yes, that was the one I had used before and it still seems to work just as well. Thanks! :)

Rick C.

Reply to
gnuarm.deletethisbit

Most of the off-the-shelf USB serial dongles have the 9 pin connectors with RS-232 DTE signals, which do need null modem to connect together.

--

-TV
Reply to
Tauno Voipio

I guess it depends on which shelf you look on :-)

It is /many/ years since I have had need of an RS-232 serial dongle. But TTL level UART to USB converters - we go through these at a high rate. Adding standard RS-232 to a board is big and expensive - you need RS-232 drivers and a bulky DSUB connector, and then the cables. Adding a TTL level UART is practically free - you need the Tx and Rx pins on the microcontroller (many of which have several UARTs - finding one spare is not nearly the challenge it used to be), and you need a 3-pin header. For convenience, when we have the space, we use a 6-pin header that matches the FTDI cables.

So /my/ shelf has lots of FTDI TTL-level UART cables - and a single RS-232 dongle gathering dust in the corner.

Reply to
David Brown

You might want to take a look at a logic analyzer. E.g. at banggood.com search for "USB logic analyzer 8ch" . There is an 8 channel one for $10, and there is a software download presumably with protocol analysis of various protocols, if I look at the documents. If you scroll a little down, there is a "8. infos download from here" which gets you a .rar file of 57M. In it are installers for various OSses (Win, Mac, Ubuntu), and PDFs. What I cannot determine is which input voltages it allows. Scrolling down further on that page are some FAQ from which I gather that it does not handle 12V, 3.3V and

1.8V , so presumably TTL level only (0 or +5V). In that case, you might need level converters such as from Maxim. There are also such things on Banggood, search for 3-5V RS232 to TTL converter, or equivalent. I don't have the analyzer myself, just stumbled across it. The price is certainly OK!

Mat Nieuwenhoven

Reply to
Mat Nieuwenhoven

I think if you look at what is commercially available, the most common device is RS232 levels, not TTL, because most commercial devices you want to talk to that have an external connector us RS232 levels, TTL is mostly used internally or known very short distances.

With the advent of things like the Raspberry Pi, Arduino, and the like, the TTL version is getting more common, but those still mostly show up in electronic specialty shops, while the RS232 version show up many more places (like the electronics department of office supply stores, or even hardware stores).

Reply to
Richard Damon

RS-232 is short distance too (though a bit longer than TTL) - for long distances you use RS-485 or RS-422. RS-232 is a legacy standard - there is plenty of old stuff the still has it, but it would be a strange choice for anything new.

It is so many years since RS-232 has been in common use that I'd be surprised to find many real shops stocking dongles. But I agree that you are more likely to find one in a big computer shop than to find a TTL level UART dongle. However, this is comp.arch.embedded, and people here will already have shops, suppliers, webshops, etc., for which TTL level cables are on stock.

Reply to
David Brown

re

lug

will

at if

that

with

The RS-232 adapters are much easier to locate. RS-232 is not hard to add t o any circuit, it's just one chip and a very common chip at that. Adding y et another special connector that has to be documented and shown to an oper ator is even more work. The DB-9 serial port connector is still very commo n and not used for much else so hard to mix up with anything else.

My only regret is not using a right angle connector on the board so the cab le didn't stick up in the air, but rather laid flat.

But none of that is important at this point. I found the com0com software that lets me use the test fixture emulator without any hardware at all, inc luding the USB serial port adapters. Yea!

Rick C.

Reply to
gnuarm.deletethisbit

On 2019-02-18 David Brown wrote in comp.arch.embedded:

That's what we do as well if space allows it! Just so much easier to order an FTDI cable from (for example) Farnell and plug it straight in instead of having to mount your own connector.

I use both types quite often.

--
Stef    (remove caps, dashes and .invalid from e-mail address to reply by mail) 

"Ninety percent of baseball is half mental." 
-- Yogi Berra
Reply to
Stef

I'm genuinely interested to hear people thoughts on this. Personally if I anticipate a true long life interfacing requirement - 20, 30,

40 years - RS232 is my preferred option, ideally (if appropriate to the use case) with a command line on it. My rationale has always been that RS232 isn't going anywhere, terminal emulators are always going to be around, so that combination makes fewest assumptions about hardware or software. Even if serial ports are no longer standard equipment they'll always be easy enough to add and at moderate cost. The relative simplicity of the technology and the simplicity of the host software makes me feel sure of that.

It's also what's always made me feel slightly uneasy about USB. In many ways it is a nice standard but it depends on quite a thick layer of software on the host side. If it falls out of favour and support gets dropped over time re-adding that software layer is problematic even if the hardware is to hand.

It may seem difficult to imagine now but I can see it coming - try reading the original USB spec and seeing what a big play it makes of the single cable with just one upstream and one downstream connector. Now there are so many possible combinations of port and cable it makes parallel SCSI look posivitely straightforward. And yes, I do see this creating confusion among non-technical users: the original B plug has been poorly recognised for years, and I've heard a few people recently see an A plug and respond along the lines of "No, that's a charger plug, I need a _USB_ plug...". Full size A sockets are already disappearing from laptops, in a few years someone is bound to drop USB entirely in favour of something else to "improve" things for the consumer.

The software issue is similar for the other hardware that I can't see disappearing, namely ethernet. Specific media may change in popularity but you should be able to interface older stuff easy enough, just as it still isn't _too_ difficult to track down a

10Mbit hub with AUI and/ BNC connectors if you need modern stuff to connect to coax. My concern there it that we'll be transitioning to IPv6 any decade now. Realistically when is imposssible to predict but I feel sure once a certain critical mass develops IPv4 will seem obsolete in 5-10 years. If we use that in our though processes large amount of equipment and plant may well not be even halfway through its expected life when that timespan elapses. Dual stack is one possibilty but I'll admit I don't understand IPv6 well enough yet and I don't like the sound of the complexity.

I don't pretend to have answers in the general case, just interested in what peoples thoughts are.

--
Andrew Smallshaw 
andrews@sdf.org
Reply to
Andrew Smallshaw

e

You raise some interesting points. I don't know how easy it is to add RS-2

32 to a PC other than through a USB interface which adds back all those lay ers of software even if you don't need to deal with them. The last RS-232 board I've seen was for the PCI bus which is no longer used in PCs.

Even so, desktops are waining and laptops are sold in much greater numbers. I wouldn't design anything that required a desktop to work. So I think y ou are stuck with USB either as the actual interface or an intermediate int erface.

I think there is nothing any other interface can do better than USB other t han possibly wireless. USB is fast and stable and here for the long haul. Heck, it has ramped up from 1.0 to 1.1, 2.0, 3.0, 3.1... what is going to replace it? The type C connector is a significant improvement and with eno ugh time will become the dominant interface although I think displacing the type A connector will take a long time. As you say, it's a charger defact o interface.

It's dual stack now. There is nothing that will make IPv4 become inoperabl e. Just as the routers hide the IP address of local devices, IPv6 can be u sed in the entire rest of the world and IPv4 can be used locally.

I expect USB will survive for decades more even if only to interface to mic e and printers. In fact, newer laptops seem to have more USB connectors wi th many having four while the typical number used to be three.

I'm just glad the PCMCIA interface is gone.

Rick C.

Reply to
gnuarm.deletethisbit

The problem with both TTL and RS-232 is the ground potential issues. Any ground potential noise will directly deteriorate the noise margins. High speed RS-232 is also problematic, since the impedance levels are too high for typical cable impedances.

No such problems with RS-422/485, but of course common mode voltage range must be considered and galvanic isolation may be needed.

Looking back, RS-232 and 20 mA was popular. The nice thing about current loops was that you nearly always had galvanic isolation (relays, optoisolators).

These days, many even small microcontrollers have Ethernet interface. In a simplest cases just use raw MAC frames or UDP . Surprisingly small micros have web servers, so they have at least a rudimentary TCP stack.

The ARP (Address Resolution Protocol) program for mapping between MAC and IPv4 addresses is less than one page long, the MAC to IPv6 mapping shouldn't be much more complex.

Reply to
upsidedown

It is very easy with Ethernet to RS-232/422/485 converters. I have used 1, 2, 4 and 8 line Moxa serial line converters and I think 16 line modules are also available. Just point Telnet to the converter IP-address and use it as Hyperterminal :-).

A large system had one Ethernet cable feeding seven 8 line Eth(RS-232 converters feeding 50 RS-232 to current loop converters controlling

50 legacy devices. Early smaller systems used a few dozen serial lines directly from two PCI RS.232 cards. That was a nasty bundle of serial cables coming out of the PC :-), but the largest system had only one additional Ethernet port.

Better design for smart phone controllability. That would be wireless and Ethernet.

Reply to
upsidedown

There are still plenty of choices for PCI-express serial boards (up to

32-ports per board):

formatting link

They're generally available with up to 32 ports:

formatting link

Disclaiming: my employer makes the PCI-express boards and Ethernet attached serial ports linked to above, and I maintain Linux drivers for them and the firmware for the Ethernet-attached products. [The Linux drivers all support up to 256 ports.]

That said, modern USB-attached serial ports all seem to work fine. At least under Linux, the kernel has had built-in drivers for all the popular chipsets for decades.

--
Grant Edwards               grant.b.edwards        Yow! Like I always say 
                                  at               -- nothing can beat 
                              gmail.com            the BRATWURST here in 
                                                   DUSSELDORF!!
Reply to
Grant Edwards

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.