Wednesday, September 21, 2016

36 15 Framboise

As a boy while visiting family in France, one of the things I was very excited about was the Minitel that everybody had at home. It was a very popular videotex network in the 80s and 90s providing a multitude of services unbelievably similar to today's online experience. This compilation of ads and news reports give a good feel of what the Minitel had to offer. Today, it is often considered as a precursor of the world wide web.

So, to satisfy my nostalgic feelings, I bought a Minitel on Ebay. Although the service was retired in 2012, there are still plenty of devices on sale with prices ranging from 20€ for the most common models (e.g. Minitel 1B TELIC) to several hundreds € for the earlier/rarer models. The device suffered some cracks in the shell from shipping, but fortunately it still works!

Although the service is discontinued, and even if not living in France, a Minitel can still be operated in useful ways. The Minitel is a so-called dumb-terminal. It is used to access services running on distant systems which are accessed via the telephone network. So the Minitel has an integrated modem. But it can also interface with local devices, via a serial port available on the back. There are plenty of blog posts explaining how to do this, just google for "minitel linux terminal". Since I'm also fond of Raspberry Pi, this is the mandatory I-hooked-a-Minitel-to-my-Raspberry-Pi blog post!

I won't delve into too many technical details about the serial port adaptation, since there are enough resources about it online, but let me just describe the challenges I faced. First of all, the Minitel expects a male 5 pin DIN connector, not the usual DE-9 to interface with the serial port. They call it "Prise Péri-Informatique". I used a conventional MIDI patch cable, cut it in half and resoldered the pins to match the Minitel TX and RX leads.

Also, since I didn't want to get my hands too dirty - although I should practice some more soldering - I used the bi-directional level converter from sparkfun to adapt the 3.3V TTL signal level from the Raspberry Pi to the 5-15V levels of the Minitel (and vice-versa). There are many blog posts explaining how to implement this using a simple circuit with a couple of resistors and transistors.

I took some time to analyze the signal with an oscilloscope and interpret the serial protocol. When no characters are transmitted, the idle level is high. The asynchronous transmission starts with the start bit (low), continues with the 7 bit ASCII character value (most significant bit first), an even parity bit and finally ends with a stop bit (high). From the measurement we can see that a symbol is transmitted in 208 microseconds. This value inverted corresponds to the baud rate of 4800 bps. In this case, the transmitted character was a lowercase 'e' (0b01100101 or 0x65).

Finally, the last challenge I encountered was the fact that Raspbian, the standard debian-based Linux distro for Raspberry Pi switched to systemd. Most blog posts still refer to /etc/inittab to install the serial getty. Under systemd, it's a bit tricky. Here's my configuration under /etc/systemd/system/serial-getty@ttyAMA0.service:

# This file is part of systemd.
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.

Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before, even though
# didn't actually pull it in.

ExecStart=-/sbin/agetty -c ttyAMA0 4800 m1b-x80


I also used the Minitel 1B terminfo file of Alexandre Montaron and installed it as follows:

$ tic mntl.ti -dir /etc/terminfo

Here a screenshot of the working system with the output of the top command:

10 years ago, I got a hand on the "Spécification Techniques d'Utilisation du Minitel 1B" (STUM), a 200 page specification of the Minitel and it's building components (modem, keyboard, screen, serial port) as well as the different modes of operation ("Standard Télétel" or "Standard Téléinformatique ASCII"). It has shown very helpful to understand the inner workings of the device.

Finally, here are some links you might want to check out if you want to find out more about Minitel:

No comments:

Post a Comment