Pages

Monday, February 10, 2020

dreamcast.local I - Basic connection

In this mini-series I will describe my current project: the Dremacast Server

The Dreamcast is a game console, released by Sega 14. October 1999 in Europe. The Dreamcast was also my first console and I still use it from time to time.
Besides a lot of great games, the Dreamcast has a build in analog modem, which would allow you to connect your Dreamcast to the internet and play games online with your friends. Of course, most services and websites are not available anymore, why I have decided to start this small project.

The main goal of this project will be the following:

Setup a small server, which allows your Dreamcast to connect to, via the internal analog modem. Additionally, setup up some online services.

Hardware

Let's take a look at the hardware I use first:

Server: Orange Pi R1 with Armbian Buster as operating system
microSD: Toshiba M203 16GB
USB to RS-232 adapter (PL-2303 based)
Anlog modem: Elsa Microlink 56k basic
Telephone system: Keil Telecom K 106

The Orange Pi R1 is perfect for this project. It has 4 Cores, 512MB memory, a microSD slot, 2 Ethernet ports (one provided via USB), Wifi and two USB ports (provided by the expansion board). During this project description, I will setup a dedicated network for my Dreamcast:

Domain: dreamcast.local (192.168.3.0/24)
Hostname for the Orange Pi R1: dcs01
IP for the Orange Pi R1: 192.168.3.1

The overall hardware setup will be like the following:


You can use any other hardware that is supported by your installed Linux Distribution. I had a similar setup running a few years ago already with some X86 hardware. Basically, this mini-series is based on my older articles about setting up a pppd server and a nameserver with bind. Only with this article I will focus 100% on my Dreamcast.

Setup serial interface

If you have PL-2303 based USB to RS-232 adapter, just plug it in any free USB port. Check out for some messages:

# dmesg
...
[  282.967611] usb 8-1: new full-speed USB device number 2 using ohci-platform
[  283.194690] usb 8-1: New USB device found, idVendor=067b, idProduct=2303, bcdDevice= 4.00
[  283.194710] usb 8-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  283.194724] usb 8-1: Product: USB-Serial Controller D
[  283.194737] usb 8-1: Manufacturer: Prolific Technology Inc.
[  283.334175] usbcore: registered new interface driver usbserial_generic
[  283.334295] usbserial: USB Serial support registered for generic
[  283.355376] usbcore: registered new interface driver pl2303
[  283.355486] usbserial: USB Serial support registered for pl2303
[  283.355809] pl2303 8-1:1.0: pl2303 converter detected
[  283.380336] usb 8-1: pl2303 converter now attached to ttyUSB0
...


And check if your serial device exists:

# ls /dev/ttyUSB0
ttyUSB0


On the RS-232 connector, connect your analog modem. At this point you should be able to communicate with your modem and a modem control program like minicom. If you want to know more about controling your modem with minicom, take a look at one of my older articles: https://karellen.blogspot.com/2011/05/setting-up-pppd-server.html

Setup mgetty

To receive incoming calls from your Dreamcast, you need mgetty. Iinstall mgetty this way:

# apt install mgetty
...

And create unit file for systemd:

# vi /lib/systemd/system/mgetty.service
[Unit]
Description=Linea 1 Modem USB
Documentation=man:mgetty(8)
Requires=systemd-udev-settle.service
After=systemd-udev-settle.service

[Service]
Type=simple
ExecStart=/sbin/mgetty -x1 -s 57600 -D /dev/ttyUSB0
Restart=always
PIDFile=/var/run/mgetty.pid.ttyUSB0

[Install]
WantedBy=multi-user.target



The most important line is the ExecStart line, which configures how mgetty starts:

  • x1: Debug level
  • s 57600: Max modem speed
  • D: Data only
  • /dev/ttyUSB0: Serial device

If you have changed the unit file for mgetty, you need to reload it:

# systemctl daemon-reload

Next start mgetty:

# systemctl start mgetty

And enable mgetty to make sure mgetty gets started during boot:

# systemctl enable mgetty

Check that mgetty is really running:

# pgrep -afl mgetty
1485 /sbin/mgetty -x1 -s 57600 -D /dev/ttyUSB0


Setup PPP

To be able to not just receive incoming calls, but also to answer incoming calls, you need pppd. First install the software again:

# apt install ppp
...

Then configure the base options file for pppd:

# mv /etc/ppp/options /etc/ppp/options.bak
# vi /etc/ppp/options

-detach
asyncmap 0
netmask 255.255.255.255
proxyarp
lock
crtscts
ktune
noauth
usehostname
modem
disconnect /etc/ppp/ip-down
ms-dns 192.168.3.1
usepeerdns
debug
mtu 1500
mru 1500

Since my USB to Serial  adapter is using the device /dev/ttyUSB0, I have to use a specific option file where I store the ppp IP for my server (172.16.12.1) and the ppp IP for my Dreamcast (172.16.12.2). Just adjust it to your serial device and change the ttyNAME at the end:

# vi /etc/ppp/options.ttyUSB0
172.16.12.1:172.16.12.2
debug

Next you need to setup a user who is allowed to authenticate against your server. This user must exist in two files. The first file will be the pap-secrets file needed for pppd:

# mv /etc/ppp/pap-secrets /etc/ppp/pap-secrets.bak

# vi /etc/ppp/pap-secrets
# client        server          secret          IP
dreamcast       *               dreamcast       *


The second file is the /etc/passwd file, where all users are stored. Username and password have to be identical in both files:

# useradd -d /home/dreamcast -m -g users -s /bin/false -u 1002 dreamcast
# passwd dreamcast
New password: dreamcast
Re-enter new password: dreamcast


First connection test

At this point you are ready for a first connection test. Connect all cables, configure your Dreamcast so it will dial the number from your Linux server. In my case I used Dream Key 3.0 to configure my Dreamcast to dial the number 11, which will be answered by my Orange Pi R1. The following photos show how to setup your Dreamcast with Dream Key 3.0 to dial the phone number 11 (sorry for the bad quality):




My telephone system does not offer a dial tone (at least not that I know). In my case I had to configure my Dreamcast to execute the atx AT command first, to ignore any kind of dial tone or missing dial tone:


For username and password use the same as you have configured in your pap-secrets:


As shown in the overview picture, the Orange Pi R1 is connected to the first line on my telephone system, which can be reached by dialing 11:



After configuration is finished, you are ready to connect:




Dream Key 3.0 first tries to connect to www.sega-europe.com. Since I haven't configured DNS or routing tables, no connection will be established:
 

The connection will be stable for a few minutes, after some time of inactivity the Dreamcast willl disconnect the line. Before disconnecting the line, check on your server for your ppp0 device. on my Ornage Pi R1 it looks lik this, when a connection is established:

# ifconfig -a
...
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet 172.16.12.1  netmask 255.255.255.255  destination 172.16.12.2
        ppp  txqueuelen 3  (Point-to-Point Protocol)
        RX packets 19  bytes 573 (573.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20  bytes 854 (854.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
...


That's for the first part of this project, next time I will show you how to setup a DNS for the dreamcast.local network.

Links:

http://www.orangepi.org/OrangePiR1/
https://www.armbian.com/

No comments:

Post a Comment