One of the issues I've had during development of my servo controller are the limitations around accurate signal creation & capture.
- A 1440 pulse per revoltion encoder at a modest 3000 RPM results in 72,000 transitions a second - every 14μS.
- A PWM cycle @ 40Khz lasts just 25μS, with a 1% duty cycle adjustment being 250nS.
- Input step signals from controllers such as Mach3 are often expected to capture pulses as short as 1μS.
My Atmel AVR based design used hardware interupts to detect input changes (and fire a capture routine), and hardware timers to initiate output changes (and fire an output update routine). With these routines written in assembly, it's quite efficient, but there's still overhead in firing such routines, and that limits minimum delay between events. With multiple servos at higher speeds, there's event contention, with multiple input events firing very near (or during) the same time output events need to happen. I'd love to record your clocking pulse, but I'm busy pulsing these outputs....
Enter field-programmable gate arrays (FPGAs). If you're not aware, FPGAs are chips filled with "logic blocks", and reconfigurable interconnects. A hardware description language (HDL) or schematic tool is used to describe the desired function. "Synthesis" then converts this into a "netlist" of gates and connections. "Place and route" finally maps the design into the targetted FPGA device - which "logic blocks" to use for what and how to connect them (this is the most complex and time consuming part of the "build" process). The resultant bitstream can then be loaded into the device.
So, how much can you achieve with such a device? With enough real-estate for about two basic AVR processors, Xilinx's XC3S250E with 5,500 logic cells & 66 I/O can be had for ~$15. Meanwhile, a single XC6VLX760 chip with 760,000 logics cell & 1,200 I/O pins and will set you back ~$20,000 (and they've just announced a 3 times larger XC7V2000T with ~2 million logic cells!).
This all sounds good, but these high-tech devices can often be a right pain for the DIY hacker - expensive or difficult to source in small quantities, requiring complex support circuitry, physically difficult (fine pin pitch or BGA), etc. What you want, is someone to do the dirty work for you - put together everything in a nice module.
I've found a few options on development boards/modules (rough prices - only devices I can afford):
Each has it's pros & cons. For my purposes, I want:
Medium gate density - 100K is too small. 1000K is too much. 250K to 500k.
Onboard ROM - FPGA's need their configuration loaded after power-up & you don't want to connect a PC every time.
Medium number of IO pins - I need more than a few & less than a few hundred. Probably a few dozen.
USB programability - I want a device programmable via USB from my PC.
USB host device - I want a device usuable from my PC.
No human interface - if I want buttons or an LCD panel... I'll add it myself.
Plug in module - physical form suitable for inclusion in other projects.
Open Hardware - I want something I can tear apart & understand.
- Community support - I don't want to be alone!
I ended up settling on GadgetFactory's Papilio One (250K). I didn't think I needed the 500K version, and figured I could always get one later if needed.
Let the FPGA learning begin!
P.S. I found another review of cheap FPGA development boards.
P.S. (25-Jun-2011) Just found a new highly featured Altera based Terasic DE0-Nano board. At absolute bargain at $79 (considering the FPGA EP4CE22F17C6N & configuration flash EPCS16 chips alone would cost me $66 + $14 from Digikey).