This project is submitted for

Description

I built a homebrew Z80 based 8 bit computer for Retro Challenge back in 2014 (hence the name RC2014). It uses serial to communicate with the outside world, so plugging it in to a laptop with a FTDI lead means you can open up PUTTY and start programming like it is 1982. However, the reliance on a computer does somewhat take away from the appeal of this little computer.

I have made an LCD and PS2 keyboard interfaces with ATMEGA328, but the performance has been less than ideal. What I really wanted was something cheap and easy to use that can drive a TV or monitor and would allow a modern keyboard to connect to the RC2014.

Then the nice people at the Raspberry Pi foundation released the Pi Zero. Perfect! It can talk serial, it can output HDMI or Composite and take USB keyboard input. Once I was able to get my hands on one of these, I was able to run some initial tests and start working out how best to interface a Pi Zero to a RC2014

Just a minor update here with regard to the software. As mentioned in the previous log, Filippo has been working on a bare metal terminal emulator for the Pi Zero which is ideal for this project.

The latest update for this is working sweet, using either the HDMI or composite ports to display the RC2014 with ANSI commands supported.

Filippos source code is up on Git Hub, although it's the kernel.img file that is needed to run this. Simply copy this to a FAT32 formatted micro SD card (Any size - it only takes a few kb), along with a copy of bootcode.bin and start.elf. These last two files can be copied from any SD card that runs on your Pi (they are different between Pi Zero, Pi 2, Pi 3 etc).

Note that this is currently display only - so you will need a serial keyboard or use a FTDI lead to type characters on the RC2014

Ok, thanks for the support from everyone that has followed this project. The goal of this project was to get a Raspberry Pi Zero working as a serial terminal on my RC2014 computer, and produce a PCB for this. Well, that has been achieved and this kit is now listed on Tindie!

I'm really happy with the way the PCB has turned out. Even the little mounting holes line up with the Pi Zero, so if additional mechanical support is needed, it's easy to do.

Setting it up is easy too. As mentioned in an earlier post, just one command to install Screen, then one command to run it after booting up.

The booting up time problem may be sorted however, as Hackaday.io user Filippo has been working on a bare metal ANSI emulator for the Pi. The code is available on Github and it already looks really promising

Best of all, is playing around with the ANSI escape codes for different colours. Wow, the RC2014 has colour! (Although worst of all is photographing a RC2014 with a bright magenta screen in the same shot!).

I have now sent off some new gerber files for an updated PCB. This gives more mechanical stability to the Pi Zero and fixes the composite output and should be in my Tindie store in a couple of weeks time.

Due to the limited supply of the Pi Zero, some people have asked if a regular non-Zero Pi will work. Well, yes, but no, well, kind of. Physically, it won't fit as the USB ports obscure the PCB - even without the composite socket (which you wouldn't need anyway)

However, if you used extra deep header sockets, or if you were to unsolder the header on the Pi and mount the boards back to back, then it would - although mechanical support would be a problem. Running jumper cables over to a Pi would work fine though.

Ok, so the Pi Zero Contest is drawing to a close and I wanted to get one final update in before that ends. However, that doesn't mean that this is the end of this project for me. Sure, I've achieved something quite useful, but looking further ahead I see a real future for this little board.

Currently, I can plug my RC2014 in to a USB keyboard, VGA monitor (via adapter) and a power supply, wait 30 seconds then start up a terminal session and I'm ready to start punching in BASIC commands. That is pretty much what I wanted to achieve, so on that basis, I am happy.

But that doesn't mean that I am satisfied. There are a lot of tweaks and changes I plan to make. In no paticular order, this is what I want to do before I consider this complete;

Respin the PCB so the composite output works

Add a jumper on the PCB to select between composite and HDMI at bootup - There is something I keep coming across about shorting a couple of the GPIO pins, but I need to do a little bit more research on this

Find out why I cannot get Screen to run at bootup - This should be simple, but although the changes I've made to /etc/rc.local work when I run it manually, it won't auto run. Yet.

Disable logging boot commands to the serial port - If rebooting the Pi after the RC2014 has already started, some of the output is taken as BASIC line numbers and commands!

Connect the RC2014 reset line to one of the GPIO pins on the Pi - Then find a way to issue a reset to the RC2014 just after Screen starts running

Once I'm happy with all of that, I just need to try duplicating micro SD cards, get a bunch of boards made up and I can add it to the other RC2014 products on Tindie!

All of this will take a bit of time, and right now I don't seem to have enough of that. But hopefully soon I'll be able to update this project with the progress I've made.

Finally, I realize that this competition is mainly for fun, and I although I never had any real aspirations of winning, here's a photo of my cat Bartlett with my Raspberry Pi Zero... just in case the judges like things like that ;-)

So, after waiting for what seemed like an eternity (it really wasn't very long at all), I got a purple padded envelope through with OSHPark on it. Inside was 3 copies of my Pi Zero to RC2014 PCBs!

A quick check of the boards confirmed they'd been manufactured exactly as expected (ie perfectly!). Time to fire up the soldering iron and get testing!

As it was a test board, and I am tight when it comes to connectors, I didn't populate the entire 44 pins worth of sockets the Pi would connect to. It only needed a few for connectivity and mechanical location afterall;

Due to not ordering the components in time, I didn't have the phono socket for the composite output, so that would have to be bodged up for now. But, hey, it's a prototype, right?

The Pi itself fitted a treat. Even the holes I'd put in for PCB support lined up, although the connector seems to hold it well enough.

Initial testing proved it worked well through a mini-HDMI to VGA adapter. I soldered on a temporary lead to test the composite output, and that worked too, although the picture wasn't as great as I'd hoped. Possibly the composite traces on my PCB were too long, too thin or not shielded enough, or possibly the temporary connection was just a bit poor.

A couple of days later, the phono sockets arrived so I could complete the board. The socket fitted perfectly, which was great! However, no matter what I did, I couldn't get a picture through it! Eventually, it became apparent what was wrong; The ground and signal were reversed coming out of the phono socket!

If you recall from the previous log, this is a component that I had to add to Kicad manually. I took great care in making sure all the measurements and physical aspects were correct... although I paid less attention to the electrical side of things. In my defense, though, it seems perfectly reasonable that the center pin on a "triangle" of pins would be the signal and the other two would be ground, right? Wrong!

This, in fact was a good thing because it taught me several things; Read the datasheet. Read the datasheet again. Check the datasheet. Do not make assumptions. And READ THE DATASHEET!

Well, at least I had a working video out from the HDMI socket, so I could start looking at getting the Pi optimised for being a dumb terminal.

So, with breadboard and jumper wires, I had proved that a Pi Zero would be great as a keyboard / display adapter for the RC2014, but now I needed a neater and more permanent solution. Time to fire up Kicad...

On the face of it, there really isn't much to this. It's just a passive adapter between the Pi Zero and the RC2014 with a composite signal breakout. The Kicad library, however, didn't know what a Pi Zero was (or even a phono connector). I found some other Pi variants on line, but although the 40 pin header is the same, they didn't contain the extra 4 pins (reset and comp out), so I quickely drew up some new components

See, I told you it wasn't complicated! 5v power and ground go to the RC2014 header. Tx from the Pi goes via a jumper to Rx on the RC2014 (in case I want to add some other form of input at a later date) and Tx on the RC2014 goes via a voltage divider to Rx on the Pi. Then the ground and signal go out from the Pi to a connector for the composite out. Simples!

The PCB isn't much more complicated, although, again, I had to design new components for the Pi and also for the BNC adapter

For this board, I decided to get fancy and round off the corners! And also add some mounting holes that line up with the holes in the Pi Zero in case I want to bolt it to the board.

Once I was happy everything would turn out the way I wanted, off to OSHPark I went!

After getting my paws on a Pi Zero, I needed to check three important things; Can the serial port talk to the RC2014, how do I use the composite output and what terminal emulation program does the NOOB install contain?

I don't have a HDMI monitor, so needed to use the composite output of the Pi. Soldering a photo adapter on to the output pins was easy enough, but initially, I couldn't get it displaying anything. Eventually I realised that you need to hold down 3 on the keyboard when it started up.

Once I had the Pi up and running, I quickly came to the conclusion that there weren't any terminal emulators included by default. So, I would have to download one... which meant I had to find a USB wifi dongle. And a hub. Ok, so after some trial and error,

sudo apt-get install screen

got me up and running with a command line terminal program. Next, to sort out the serial port stuff.

The Pi runs at 3v3 and the RC2014 runs at 5v, so plugging the two together isn't quite so straight forward. I know there are level converters that can allow 5v devices to interface with 3v3, but I wanted to try keeping things simple so used a 10k and 22k resistor as a voltage divider on the TX pin from the RC2014 to Rx (pin 10) on the Pi. This works out to 3.44v, and although the Pi isn't 5v tolerant, 3.44v seems to be close enough.

I ran the TX from the Pi (pin 8) directly in to the RX of the RC2014. Although it isn't the 5v isn't as high as the RC2014 would like, 3v3 is sufficiently high that it works ok. And, of course, it needs a common ground.

Initially, starting up Screen;

screen /dev/ttyAMA0 115200

didn't work. The serial port is counterintuitive in that it needs to be turned off, either via the GUI settings or editing the cmdline.txt file, in order to use the serial port. Turning off the serial port means the Pi doesn't use it for it's own stuff, so the user is free to make use of it. Firing up Screen now works and the Pi behaves as a graphics card for the RC2014!

Next up, making a dedicated PCB for easy connection to the RC2014 and automating the boot process...

It's kinda funny to have the display/keyboard subsystem hundreds of times as powerful than the mainboard cpu. But your average PC also has about the same ratio of performance between the cpu and gpu. So it really makes sense... ^_