New Version of Fx2tools

Posted in Development Tools, Software on August 20th, 2010 by Chris – Be the first to comment

Recently I updated Fx2tools. Now you can:

  • Upload SDCC-generated HEX records directly to an FX2LP chip's RAM and EEPROM
  • Backup & restore EEPROM (e.g firmware for Digilent's FX2-based FPGA development products)
  • Send arbitrary commands to the chip's control endpoint
  • Benchmark bulk writes to the FX2LP chip

I have successfully tested it with

UMDKv2 Prototype Works!

Posted in Electronics on July 19th, 2010 by Chris – Be the first to comment

The Nexys2-based prototype of the forthcoming redesign of my USB MegaDrive DevKit seems to work!

There is a custom PCB which plugs into the MegaDrive cartridge slot, and the Nexys2 FPGA board plugs into that, and draws its power from the MegaDrive. The custom PCB is pretty simple, it contains three 16-bit level converters for converting the MegaDrive's 5V signals to the 3.3V signals needed by the FPGA. Despite being simple, it was pretty difficult to make because it has 0.5mm-pitch chips placed over vias.

The game loads over Hi-Speed USB into the Nexys2's onboard CellularRAM whilst the MegaDrive is held in RESET. When the MegaDrive is released from RESET, the bus is taken from the USB controller and given to the MegaDrive, which begins executing the code.

One interesting problem I've noticed is that the sampled "Sega" song ditty at the start of Sonic the Hedgehog is corrupt - it comes out as white noise. My guess is that the samples are being read directly from the cartridge memory by the Z80 somehow, and during those cycles the 68000's !AS line (which my memory controller uses to time its state transitions) is not strobing, so the Z80 is reading garbage samples. This is just a guess though, I need to do further investigation.

Update: My theory was correct. The Z80 read cycles don't seem to strobe !AS like 68000 read cycles do. I eliminated !AS from the memory controller logic and now it works fine.

The VHDL needs a lot of tidying, and I need to implement the bus arbitration logic to allow USB and MegaDrive memory reads and writes to be interleaved seamlessly by the memory controller, and then I need to work on a DMA controller for doing efficient reads from an SD-card.

Work Starts on USB MegaDrive DevKit v2 (UMDKv2)

Posted in Electronics on July 11th, 2010 by Chris – Be the first to comment

It has been a long time since I put any thought into version 2 of my USB MegaDrive DevKit. I'm currently putting together a prototype based on a Digilent Nexys2 FPGA board. So far I have managed to:

  • Power the Nexys2 from the MegaDrive's 5V supply.
  • Buffer the MegaDrive's 7.6MHz clock using this board.
  • Verify that the MegaDrive's clock is actually running at the expected rate (0x73F9XX ~ 7.6004MHz).
  • Use one of the Digital Clock Managers on the FPGA to multiply the 7.6MHz clock by 14 to give 106.4MHz.
  • Use this 106.4MHz to clock a memory controller state machine, running the on-board CellularRAM at half that frequency.
  • Fix up the host interface reference design to eliminate the need to force FSM encoding.
  • Benchmark block writes using the Adept tool over USB to the CellularRAM at 3.94Mbyte/s.
  • Use a transistor switch to give the FPGA control of the MegaDrive's RESET line.

This 0x73F9 is the top 16 bits of a 24-bit counter giving MegaDrive clocks per second: 0x73F9XX ~ 7.6004MHz

Still to do on this prototype:

  • Build a MegaDrive cartridge PCB with an FX2-100S-1.27SV(71) edge connector for interfacing with the Nexys2.
  • Implement the 68000 bus reads and writes in the VHDL.
  • Build the SD-card interface PCB and write the VHDL for a DMA controller clocking the SD card in SPI mode at ~25MHz.
  • Optimise the memory controller to use burst writes of data from the host - this should increase throughput to ~5Mbyte/s.

If you want to look at the VHDL for the host interface and the memory controller, you can download it under a GPLv3 licence from here.

Placing Vias Under Fine-Pitch SMDs on Home-Made PCBs

Posted in Electronics on July 4th, 2010 by Chris – 1 Comment

There are lots of interesting electronic components nowadays like FPGAs and powerful 32-bit microcontrollers. Unfortunately most have upwards of 100 pins and many are only available in packages like TQFP which are very tricky to design with at home. There are two main reasons for this:

  • The layout of the pins usually requires vias to be placed under the chip to allow decoupling capacitors and power routing on the other side of the board, leaving the topside clear for signal fan-out. Unfortunately there is precious little clearance under SMD chips for the through-board conductor to make a good connection with the top-side tracks.
  • The lead pitch is tiny, typically 0.5mm.

Today I was able to make my first PCB using a 0.5mm-pitch chip, with vias placed under it. The design was just an intelligent break-out board for the 48-pin SN74ALVC164245 level-shifter. It is available in the 0.635mm-pitch DL package and the 0.5mm-pitch DGG package, which is what I used. I chose this design because the chips are cheap (~£1.50) so it wouldn't have been the end of the world if I failed a few times. The techniques should generalise to bigger, more expensive components.

The following method worked for me; I hope it's useful to someone else.

Layout

If you want to fabricate your latest PCB design at home, you need to start thinking about the implications at the design stage - and that potentially includes modifications to the library components you use. For successful home-made PCBs you need to be very conservative with the pad & track sizes and spacing, particularly where drills are concerned. In Eagle CAD, I used 1.5mm octagons for the via pads, with 0.7mm drill-holes.

Note: In retrospect, it looks like the etchant has made holes uniformly bigger than the 0.7mm specified by the design, so next time I will reduce the CAD drill size to 0.5mm to compensate.

Making the PCB

I used an HP LaserJet P2014 to print the upper and lower layers on to LaserStar film (upper layer mirrored), aligned the two sides using four pieces of blu-tac to hold the film in place (the ink facing inwards), then slid an appropriately-sized piece of double-sided PCB laminate between the sheets and exposed for 150s in an AZ210 double-sided UV box (pre-heated for 120s). Next I developed the board using an SN110 applicator, and etched with ferric chloride solution in a PA210 bubble-tank. Then I used an SN120 applicator to strip off the remaining photoresist, scrubbed the board vigorously with steel wool and then used an SN130 applicator to remove any oxidisation from the copper.

Drilling and Inserting Through-Hole Rivets

To drill the vias I used a Dremel with a 0.7mm bit. In retrospect I think a 0.6mm drill bit would have been better. To make a conductive connection between the top and bottom layers I inserted one of these tiny rivets into each via hole using a Favorit rivet machine from MegaUK.

Next I very carefully soldered both ends of each rivet using lots of flux and trying to avoid large blobs (remember that the chip goes over these vias, and there is only 0.25mm clearance).

Drill the holes and insert the rivets, then solder both sides

Before placing the chip over the vias, I used a multimeter to check the connections between the upper and lower tracks.

Soldering the Chip

Soldering such fine-pitch components is difficult at the best of times, but on a home-made PCB it's harder still. For aligning the chip on the pads I used a USB microscope and a steady hand - no Relentless for me today! For the soldering itself, I used the drag soldering method using a Weller WD1 soldering station and an Cooper NTGW tip.

Align the chip carefully, solder two corners and then drag the iron down each row

Once I finished soldering I cleaned the flux-gunk off with methylated spirits.

The Finished Product

And here it is, the finished product:

You can download the Eagle CAD design files for the board if you're interested:

Demoscene

Posted in Software on June 9th, 2010 by Chris – Be the first to comment

Twenty years ago I used to write demos for the Commodore Amiga. The demos I wrote were primitive even by the standards of the time. It was hard to compete with crazy Swedish guys who were able to do such amazing things with a computer that after all had only a fraction of the power of a modern cellphone. Nevertheless, I am immensely proud to have played a small part in a scene which continues to this day. I discovered this demo today. It's less than 200kB, and it is truly amazing. Taken back in time to 1990, it would have made even the craziest Swedish genius's eyes pop out of his head:

If you have a Windows PC, you can download it from here.