Following the recent of funcards I dug a couple out of my junk box to have a play and realised I'd loaned out my "SmartProg DIGIT", the interface I've always used to program blank funcards. What to do? Build a new one of course!
I had a quick look at half a dozen AVR programmer designs out there for parallel or serial port. Several were similar, and some added a bit more complexity than is strictly necessary unless you're prepared to use a plugpack. I cut back to the basics and ended up with something you can make in an hour or two for around ten bucks. I don't claim any originality here - I've just rehashed what's already out there with a few changes.
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!
Look Here -> |
Great work gw1,
& very well explained, Thankyou,
Cheers
& only an afternoon project
Become a Premium Member and support the Austech Forum
great post. These are the posts I really enjoy.
Leroy
Thanks for sharing mate very nice indeed
When you do things right, people won't be sure that you have done anything at all
very nice
you have to much free time
Exceeded my wildest dreams.
Many Thanks and Kindest Regards, " The Druid "......
PS: Now I wonder why he did that?.....
Thanks Gw
My mutant veroboard phoenix interface needed a friend .
Does anyone know the part number of the smart card socket? TIA.
if you are going to build one coops just grab any old useless decoder and take the reader out of that
dont say linux if i wanted it id install it
The circuit is designed for Normally Open contacts - ie contacts close when card is inserted. I used but the (much cheaper) Rockby one should be fine provided it has N.O. contacts, not N.C. The datasheet for Rockby's part is ambiguous, unfortunately, so I recommend you email Rockby for clarification before ordering.
Normally Open parts are more common. Parts that have card contact pins at 90 degrees to the other pins are typically Normally Closed. Where the card contact pins are parallel to the other pins (though offset by a millimetre or two) it usually means the contacts are Normally Open.
If scavenging a smartcard socket from dead equipment then it pays to take extra care when desoldering, removing very carefully, because socket pins are easily ripped out and damaged.
If you have a Normally Closed socket you can still use it: wire the LED cathode to ground, and just leave the socket switch contacts unconnected.
Last edited by gw1; 10-06-09 at 07:08 PM.
I built the programmer yesterday and it seems to write the fun files OK but I'm damned if I can get the next step to work. I'm trying to put my goldie details on it using LMedit (via a jaycar mark II) and I'm getting nowhere...any advise?
BTW, the LED on your parallel port programmer is only to indicate the presence of pwr right? The one I built illuminates when I plug the programmer in but goes out once a card is inserted....is it functioning correctly?
I would expect the opposite. Is your led around the right way?
Leroy
It's all sorted now, I had a bit of a error on my pin 11 (busy).....now the led stays on permanently. ICprog verifies successfully and LMedit can write the details, I now have a funcard goldie.....8 yrs after everyone else but I've got one none the less. Thanks all to have helped, especially GW1 for originally posting the cct.
Now, any truth to the nds funcard rumour?
It's a great feeling when you get something built and sorted and then it actually works!
Leroy
Nice Product even better than a TPS 3101
This only for Funcards only not goldies?
Mick
Why stop guys here why not build the phoenix programmer as well
No need to buy kits or pre built programmer's .
Its a bit harder but fun to build .
Bookmarks