CPLD as Propeller glue.
Martin Hodge
Posts: 1,246
This is a small Xilinx CPLD configuration I've been working on to enhance the Propeller in certain ways and to familiarize myself with CPLDs and FPGAs. The impetus for starting down this road was to somehow be able to switch between composite A/V with keyboard, and VGA out, on the same 8 Propeller pins that the Propeller ASC has on it's AUX port.
The project then grew to provide a configurable clock-divider to supply a 5MHz or 6.25MHz clock for the Prop. Finally I2C was added to allow configuration through software. The I2C system has a configurable address and a single 8-bit configuration register. The bits in this register toggle the clock frequency and video output routing. The I2C pins are connected in parallel with the EEPROM to save Propeller pins. This project has been testing and works very well. The most difficult part of this project was devising a way for the CPLD to act as a middleman or repeater for the open-collector keyboard bus. The target device is a Xilinx XC9572XL which is a "legacy" component that can be purchased for less than $3 in qty. I uses a single MEMS 50MHz oscillator to drive the CPLD and, through the freqdiv, the Propeller. A MEMS device is not required but it's so very tiny and simple and has comparible tolerance.
In the atteched images you can see the prototype using a Propeller Platform, a CPLD carrier, a Propeller ASC KVM adapter and a Propeller ASC VGA adapter. The PP was used because it provides access to the EEPROMs I2C bus on it's headers. The spin program demonstrates on-the-fly switching between NTSC and VGA via i2c commands. The video proves the result. Included is a zip file of the Xilinx files that can be opened in ISE. I'm also working on an Altera port of this project.
This is still very much a work in progress. The next step is to devise a way to provide a 3-bit monochrome, or 4 bit grey, VGA output with keyboard. This could be done by routing one or two bits of one signal to all three resistor network channels. I'm not certain that will work but it's worth a try. There are 6 remaining bits in the configuration byte to do more things and a little less than half the macrocells are free in the 9572 part.
The project then grew to provide a configurable clock-divider to supply a 5MHz or 6.25MHz clock for the Prop. Finally I2C was added to allow configuration through software. The I2C system has a configurable address and a single 8-bit configuration register. The bits in this register toggle the clock frequency and video output routing. The I2C pins are connected in parallel with the EEPROM to save Propeller pins. This project has been testing and works very well. The most difficult part of this project was devising a way for the CPLD to act as a middleman or repeater for the open-collector keyboard bus. The target device is a Xilinx XC9572XL which is a "legacy" component that can be purchased for less than $3 in qty. I uses a single MEMS 50MHz oscillator to drive the CPLD and, through the freqdiv, the Propeller. A MEMS device is not required but it's so very tiny and simple and has comparible tolerance.
In the atteched images you can see the prototype using a Propeller Platform, a CPLD carrier, a Propeller ASC KVM adapter and a Propeller ASC VGA adapter. The PP was used because it provides access to the EEPROMs I2C bus on it's headers. The spin program demonstrates on-the-fly switching between NTSC and VGA via i2c commands. The video proves the result. Included is a zip file of the Xilinx files that can be opened in ISE. I'm also working on an Altera port of this project.
This is still very much a work in progress. The next step is to devise a way to provide a 3-bit monochrome, or 4 bit grey, VGA output with keyboard. This could be done by routing one or two bits of one signal to all three resistor network channels. I'm not certain that will work but it's worth a try. There are 6 remaining bits in the configuration byte to do more things and a little less than half the macrocells are free in the 9572 part.
zip
17K
Comments
Look forward to seeing what you do with it.
cheers
tubular
I am seriously thinking of getting the Altera demo board and USB programmer that Leon recently posted about. That one should have so much more than my imagination could handle.
Martin: nice idea !
Toby: that is a nice kickass board !
PLDs start under $1 for a 16V8, which can manage a Chroma-modulator, and the CPLDs from Lattice (LC4032ZE) are under $1.50, as are the X2C32A from Xilinx, and the ATF1502 series from Atmel is sub $2.
Moving up from the classic CPLDs to the 'FPGA CPLDs', I see the Actel A3PN030-Z are now showing in Mouser stock for $3-3.50 /100, which is a good price for what they claim to be ~256 Mcells.
The Lattice ~640 MC MachXO2 is ~ $6/100, no release yet on the smaller siblings, but likely to be on the same price curve.
Altera MAX V, in a fine qfp, are $1.70 for ~64MC
and on the 'Small PLD' in every sense of the word, I see Silego now are showing their new GreenPAK2 !!.
29c/100+, and a Pgmr for $49.
http://www.silego.com/buy/index.php?main_page=index&cPath=48
Their first generation GreenPAK (1) was narrow supply, and only 8 pins, so we never quite found an app, but the new ones are 12 pins, and wide supply, so are much more flexible. I'm sure those will be designed in here.
Their USB Boards, include some nice instrumentation features - which show what can be done, once you break the shackles of a FTDI Serial chip, and move to a Small Microcontroller.
Parts are OTP, but I think they have a RAM-loader mode, which coupled with the instruments, mean you can test most things before burning one.
I will have to come out from underneath my stone, and start to use the Far East markets.
@ Ale. Thanks, it was a bit thirsty on power as it wasn't a low power chip.The board took about 180mA running MBasic via CP/M (still better than my old Nascom did, that was about 3-4 Amps in total ;-))
So I never put the kit together. Found it just the other day in a box:
-Tor
@tubular: I originally started this on an Altera and would like to support both. For whatever reason I got a lot of momentum going on the Xilinx side and was able to reach this stage with it first. Mostly because, after hours of work, a system crash munged the Altera files so bad they wouldn't load anymore.
With Z80 FPGA emulations being available, it should be feasible to emulate the Nascom 1 and 2.
You know I've heard a lot of people say this.
Why do you prefer Altera? Is there some advantage they have over Xilinx?
Nice work Martin!
Regards,
Coley
Another good part about Altera are the programmers. The least expensive jtag programmer (clone) for Xilinx is about $50 while you can buy the USB Blaster for $15 (free shipping) on eBay.
Another thing that makes the Altera MAX II a little bit better is the build-in oscillator and a small user accessible EEPROM block on the chip.
Then again, it may be more fair to compare the CoolRunner to MAX V.
Just my $0.02...
Correct - the CoolRunner has the older, more classic CPLD of wide-AND macrocells, with very deterministic timing.
The newer CPLDs, like MAX V and Mach XO2, are more granular (FPGA like) and the closest device to the MAX V is presently the Lattice Mach XO2, which has the edge, in having RAM on board, and a regulator.
The MAX V goes smaller in device size, (so gets under $1), whilst the Mach XO2 has only one member priced so far, but it gives more 'macrocells' & RAM than the closest Altera part.
A complete MachXO2 kit, is just $29.. Someone will do a MachXO2 + Prop PCB ?
http://www.leonheller.com/Prop-CPLD/Prop-CPLD.pdf
http://www.leonheller.com/Prop-CPLD/prop-cpld_layout.GIF
Looks quite good to me.
With the 100 pin footprint, you could update that to the larger and much cheaper LCMXO2-1200HC-4TG100CR1,
with some simple track shuffling ?
Add in a CP2105 for a Dual serial link, and it would be universlly useful