Connecting an RS232 host to a USB device - Page 1
Forum section: electronics / projects

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 08:55:38 am
content: I'm very familiar with the normal USB to RS232 converter, use them all the time to connect new PC's with USB to legacy printers and barcode scanners with RS232.I'm now being asked to connect a new USB only printer to an old system that only has RS232 ports. This is new to me, is there an off the shelf solution that anybody can recommend?

author: LukeW
author_rank: Frequent Contributor
timestamp: September 01, 2015, 09:22:53 am
content: Sounds nontrivial. Best bet may be to look at getting a PCI card or similar with USB host ports.What does the old PC have, in terms of internal card slots such as PCI?

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 09:41:11 am
content: Trivial:http://microcontrollershop.com/product_info.php?products_id=5031thanks to an EEV member who contacted me direct, much appreciated.

author: Balaur
author_rank: Unknown
timestamp: September 01, 2015, 10:23:30 am
content: Useful device and it seems to integrate easily and without troubles in an existing set-up.The price is interesting though.I guess that a Raspberry Pi enthusiast will quickly tell you that it's trivial to set-up a print server connecting the USB printer to the RPi and some kind of script to copy incoming serial data to the CUPS server (or whatever passes for a printing system these days). You'll also spend the better half of the day trying to make that work.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 10:29:13 am
content: Cheaper here, just ordered 2:https://eshop.t-online.de/epages/Store6_Shop10552.sf/sec0bc80e6964/?ObjectPath=/Shops/Shop10552/Products/SER2USBBut I don't care much about the price. Raspberry Pi based solution fills me with horror, so much time and effort and extra connectors to make, cases to find, power supply problems.... just NO!

author: Siwastaja
author_rank: Super Contributor
timestamp: September 01, 2015, 04:25:11 pm
content: As this problem indeed is nontrivial, the product in question is not any kind of "adapter" or "cable", but an active software product that only can support some printers. This is explained behind the link you gave, but just as a reminder, it will only work on some printers, but it's not a drop-in solution because some printers require their own, custom drivers and you cannot install them on the PC (your RS232 host); the support must be in that converter product. So better check first if the potential printers are compatible. The "linux driver" hint is a clue, but not a definitive answer; some printers may have a linux driver available, but still use their own custom communication.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 05:56:19 pm
content: Thank you for your comments, but the printers I have to connect to are intelligent devices that don't require drivers.They work on a well defined ASCII protocol using high level commands to generate position text and barcodes. All character/bitmap generation scaling and rotation is carried out internally. All I do is throw a text file at them and out pops a label, just the kind of trivial application these devices seem to be intended for.

author: nctnico
author_rank: Super Contributor
timestamp: September 01, 2015, 06:16:00 pm
content: Quote from: TopLoser on September 01, 2015, 08:55:38 amI have designed something like that for one of my customers (no, it's not Raspberry Pi based) but depending on the printer it may need extra work to support the printer's USB protocol. How many do you need?

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 06:28:51 pm
content: Quote from: nctnico on September 01, 2015, 06:16:00 pmGrand total of 1. For a factory in Slovakia so I need something simple and that I can test in the office and ship out knowing it 'just works'. I bought 2 so I can have one in the office as a spare and so I can do any additional troubleshooting in the future.As I said, it's not about the cost. I want it NOW and I want it to WORK! lol

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 06:32:04 pm
content: Quote from: TopLoser on September 01, 2015, 05:56:19 pmMaybe the old serial printers were, but have you ever used one of the new USB printers that you're trying to interface with now? What's the protocol? If you plug it into a Linux system, what does it enumerate as? Does it require drivers? Are they built into the Windows kernel? Linux kernel?

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 06:48:34 pm
content: Quote from: suicidaleggroll on September 01, 2015, 06:32:04 pmYou're all making this far more complicated than it is. It's a Zebra printer and the protocol is ZPL. It's the same old ZPL I used to throw down the old printers RS232 port that I now need to throw down the new printers USB port. This isn't a stripped down printer that requires a host PC to do all the bitmap generation.I don't have a Linux system and have no intention of mucking about with one! The PC I'm using has ISA slots and runs DOS 6.22 so any suggestion of sticking PCI cards with USB ports on is is falling on very stoney ground!Heaven forbid I ever have to take any of you on site, it's a shitty old world of pain I have to support out there!

author: Monkeh
author_rank: Super Contributor
timestamp: September 01, 2015, 07:05:02 pm
content: Quote from: TopLoser on September 01, 2015, 06:48:34 pmAnd the device you've bought is expecting to speak PCL, not ZPL.

author: SeanB
author_rank: Super Contributor
timestamp: September 01, 2015, 07:12:42 pm
content: I am sure you can still buy the Zebra printers with 3 ports. USB, serial and centronics. Last one I got at work had all 3 ports, so they must still sell them, as many places that use them still use a mainframe or mini to do the stock inventory. Nice printers, you just have to clean the rollers and heads every so often.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 07:13:45 pm
content: Quote from: Monkeh on September 01, 2015, 07:05:02 pmIt's capable of passing through PCL commands, amongst other protocols.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 07:16:05 pm
content: Quote from: TopLoser on September 01, 2015, 06:48:34 pmNo, you just think the problem is much simpler than it actually is. See here:https://km.zebra.com/kb/index?page=content&id=SO8411&actp=LISTQuoteThe USB port IS NOT just an RS232 port in disguise where you just need a simple adapter. Going the other way, from a USB host to an RS232 device, is simple. Going this way is NOT. See that quote...this is a real USB device that needs real USB drivers running on the host. You WILL need a smart adapter that's capable of enumerating that USB device and translating your ZPL RS232 commands for it, with all of the necessary drivers for that device built in.

author: nctnico
author_rank: Super Contributor
timestamp: September 01, 2015, 07:17:17 pm
content: Quote from: TopLoser on September 01, 2015, 06:48:34 pmStill the data needs to be wrapped into USB packets which requires a protocol at the USB level. Each USB device needs its own driver because each device has its own way of packing data into USB packets. A USB device to serial converter needs to implement the specific USB protocol of the printer in order to create the serial stream at the RS232 end. In the devices I have made I run a USB host stack + device specific driver to do that.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 07:20:19 pm
content: Quote from: SeanB on September 01, 2015, 07:12:42 pmYou can - the ZM600 for example. That has Ethernet as well, nice printer.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 07:22:55 pm
content: Quote from: nctnico on September 01, 2015, 07:17:17 pmThat's what the bloody adaptor is supposed to do. Why do I need to have drivers when all I have is an RS232 connection to send ASCII strings down?

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 07:25:16 pm
content: Quote from: TopLoser on September 01, 2015, 07:22:55 pmThe adapter needs to have the drivers, not your computer. You need an adapter that's designed to translate serial data to USB for that exact printer, that's the problem.

author: Nerull
author_rank: Frequent Contributor
timestamp: September 01, 2015, 07:25:44 pm
content: Quote from: Monkeh on September 01, 2015, 07:05:02 pmFrom my reading the device doesn't speak anything, it just translates the data stream from RS232 to USB. These printers expect a stream of text in the form of a command language, but that command language must be implemented on the PC side, it isn't done by the device. It just passes on the text it receives. The USB ports on these printers are just USB-to-Serial converters.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 07:27:31 pm
content: Quote from: Nerull on September 01, 2015, 07:25:44 pmExactly. Bonus points to that man.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 07:28:23 pm
content: Quote from: suicidaleggroll on September 01, 2015, 07:25:16 pmNo.

author: Monkeh
author_rank: Super Contributor
timestamp: September 01, 2015, 07:30:32 pm
content: Quote from: TopLoser on September 01, 2015, 07:27:31 pmOr at least that's the hope. Actual documentation seems to be fairly scarce.Let us know if it works.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 07:32:55 pm
content: Quote from: Nerull on September 01, 2015, 07:25:44 pmAre you sure about that? Why would they need their own drivers? That's why I asked him to plug the device into a computer so he could see what it enumerates as, which he aggressively refused to do for some unknown reason. If it just enumerates as a TTY/COM port, then yes it could be simple, but he needs to do some testing to see if that's true.

author: Monkeh
author_rank: Super Contributor
timestamp: September 01, 2015, 07:38:51 pm
content: Quote from: suicidaleggroll on September 01, 2015, 07:32:55 pmThat is not what you asked him to do, and the reason was quite clearly stated.

author: nctnico
author_rank: Super Contributor
timestamp: September 01, 2015, 07:40:31 pm
content: Quote from: TopLoser on September 01, 2015, 07:28:23 pmThat is the problem (as I wrote before) but you'll find out soon enough

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 07:41:29 pm
content: Quote from: Monkeh on September 01, 2015, 07:38:51 pm*facepalm* That's EXACTLY what I asked him to do...Quote from: suicidaleggrollI feel like that's pretty straight forward...the only reason I suggested Linux is because drivers for these things are typically built into the kernel, where as for Windows you need to install 3rd party drivers, and you can't easily watch the enumeration.To make it clear:The device speaks USB. Plug it into a USB port on a computer that also speaks USB, see what the device enumerates as and what drivers are required. That will let you know what your adapter needs to be capable of.

author: Monkeh
author_rank: Super Contributor
timestamp: September 01, 2015, 07:45:12 pm
content: Quote from: suicidaleggroll on September 01, 2015, 07:32:55 pmQuote from: suicidaleggrollQuotePlease cease being arrogant and condescending. It does not help anyone.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 07:54:41 pm
content: Who's being arrogant and condescending?Quote from: TopLoser on September 01, 2015, 06:48:34 pmQuote from: TopLoser on September 01, 2015, 07:28:23 pmEither way, I'm out. Have fun.

author: Balaur
author_rank: Unknown
timestamp: September 01, 2015, 07:59:22 pm
content: Quote from: suicidaleggroll on September 01, 2015, 07:41:29 pmThat device is an USB Host. It cannot be directly plugged into a PC.It has an USB to UART bridge and will be able to enumerate devices that follow the USB Communication Device Class Definition for Printer Devices.The incoming RS232 data will be directly copied to the USB Bulk OUT endpoint. This data can be anything.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 01, 2015, 08:00:11 pm
content: Quote from: Nerull on September 01, 2015, 07:25:44 pmEven if true, USB-to-Serial convertersstill need drivers, and the adapter he uses will need to have drivers built in to handle the USB-to-Serial converter being used inside the printer.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 09:35:19 pm
content: Quote from: suicidaleggroll on September 01, 2015, 08:00:11 pmStop digging please.

author: TopLoser
author_rank: Unknown
timestamp: September 01, 2015, 09:40:08 pm
content: Quote from: Balaur on September 01, 2015, 07:59:22 pmYou're a breath of fresh air, even more bonus points

author: TopLoser
author_rank: Unknown
timestamp: September 03, 2015, 03:08:38 pm
content: Quote from: Monkeh on September 01, 2015, 07:30:32 pmThe converter arrived a few minutes ago.I took the existing PC RS232 output cable and connected it to the converter. Plugged the converter USB plug into the new printer USB socket and applied power. No configuration, no drivers, no fuss.But did it work? I asked the existing PC application software to reprint a label to the RS232 port and the printer promptly spat out a label, exactly like the old printer used to.So yes it works with no configuration or drivers, it even auto-detected the baud rate without any intervention from me.100% satisfied, worth every penny.

author: nctnico
author_rank: Super Contributor
timestamp: September 03, 2015, 04:03:15 pm
content: Appearantly Zebra used the standard printer USB device class. Lucky you!

author: TopLoser
author_rank: Unknown
timestamp: September 03, 2015, 04:29:46 pm
content: Quote from: nctnico on September 03, 2015, 04:03:15 pmWorking my way round the office so do Intermec, Datamax, Sato and even a cheapo Brother thing. I guess there's a good reason why there is a standard printer USB device class - for printers and any other device that just needs data feeding to/from it.

author: suicidaleggroll
author_rank: Super Contributor
timestamp: September 03, 2015, 04:59:54 pm
content: Quote from: nctnico on September 03, 2015, 04:03:15 pmIndeed, glad it works