I recently had a query from someone who had purchased the EEPROM programmer kit: they were suffering from occasional data corruption, and did I know why?
Honestly, I was a bit stumped. The project is really quite simple, and I’ve been testing it quite intensely whilst developing my own computer, and never seen this issue.
I’ve said before that the purpose of the kit was really just to save people a lot of horrible stripboard soldering while they were following the blog posts, but isn’t really a finished product with any guarantees. It’s more of an educational thing.
Nevertheless: it’s still a bit depressing when people have trouble with what you’ve made! I find remote-support to be a frustrating experience. I’m terrible at explaining how to fix things, or what I’d investigate first. I have to be there!
Just when I was about to respond with essentially the e-mail equivalent of an apologetic shrug, I then received another message from a different customer: did I know that it’s possible to corrupt an EEPROM if you fit it in the socket before you power-up the Arduino?
Ah.
This was something I’d never done. I always have the Arduino powered-up and ready to go before I fit an EEPROM.
The corruption occurs because for the first half-second or so after power-up, many of the Arduino’s I/O pins are in an indeterminate state. So if the /WE line is briefly pulled low, then whatever state the data lines are in will be written to whatever address is represented by whatever state the address lines are in (if you see what I mean).
The easiest fix for this problem is just to make sure the Arduino is powered-up before you fit the ROM. But there is a very easy modification you can make to the programmer if you want to be protected against doing this accidentally: fit a 4k7 resistor as a pull-up between /WE and Vcc.
The resistor holds the /WE line high while the Arduino is powering up, but doesn’t prevent the Arduino from intentionally pulling that line low during a write cycle.
Fortunately the /WE pin (27) is right next to the Vcc pin (28), so it’s quite a straightforward thing to add. If you have one of my kits already, then just solder a 4k7 resistor on the underside of the board, like this:
(Note that the PCB is purple in the photo because it’s my original OSHpark prototype. But the versions I sell in kits are green.)
But for anyone who buys a kit from now on: I’ve revised the PCB, and added an extra resistor to the parts-list.