2012-12-16 20.26.28

Vintage Digital VT420 Terminal on Raspberry Pi

My first gig straight out of school involved supporting a large group of CAD drafters and engineers at a government facility. We used several different CAD systems at the time – AutoCAD on PC, DEC CALMA on Vax 11/785, and HP ME10 on quirky HP Apollo running UCSD P-System. Drafters using all of these systems submitted plot jobs to a big old Calcomp large-format electrostatic plotter. When I first took the job this was very much a manual process. The PCs were running a custom Ungermann-Bass network (ethernet came along a bit later) and plot jobs were sent to a central server on the network. I quickly grew tired of manually copying plot files around and developed a plotter queue application in C which would monitor a network share and automatically queued jobs to the plotter. The PC users loved it, as they got their hardcopy much faster than they had previously. The DEC and HP users quickly became jealous and begged me to extend this service to include them. A couple of classes and a lot of reading led to a very nice solution written in VAX assembly; the CALMA drafters got their plots much faster and the company ended up with another trained system admin for the 11/785.

Most of this initial development work was performed on Digital VT320 terminals. I always preferred the amber screens to green; they were much easier on my eyes, especially in the low-light environment that CAD drafters of the era preferred.

Fast forward a couple of decades. Sitting on my desk I have a $35 computer the size of a deck of playing cards with processing power an order of magnitude beyond that of the slightly more expensive VAX 11/785 that I used to support. What a cool industry.

A couple of weeks ago I was perusing eBay looking for treasures when I stumbled across an auction for a slightly used DEC VT420. The price was very reasonable, as was shipping. Since my Raspberry Pi is currently running headless, I thought it would be fun to put these two together and document the process. It was MUCH more straightforward than I had previously imagined.

The VT420 is a bit more modern than the 320 that I had used back in the day. The biggest advantage that I could see for this project is the 420′s multi-session support – it supports a whopping TWO SIMULTANEOUS SESSIONS running in either full-screen or “windowed” (split-screen) modes. The terminal supports text widths of 80 or 132 columns, and 25, 32, or 48 lines. Sweet!

Physical Connections

My terminal has two DEC MMJ (Modified Modular Jack) jacks on the back rather than the more ubiquitous DB9 or DB25 connectors that you may be accustomed to. From a purely physical standpoint, the MMJ jack looks like a 6-pin RJ45 with an offset latch connector. Fortunately, adapters are available online; I was able to find MMJ cables and DB9 adapters from a local firm, Pacific Custom Cables. If you are following along at home, I picked up two of each of the following: part number BC16E (DEC423 office cable, 3 foot length) and part number A9F12D (DB9F to DEC MMJ adapter). The office cable is available in custom lengths and is already configured as a null-modem (AKA “Crossover”) cable. The adapter has a molded-in female MMJ jack on one end and comes with a modular DB9F plug so you can configure the connection however needed. The following table shows how I wired the adapter:

MMJ Pin Color Desc DB9 Pin
6 White DSR 7
5 Black Rx+ 2
4 Red Rx- 5
3 Green Tx- 5
2 Yellow Tx+ 3
1 Blue DTR 8

Note: The offset tab on the MMJ connector is over pins 4-6. I clipped the metal socket off of the red pin and soldered it to the green pin prior to inserting it in the DB9 housing. For those interested in specific electrical details of this configuration, there is an excellent overview available at lammertbies.nl

I opted to use a USB-Serial adapter for this solution rather than using the on-board UART. There are many options available here – I’ve used several different Keyspan adapters with Linux in the past with excellent results. Since I did not have a spare adapter handy, I rolled the dice and ordered a cheap ($14 with free shipping) dual USB-to-RS232 adapter from eBay. The device I picked up did not claim Linux compatibility and is listed as a “Syba SY-ADA15033″ adapter. Turned out to be a good call – the Pi recognizes the device as an “IOCrest dual USB to serial adapter SY-ADA15033″; lsusb shows device ID 067b:2303, which is a Prolific Labs PL2303 chipset. Painless install; the Pi automatically loaded the pl2303 driver and created /dev nodes ttyUSB0 and ttyUSB1.

Configuring the Raspberry Pi

I am running the excellent Occidentalis Raspberry Pi distribution from the folks at Adafruit on my Raspberry Pi. Since this distribution is based upon Raspbian Wheezy, I would expect the setup instructions to be virtually identical.

This distribution did not ship with a termcap/terminfo file for the VT420. The requisite file(s) can be installed easily by installing package “ncurses-term” with apt-get or aptitude.

I added the following two lines to my /etc/inittab:


T0:2345:respawn:/sbin/getty -L ttyUSB0 19200 vt420
T0:2345:respawn:/sbin/getty -L ttyUSB1 19200 vt420

Just for fun, I also created a new pi-themed /etc/issue file. This is based upon a file sent to me by a friend who did not remember where he found it – if you happen to know the source, please let me know so I can properly attribute the source!

Configuring the VT420

Pressing F3 brings up the VT420 configuration screen.


The initial screen is the setup directory – you will need to select “save” after making changes to store your settings in non-volatile memory.


Global setup screen. The important setting here is “S1=Comm1, S2=Comm2″. This enables session control for our two serial lines.


Display setup. This screen allows you to specify number of columns (80 or 132) as well as number of lines (24, 36, or 48). Each session can be configured independently.


General setup. It’s important to select “VT400 Mode, 7 Bit Controls”, especially if you use Emacs, or your arrow key behavior will be really messed up.


Communications setup. I selected 19200, 8 bits, no parity, 1 stop bit.


Keyboard setup. I set F1, F2, and F5 to “FKEY”, leaving F3 set to “Set-Up” and F4 set to “Session”. I’d recommend this configuration if you’re using multiple sessions (more on this later). The rather odd setting labeled “,< and .> Keys” needs this configuration if you ever want to be able to type the “greater than” or “less than” symbol; the default configuration does not generate these characters.

Beautiful Results


The login screen is gorgeous and is based upon ASCII art sent to me by a friend. If you happen to know of the origin, please let me know so I can give the author proper attribution – he didn’t remember where he found it.


Emacs at 80×25. Works like a charm. You can switch between the two sessions by pressing the F4 key.


Pressing Ctrl+F4 toggles between full-screen and windowed sessions. “Windowed” is a bit of a misnomer here – it really is just a split-screen view. The split can be resized via Shift+F4+Arrow keys.


This picture shows session 2 displayed at 132 columns by 48 lines.

Issues, Problems, Etc.

So far I have ran into surprisingly few issues. I initially wasted several hours trying to get things configured with absolutely no success until I realized that you simply cannot run agetty from a user shell, even as root – THIS DOES NOT WORK. After beating my head against the wall for an inordinate amount of time I remembered fighting this exact same battle way back in 1998 or so with an old DEC VT100 terminal and Linux. Once I added the entries to /etc/inittab it just worked.

Flow control is a problem. While the cable does indeed pass through DSR/DTR and XOFF is configured, fast updates such as directory listings will often contain garbled characters. If anyone has a solution to this particular problem I’d love to hear about it.

I had hoped to use tmux to run multiple sessions, but I’m an emacs user and tmux changes the $TERM environment variable to SCREEN for some reason, which causes emacs to flip out over control characters (backspace and arrow keys). There’s probably an easy fix for this but tmux was a nicety in any case.

Summary

I really love this terminal. I spent many, many hours writing code on a nearly identical terminal at the beginning of my career, and there is something very comforting about returning to this configuration with my Raspberry Pi. Since this Pi is destined to become the central controller for my home automation solution, it will remain attached to this terminal. I hope that others find this blog post useful and give a new home to a VT420 or similar terminal with their Raspberry Pi. Have fun!

6 thoughts on “Vintage Digital VT420 Terminal on Raspberry Pi”

    1. I haven’t taken the time to try to resolve flow control, as it works well enough for the simple interaction that I use the terminal for. I see occasional issues tailing large log files, but it recovers fairly well.

      Let me know if you find a solution and I’ll update the article.

  1. I too have a pl2303 based usb to serial dongle, and have the same issues trying to drive my Tektronix 4006 (ancient storagetube vector graphic terminal. After much mucking about I draw the conclusion that the pl2303 has a 1K buffer on the USB side, that can’t easily be turned off, and linux does indeed respond to xoff, but this buffer is large enough to overrun the terminal anyway, since the pl2330 will keep sending until the buffer is empty. the buffer thus fills at 480Mbit per second, and empties at 19200 Bit per second (or in my case max 4800 bps). The vt420 (if I recall ) has the option of sending XOFF at 64 or 128 bytes before its input buffer is full. It will then receive 1K more of data before the flow stops. I consider this a bug in the usb-serial dongle. With a standard PC com port it works just nicely, it has only 16 bytes buffer, well within the 128 of the vt420. a bitbanged rasberry pi internal com port plus a level changer (TTL -> RS232 level) would probably work nice too. I would be very happy if it turned out one can somehow disable the buffer in these devices…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>