Sunday, 10 November 2013

Hardware problems, XMODEM, and musings on programmable logic

In my last post I mentioned the problems I've been having with powering my computer. A multimeter on various ICs shows a big drop across the power pins on some of the ICs. The AY 3 8912, for instance, was getting only about 3V. I have worked around these problems by using an additional power source to counter the voltage drops. I have also bought an old computer PSU. These are nice because not only can they supply high currents, but they also have lines for pretty much any voltage I will ever need; 5V, 12V, 3.3V etc.

Sadly I have made a big blunder: in playing with the power supply I inadvertently connected the power around the wrong way, frying the 6809, RAM, EEPROM and CompactFlash. Very annoying, but completely predictable because I didn't use the correct power connector onto the breadboard. Luckily I have spares for the 6809 (at least a 4Mhz version) and memories, but will have to buy a new CompactFlash and eventually a replacement 8Mhz 6809.

In any case none of this is very satisfactory and should not be necessary either since the Apple USB power supply I am using should be well capable of powering the computer. So after reading about other peoples similar problems I have had some sucees in getting the whole computer powered by the original USB power supply.

The two tweaks I've done so far seem to have mostly fixed the voltage drop:
  • Instead of chaining the breadboards together, and making the length of power wires and number of connections larger and larger as more boards are added, the boards are instead arranged in a star.  So no board is any more then one board away from the power connection.
  • I have also added some decoupling capacitors (100uF electrolytics) to each board.
The voltage drop has now all-but disapeard.  I would still like to switch to using the PC powersupply at some point because eventually the USB power supply will reach its limit, but I'll have to make it impossible to plug in the power supply backwards first!

Since I no longer have a working CompactFlash card, I need another way to get programs into RAM if I'm going to continue working on "user" programs. Since I have the serial line, the logical thing to do is use that. There are several methods for sending files down serial lines, including XMODEM, YMODEM, ZMODEM and Kermit.  The simplest is XMODEM.  It is so simple in fact that I've implemented it in the monitor in few dozen lines of assembly.  I can now transfer files from the terminal program (minicom) into the computers RAM.  It isn't perfect though; because XMODEM file transfers are initiated by the receiving terminal, there is a small delay before the file transfer starts as the sender has to timeout.  It works well though; I can send a program from the Linux PC into the 6809 computer and run it, just as I had with the CompactFlash.  I'm of course still going to buy a new CF card so I can work on the Minix filesystem code.

Programmable Logic then.  I have wanted to try my hand at programmable logic for many years.  Ever since I found out about the ULA in the ZX Spectrum, the idea that a generic IC could be configured carry out almost any logic function seemed compelling.  And modern versions of this idea, namely CPLD (Complex Programmable Logic Devices), and FPGAs (Field Programmable Gate Arrays), are available now to the hobbyist, people like me!

In terms of uses to put to this technology my eventual aim is to implement some kind of simple custom IC for my 6809 computer. Hopefully it will contain various functions including replacing the glue logic (currently implemented in 74HC discrete logic), and some communications functions like an SPI controller, to replace the bit-banged SPI in the VIA.  There are quite a few other possibilities, like a simple display controller, or I could design my own sound interface.

But that is in the future.  I know next to nothing about this area, except some theory.  I have yet to find out anything detailed about the various HDL (Hardware Definition Languages) available, but will probably experiment with Verilog first.  I need to select which vendor to use, and select what parts from that vendor are suitable:
  • Generally it has to fit on my breadboard. Modern FPGAs have hundreds of pins and are surface mounted. 
  • It has to use 5Vs, since this is what the computer uses.  Again, modern PL devices run on 3.3V or lower.
  • Ideally the programming environment should run on OS X and should be free.
  • None of the parts should be too expensive.
So far I have narrowed my selection to Altera or Xilinx and there CPLD parts.  Both companies offer free tooling software, though unfortunately only for Windows or Linux and not OS X.  I have setup a Windows 7 virtual machine though.  So far I have installed the Xilinx tools (ISE) but the Altera software refuses to install correctly.  I will percivere but if I don't get any luck I will likely go with Xilinx anyway; the tools look good and the actual CPLDs are cheap.

Assuming I go with Xilinx my shopping list so far looks like the following:
  1. XC9572PC44-10C (PDF) (several)
  2. PLCC->DIP adapter for the breadboard
  3. PLCC socket for when I eventually use the parts in a PCB 
  4. Xilinx USB Cable Platform 
  5. PLCC extraction tool
Hopefully the whole lot shouldn't cost more then £50, which will include a couple of XC9572s.  These are 5V CPLDs with 72 macrocells and about 1,600 useable gates.  This should easily be enough to implement all the glue logic I will need, as well as a communication controller or two in a single IC.  The fact that these parts are PLCC is a bit of pain, but luckily there are DIP adapters so I can still use the breadboard.

But first up I will be happy to get something really simple, like a counter, running in the CPLD.

I have to thank the folks over at forum.6502.org for there guidance with checking that my plan for getting into Programmable Logic wasn't completely nuts...

No comments:

Post a Comment