A Journey Into Unexpected Serial Ports

Through all the generations of computing devices from the era of the teleprinter to the present day, there’s one interface that’s remained universal. Even though its usefulness as an everyday port has decreased in the face of much faster competition, it’s fair to say that everything has a serial port on board somewhere. Even with that ubiquity though, there’s still some scope for variation.

Older ports and those that are still exposed via a D socket are in most case the so-called RS-232, a higher voltage port, while your microcontroller debug port will be so-called TTL (transistor-transistor logic), operating at logic level. That’s not quite always the case though, as [Terin Stock] found out with an older Garmin GPS unit.

Pleasingly for a three decade old device, given a fresh set of batteries it worked. The time was wrong, but after some fiddling and a Windows 98 machine spun up it applied a Garmin update from 1999 that fixed it. When hooked up to a Flipper Zero though, and after a mild panic about voltage levels, the serial port appeared to deliver garbage. There followed some investigation, with an interesting conclusion that TTL serial is usually the inverse of RS-232 serial, The Garmin had the RS-232 polarity with TTL levels, allowing it to work with many PC serial ports. A quick application of an inverter fixed the problem, and now Garmin and Flipper talk happily.

Linux Fu: Eavesdropping On Serial

In the old days, if you wanted to snoop on a piece of serial gear, you probably had a serial monitor or, perhaps, an attachment for your scope or logic analyzer. Today, you can get cheap logic analyzers that can do the job, but what if you want a software-only solution? Recently, I needed to do a little debugging on a USB serial port and, of course, there isn’t really anywhere to easily tie in a monitor or a logic analyzer. So I started looking for an alternate solution.

If you recall, in a previous Linux Fu we talked about pseudoterminals which look like serial ports but actually talk to a piece of software. That might make you think: why not put a piece of monitor software between the serial port and a pty? Why not, indeed? That’s such a good idea that it has already been done. When it works, it works well. The only issue is, of course, that it doesn’t always work.

Continue reading “Linux Fu: Eavesdropping On Serial”

Tio Is A Serial Terminal For Us

With Linux and the serial port there is good news and there is bad news. The good news is that Linux has great support for serial hardware of all sorts and a host of tools for accessing the serial port. That’s important when you use a lot of serial-like devices like Arduinos with USB ports and the like. The bad news is that most of the terminal software is made to accommodate the days when a computer had real serial terminals and modems with people interacting with them. We bet that’s why [lundmar] developed tio, a serial device I/O tool for people like us.

Honestly, how many times have you needed Zmodem file transfers and recognition of the DCD signal to detect an incoming connection? Sure there are many other programs that will do the job, but tio brings a clean simplicity along with functionality that embedded developers need.

The software will support arbitrary devices, show statistics, and give you control of the RS232 lines. There’s support for delayed characters and lines, useful if you are dealing with a super simple device with no handshaking. There’s also hex support and many ways to log data and statistics. We especially like that it can automatically reconnect which is a great feature.

Of course, you want some terminal features and tio includes those. For example, you can elect to have local echo turned on or map characters so that, for example, a carriage return turns into a carriage return and a line feed. You can use command line options to set up most items including features like redirecting to a network socket. Other commands inside the program — by default, triggered by Control+T — let you do things like send a break, toggle handshaking lines, and more.

You might think the serial port is dead, but it really just transformed into a USB port.  Of course, like everything else these days, you can also get your terminal in the browser.

DIY Wireless Serial Adapter Speaks (True) RS-232

There is a gotcha lurking in wait for hackers who look at a piece of equipment, see a port labeled “Serial / RS-232”, and start to get ideas. The issue is the fact that the older the equipment, the more likely it is to be a bit old-fashioned about how it expects to speak RS-232. Vintage electronics may expect the serial data to be at bipolar voltage levels that are higher than what the typical microcontroller is used to slinging, and that was the situation [g3gg0] faced with some vintage benchtop equipment. Rather than deal with cables and wired adapters, [g3gg0] decided to design a wireless adapter with WiFi and Bluetooth on one end, and true RS-232 on the other.

The adapter features an ESP32 and is attached to a DB-9 plug, so it’s nice and small. It uses the ST3232 chip to communicate at 3 V logic levels on the microcontroller side, supports bipolar logic up to +/-13 V on the vintage hardware side, and a rudimentary web interface allows setting hardware parameters like baud rate. The nice thing about the ST3232 transceiver is that it is not only small, but can work from a 3 V supply with only four 0.1 uF capacitors needed for the internal charge pumps.

As for actually using the adapter, [g3gg0] says that the adapter’s serial port is exposed over TCP on port 23 (Telnet) which is supported by some programs and hardware. Alternately, one can connect an ESP32 to one’s computer over USB, and run firmware that bridges any serial data directly to the adapter on the other end.

Design files including schematic, bill of materials, and PCB design are shared online, and you can see a brief tour of the adapter in the video, embedded below.

Continue reading “DIY Wireless Serial Adapter Speaks (True) RS-232”

Linux Fu: Serial Untethered

Serial ports used to be everywhere. In a way, they still are since many things that appear to plug in as a USB device actually look like a serial port. The problem is that today, the world runs on the network. Sure, you can buy a terminal server that converts a serial port to an Ethernet port, but what fun is that? In this article, I’m going to show you how to stream serial ports over the network using some available Linux tools. It isn’t perfect, and it won’t work for every case, but when it works it works well.

Everything is a File, Until it Isn’t

At some point in the past, Unix — the progenitor of Linux — treated virtually everything as a file, and all files were created more or less equal. Programs didn’t care if a file was local, on the network, from a tape drive, or arriving over a named pipe.

But things started to change. Even though a serial port is just a file under Linux, it has some special attributes that let you set, for example, baud rates. Worse, some programs “know” too much about files and insist on certain naming conventions. So, in theory, you should be able to create a network socket, connect one end to a serial port and the other end to a program, and be done with it. In theory.

Continue reading “Linux Fu: Serial Untethered”

No More Floppy Drives For This Agilent Scope

When [kiwih] picked up an Agilent 54621A scope, he was amused that it had a floppy disk. At one time, it was high-tech to use a disk to transfer scope data to your computer. Today, not so much. However, on the back was a serial port. Surely it was possible to read data from there. It is, and what results is a nice walkthrough of finding the port’s info and interfacing with it using Python.

Normally, you’d use the included BenchLinkXL software to grab data from the port, but that software is so old it would not run under Windows 10 or Wine. Searching didn’t turn up much on the serial port, but it did locate a manual for a similar Agilent scope. That manual wasn’t too helpful since it assumed you were connecting via a LAN or USB. However, it did make reference to an older model that was also similar and that was the key to finding a manual that did explain the serial port protocol.

The command set looks suspiciously like SCPI — Standard Commands for Programmable Instruments — which is a layer on top of the GPIB protocol. Many scopes speak that language, so that’s not surprising. That also means if you are in the mood to communicate with an SCPI scope, you might find the code useful, even if you don’t use a serial port or have this exact Agilent model.

SCPI has a lot of uses. For example, try talking to your scope. The cheap Rigol and similar scopes usually have SCPI and you can control and read them using the same kind of techniques.

Raspberry Pi Helps Vintage Psion Find Its Voice

Ask a hacker to imagine computing in the 1980s, and they might think of the classic 8-bit all-in-one machines from the likes of Commodore and Atari, or perhaps the early PCs and Macs. No matter the flavor, they’ll likely have one thing in common: a lack of mobility thanks to being anchored down by a bulky CRT screen in the form of either a television or a dedicated monitor. Mobile computing at the time was something of an expensive rarity, consisting of various quirky handhelds that today have been all but forgotten.

Looking to see if one of these so-called “pocket computers” could still be of use in 2019, [James Fossey] set out to get his circa 1986 Psion Organiser II connected to the Internet. With a Hitachi CPU, two-line text-only LCD and ABCD keyboard it’s a world away from the modern smartphone, yet as an early stab at a PDA as well as general purpose computer it’s visibly an ancestor of the devices we carry today. Of course, as the Psion was produced before the advent of affordable mobile data and before even the invention of the Web, it needed a bit of help connecting to a modern network.

Psion sold an RS-232 cable accessory which came with both serial terminal and file transfer in ROM, so with one of these sourced and a little bit of hackery involving an RS-232 to TTL converter and a DB-25 connector, he was able to hook it up to a Raspberry Pi. That means it’s reduced to being a dumb terminal for a more powerful machine that can do the heavy lifting, but those with long memories will tell you that’s exactly what would have been done with the help of a modem to connect to a BBS back in 1986. So far he’s got a terminal on the Pi and a Twitter client, but he’s declined to show us the Hackaday Retro Edition.

Psion has rarely featured directly on these pages, but despite being forgotten by many today they were a groundbreaking company whose influence on portable computing stretched beyond their own line of devices. One we have shown you is an effort to put more recent hardware into a Psion Series 5 clamshell.