Recently, I had a hankering to connect my old Commodore VIC-20 to the internet. Yes, I know, it’s been done before. I’ve even done it before, sort of, using an RS-232 connection to another computer.
But I wanted to skip the reliance on another machine, and see if we could get the wonder computer of the 1980s connected independently. Mostly independently, anyway.
There are several products out there to assist us. The Comet64 Internet Modem is probably the most used/well known. But I ran across an interesting device, the USR-TCP232-T2 (henceforth called simply TCP232), which is a TTL UART to ethernet converter. There have been other attempts to use it, but those are mostly forum posts with little or no follow-up. So I decided to put down some documentation.
First things first. It’s pretty cheap. I got mine for about $10 off eBay. Because of that, it’s pretty basic. RJ-45 jack on one end, header pins on the other. The header pins are marked CFG, RXD, TXD, RST, GND, VCC, and VDD. Here’s what those pins (supposedly) mean:
- CFG: Configure pin. I’ve seen lots of documentation state that if you’re not using the built-in webserver (yes, built-in!) to configure the device, you need to pull this pin low and use the serial connections on the header pins. I’ve also seen where this defaults it out to 9600baud, which won’t work for my application. Finally, I’ve found that I haven’t need to use this.
- RXD, TXD: These are the important pins; receive and transmit. This is how we get data in and out of our connected system.
- RST: Reset, used to reset the USR-TCP232-T2 device.
- GND: Ground
- VCC: +3.3 VDC
- VDD: +5 VDC
When you first fire up the TCP232, it (annoyingly) has a static IP address of 192.168.0.7. Login to the web interface is admin/admin. Once you pull up the web admin page, you can modify the IP settings to use a different static IP, or DHCP.
The most useful configuration options come in the ‘Serial Port’ configuration screens. Here you can set the baud rate, data size, parity, and stop bits. This is also where the configuration can be a wee bit confusing.
The TCP232 can be configured in a ‘server’ configuration, or a ‘client’ configuration. In addition, you can specify TCP or UDP.
In the ‘server’ configuration, the TCP232 effectively becomes a telnet server. It’ll respond to connections to it’s IP and port, and anything sent over said connection will be forwarded to the serial device attached. Likewise, anything sent from the serial device will be forwarded to the active connection(s).
This is kind of neat, really, especially if you happen to have some BBS software you wanted to run on your trusty old serial-connected computer. Also interesting to note is that you can have up to 16 incoming connections, meaning 16 people can connect to your serial device. How your serial device handles that, of course, is down to the device.
In ‘client’ configuration, the TCP232 will automatically attempt to connect to a specific system (either hostname or IP, since it will do DNS lookups) as soon as it boots up. So, for example, you could put in the address and port of your favorite BBS, and as soon as the TCP232 has power and is booted, it will start a connection and forward any incoming data to the serial device. Again, anything sent from the serial device will be sent to the remote server. If the server disconnects, the TCP232 will immediately attempt to connect again.
There are a couple of options on the serial config screens, and to be honest most are a bit of a mystery to me. I’ve unchecked all of them, but you can enable them as you need.
- RESET: This option will force the TCP232 to reboot when in client mode if the connection to the server fails 30 times.
- LINK: ¯\_(ツ)_/¯
- INDEX: Something to do with multiple connections when in ‘server’ mode; I believe it will assign an ID to each unique connection
- Similar RFC2217: Appears to be something to do with configuring the parameters remotely via network.
Connecting to the VIC-20
Okay, so, let’s get to the bones of this thing. How do we connect this to our trusty VIC-20?
We’re going to utilize the user port, similar to how we did when turning the VIC-20 into a simple terminal. Specifically, we’ll take the RX pin to pin M on the user port, and the TX pin to pins B&C.
We can power the TCP232 from the user port as well, though there’s conflicting information about the power draw of the TCP232, as well as the power limits on the VIC-20’s user port. Specifically, I find values from sub-100mA to 200mA power draw of the TCP232; likewise, I find a variety of values quoted for pin 2 (+5 VDC) on the VIC-20, but 100mA is the most common one.
So, can we pull +5 VDC from user port pin 2 and use it for the +5 VDC (VDD pin) on the TCP232? Well…yeah, you can. Is it a good idea? Probably not. Will you kill your VIC-20? I don’t know. So do it if you want, but don’t kill your VIC. And if you do, don’t blame me.
Now that we have our connections sorted, let’s see how this works. You’ll need some sort of terminal emulator, either my simple crappy BASIC program from my terminal post, or one of the excellent ROMs out there (I’m partial to Mighty Term, but I’ve also used VICTERM).
The VIC-20 handles, at most (generally speaking) 2400 baud, so configure your TCP232 to use 2400 baud or lower. The simplest test is to configure the TCP232 as a server, then telnet to it from another machine. Assuming it all works, you should see what you type on the other machine show up on the VIC, and vice-versa.
Now that you have that working, play around with the Serial Port config. Set it to client, and put in a BBS (I’m partial to Particle BBS myself, or Centronian BBS) for the address (don’t forget the port!), and tell the TCP232 to restart. You should see the sweet text of your chose BBS scroll across your screen.
AT Command Set
Okay, now that we’re connected, let’s get to the real fun stuff. This device supports a modified AT command set, allowing us to change some settings “on the fly” directly from the VIC-20.
Entering AT command mode will bring back some memories for some of you: you start by entering +++ (NOTE: do NOT hit anything after +++). After a one or two second delay, the TC232 will respond with ‘a‘. Once it does, hit ‘a‘, to which it will respond with +ok.
Interestingly, once you’re into AT command mode, there’s actually some online help. Simply enter at+h and it will pump out screenfulls of commands for you. Alternately, and most usefully, you can go and grab the AT command documentation.
Mostly, though you’ll only need two commands: at+sock and at+z.
at+sock will show you, and allow you to set, the connection settings found on the Serial Port webpage. Let’s start by showing the current settings:
This is telling us that it’s in TCP client mode (TCPC), the remote address is the address for Centronian BBS, and the port is 6400. To set it, use the same format:
For some reason, it often will throw +ERR=-1 after commands, though it doesn’t appear to affect anything. I suspect it has to do with the fact that I have linefeeds enabled in Mighty Term (a fact I later confirmed).
Remember that the TCP232 connects automatically on boot, so to use our new settings, issue an at+z:
After rebooting, you should be connected to your new destination. To enter AT command mode again, simply hit +++ again.
And that, friends, is pretty much all there is to it.
A note on flakiness
I’ve found my TCP232 to be a bit flaky at times. It’ll take a long time to connect on boot, or it won’t let me enter AT command mode right away. Most annoyingly is, it doesn’t let me get into AT command mode unless it’s connected (either as a client, or as a server with someone connected), at least not for a long time. YMMV, and while these are annoying, they’re not deal breakers for me.
Hopefully this information helps some others. Have fun!