Retro CPC Dongle – Part 1

The Amstrad CPC464 was the first computer that I ever owned. It blew me away that I could type stuff into a machine and make it do what I wanted. It had a high colour display and everything was built-in.  While I played my fair share of games, my real interest was hacking the OS and programming in assembly.  There is still an enormous amount of software and advice available in the forums and even today the CPC is still an interesting computer to hack. This project will regenerate an icon from the 80’s, but with a modern twist.  This isn’t another retro emulator project, this is a brand-new CPC complete with Bluetooth wireless joysticks, on-board solid state storage and HDMI compatibility, all in a form factor the size of a key fob.

While there are plenty of CPC emulators out there, such as WinAPE, CPCBox and Caprice32 all of these have some limitations or flaws, not least of which you need a PC for these to host the emulator.  There also tends to be an issue with the keyboards and rarely do the keyboard legends match up to the key strokes.

There is another FPGA Amstrad project that used the Altera proprietary hardware definition language (AHDL and VHDL), and this was written for an older FPGA board that is no longer available and used older hardware such as VGA and PS2 keyboards. My project brings this up to date with HDMI output, USB keyboards, joysticks and Bluetooth connectivity.

Proposed feature list:

  • HDMI output for both audio and video
  • Large solid state storage such as flash
  • USB host for peripherals such as keyboard
  • Built in Bluetooth connectivity for keyboards, joysticks and maybe file transfer
  • Large memory capacity to host full complement of ROMS and RAM
  • Simplified programming through an on board USB-to-JTAG adapter
  • Large capacity FPGA to host future hardware
  • Smallest form factor possible
  • Lower cost than the original! (349 GBP)

You can see this is quite an ambitious list. With the exception of the Bluetooth components, I’ve developed a proof of concept already with a Terasic Cyclone V Starter Kit. Now it’s time to build my own hardware in the small form factor that I’m seeking.

Hardware

Below is the functional block diagram for the system.

I’ve chosen a Cyclone V rather than a Cyclone IV for the FPGA as an initial test compile of the Z80 CPU required about 3500 logic elements in Cyclone4 and 1700 logic elements in Cyclone5.  I need two CPUs in the device, one for the Z80 and one to offload the handling of the USB keyboard and Bluetooth.  With the two CPUs alone, I needed 7300 logic elements, and this meant I needed a 15K logic element FPGA at a minimum to accommodate the features listed above.  Mouser sells the 15K Cyclone IV for around AU$44 and the Cyclone V for AU$55  making it a no-brainer to upgrade.  This will give me 29K LE for all of the logic – this is more than enough given that CyV use an 8-input LUT and the CyIV use a 4-input LUT.

Video and Audio

These will be handled by an Analog Devices ADV7513.  This chip takes HD video and presents it on an HDMI compatible output.   It also has the capability to add the audio to the data islands present in the HDMI standard. It just needs to be fed 8 channels of I2C audio and the audio and video is taken care of with one cable.

Memory and storage

Memory required is easy to calculate, as the CPC can access between 32-256 pages of 16KiB RAM and 256 ROMs of 16KiB.  256 x 16K x 2 = 8MiB.  I’ll need some memory for the USB and Bluetooth coprocessor to handle offloaded functions, so 16MB will do nicely.  SDRAM at this capacity is reasonably priced, so one chip of 16MiB will fit the design.

Storage will all be on board. I toyed with the idea of micro SD cards for the storage, but the form factor of this device will allow it to be permanently plugged into the TV and out of sight.  The CPC disk images are all fairly small, so a removable card is probably not necessary. A 1024MiB NAND flash can hold 5825 disk images of 180K each, so this seems like plenty.

Also, I’ll add a small amount of M-Ram to hold the system configuration and high endurance data block. M-Ram is a very high endurance non volatile memory, storing data in the magnetic polarity of a tiny wire inside the chip.  These are not very high capacity, but can withstand 100 trillion writes.  32KiB seems to be the best capacity per dollar.

Configuration

Configuration will be achieved through an FT2232H chip from FTDI.  These two channel devices can be configured for JTAG and UART simultaneously.  urJTAG, which I’ve written about before will be used as the programming device. In the first prototype, I’ll likely bring out the JTAG interface on a header too, just in case.  This will also provision a second serial or JTAG port that we can use for debugging the FPGA HDL.

According to the device datasheet, configuration data for the FPGA requires 21,061,280 bits, so normal configuration of the FPGA will be handled with a 256Mbit NOR Flash.  This will also hold some of the ROMs and disk images that don’t change such as the OS ROM and CPM disks.

Peripherals

Connection to keyboards, joysticks will be handled through an on board full speed USB2 host.  This also presents the possibility for plugging in mice, WIFI dongles and USB storage at a later date.  The peripherals will be handled by the coprocessor so that the main processor is unburdened during use.

Bluetooth

This is an opportunistic add-on following my discovery of the BlueNRG chipset by ST Microelectronics.  This tiny chip includes a complete Bluetooth radio and stack on die. Pairing with their equally tiny balun and a Bluetooth chip antenna I’m hoping to transparently add Bluetooth game controllers to the input ports of the CPC.

Next steps

With the main components chosen, I’ll need to start working on getting the footprints into my PCB designer (Designspark).  Once this is done, I can put together the schematic, translate this into a netlist and route the PCB before sending the board away for manufacture.

There’s still a lot of work ahead, but it will be an exciting project.  Look out for part 2, where I explain more of the architecture.


 

Resources:
A special call-out to the ultimate in CPC hardware documentation; Grimware: http://www.grimware.org

Other Resources:
CPC Wiki – http://www.cpcwiki.eu
Unofficial Amstrad archive – http://www.cpctech.org.uk/home.html
Amstrad Abandonware – http://www.amstradabandonware.com/en/home
FPGA Amstrad – http://www.cpcwiki.eu/index.php/FPGAmstrad

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s