How it works
Atmel AVR processors support a programming mode using +12V similar to that used by PICs, but most AVR programmers use its serial programming mode which requires nothing more than its usual Vcc which can be anything from 2.7V up to 6V. The serial programming mode involves holding down the processor's RESET pin while clocking the processor as usual, then sending commands using the AVR's ISP (in-system programming) interface consisting of three pins: MOSI (master out, slave in), MISO (master in, slave out) and SCK (serial clock). There are commands to enable programming, erase, read and write code and internal eeprom, lock fuses etc and they're performed by onchip microcode which is why the usual CLK input is still required. I won't get into the nitty-gritty of the programming commands but they're documented in the AT90S8515 datasheet if you're interested.
Funcards require two additional pins on ISO7816 smartcard socket for the ISP signals: C4 is used for MOSI, and C8 for SCK. I/O pin C7 is used for MISO. Pin C6 (ISO7816 VPP signal) isn't used for either PIC or AVR wafer cards.
Because all these signals only require TTL voltage levels and the ISP data signals are unidirectional it's a good fit for the PC printer port. A convention emerged years ago for mapping the funcard signals onto the printer port lines. (I'm not sure who authored it - somebody here might know.) Bits D0-D2 are set high during programming operations to provide power for the card. Bit D3 is toggled to provide the card clock, bit D4 provides reset, bit D5 provides data to the card, D6 is used to shift each data bit in turn, while the printer port's ACK input is used to receive data and status information back from the card. The BUSY input is traditionally high when printer is unavailable and low when online, and I've used this for sensing the card presence switch (most software probably won't utilise this though).
Small current limiting resistors are fitted to D0-D2 to protect the port from misprogramming while the device is plugged in. The cards don't use much current so the drop across the resistors is minimal but they have the effect of amplifying noise in the card's power supply so it's important to fit a capacitor across the card's VCC and GND pins. Some circuits include a zener diode across the power supply but there's no reason for this. The voltage presented to the card is likely to be either 5V or 3.3V depending on the port driver IC on your motherboard or parallel port interface.
I've also included a status LED to indicate when power is being applied to the card. You'll see that most software only powers the card during read or write sessions and powers down at other times for safe card removal.
None of the component values I've used are critical, except if you decide to use an electrolytic or tantalum capacitor (I used a multilayer ceramic) be sure to observe correct polarity. Don't reduce the LED current limiting resistor too far or there may be insufficient current left for programming.
Construction
There are several ways of building it. I thought about cutting up a printer cable but wedging veroboard into the end of a solder-tag DB25 male connector (Jaycar PP-0840) is more robust and probably quicker in the long run. Double-check your connector pin numbering before beginning and be sure to strip away the copper from beneath the connector pins to avoid shorts.
All of pins 18-25 on the DB25 connector are ground; you only need to connect one of them. I soldered to several in order to fix the connector more securely.
To program I normally use XP (SP2 or SP3) and (other versions will probably work too). I use the following configuration:
- In Settings | Options | Misc
- enable NT/2000/XP driver (restart afterwards) - In Settings | Hardware
- choose "Fun-Card Programmer"
- select Windows API
- leave other settings at default values - Choose device "90S8515"
- Use File | Open File and select your code file (eg "GhostFun v1.0.hex")
- Use File | Open Data File and select your internal EEPROM file (eg "GhostFun v1.0.eep.hex")
You will find that IC-Prog is able to detect the processor identifier on your card and will warn you if your selected device type doesn't match the card. 90S8515 and 90S8535 are equivalent for most funcard purposes but they have different identifiers so you may have to experiment.
If your interface is working correctly you'll be able to successfully perform a verify once you've programmed some files.
Note that there's no way of programming the external EEPROM data using this interface (no doubt somebody will correct me if I'm wrong here). It does the code and
internal EEPROM, but not the external one. To program the latter you need to use a loader; usually the emulator code includes loader functionality. So in other words
1. Put blank funcard in this interface on your parallel port
2. Program code and internal EEPROM using IC-Prog
3. Move the card to a phoenix interface on your serial port
4. Program external EEPROM using FMCard 4 and CRD files (eg "GhostFun.crd")
If I remember correctly LMEdit has a GPrep button which loads your external EEPROM for you, ie doing the equivalent of sending GhostFun.crd.
There are several commercial interfaces which let you specify the external EEPROM hex file at the same time as code and internal EEPROM and they program all three spaces for you at once. My old SmartProg-DIGIT does this, bless its expensive heart. They achieve this feat by first erasing the processor and loading a proprietary loader in order to fill the external EEPROM, and when done they do the code and internal EEPROM. For this reason they aren't able to read or write the external EEPROM without trashing (or at least reading out and rewriting) the internal code & data.
Have fun!