Since it took me about 8 hours to fetch all the information together and get it running, maybe this post will be useful for other loonies like me who think this is a good idea 🙂
You see, the Microchip PICkit3 seems like a steal – a cheap, full featured PIC programmer that can also write EEPROMs!
Well, they weren’t lying. Then again, it’s not exactly the truth either.
First of all, you have to use a piece of software they don’t include – the PICkit3 programmer v3.10. It’s not easy to find as it’s not officially supported. Why? Well, because it’s not very stable. For instance, you can’t exit the program – it crashes! Also, when you unplug and replug your PICkit whilst the program is running, it’s no longer guaranteed to work.
Usually, you have to upgrade the firmware of your PICkit to something newer using Tools -> Download PICkit operating system. Newest firmware I could find is included with the programmer, version PK3OSV020005.hex.
Then, in the programmer, switch the PICkit from MPLAB mode to programmer mode. And then, the real work can begin…
Build your programmer
The ZIF socket that came with my PICkit3 did not support the 24LC64 foot print. So I breadboarded one. I tied the lines A0, A1 and A2 high; you can do anything you want, as long as you match it in the programmer software.
The following description is the correct pinout:
Connections for 24LC devices --------------------------------------- PICkit 3 Pin 24LC Device Pin (DIP) (2) Vdd 8 Vcc (3) GND 4 Vss (5) PGC 6 SCL (driven as push-pull) (6) PGM(LVP) 5 SDA (requires pullup) 7 WP - disabled (GND) 1, 2, 3 Ax pins Connect to Vdd or GND per datasheet and to set address
Yet again, this is not the complicated part.
This won’t work
So, after fiddling with this hurdle for a bit, I figured I could get on with my life. Not so lucky. The tool reported “I2C Bus Error (No Acknowledge)-Aborted“. Checking with the scope confirmed that.
Here the Rigol was set to trigger off a missed acknowledge – VERY useful function! If you look carefully, you’ll see how during 8 SCL cycles the controller writes the address 1010 000 to the EEPROM (in this case, A0, A1 and A2 were set to VSS) and waits for the EEPROM to pull the SDA line down during the ninth SCL clock cycle – which does not happen.
The first thing I noticed is how weak the SDA tristate transition is. The line rises way too slowly. So I reduced the pull-up resistors to 1k8 for strong pull-up, and turned off ‘fast programming’ which reduces the I2C speed to 100 kHz. And lo and behold, I got some acknowledges.
If you look carefully, you’ll see how right at the falling edge of the penultimate SCL pulse, the 24LC64 pulls the SDA line down, as the noise greatly reduces.
However, the tool still was still not having it, and I still wasn’t liking my SDA timing. Having done all I could, I ended up googling again until I found that small bit of text that I should have noticed in the readme file which came with PICkit programmer:
NOTE: The I2C (24LC) Serial EEPROM devices require the following PICkit 3 hardware changes to work properly: Remove TR3 from the PICkit 3. Remove R50 from the PICkit 3.
Erm… right. So yeah, the PICkit3 is compatible, as long as you rip its guts out?!
Butchering the PICkit according to the manufacturer’s suggestions
Really. It’s the weirdest Readme.txt I’ve ever seen, which manufacturer does that? What it does is remove a diode (obvious by its designator TR3…) and a series resistor that were probably protecting the inputs. Great. But it does work:
Well, that looks a lot better. And it makes the EEPROM happy, too:
So yeah, it worked. Was that fun? No. Should I have just gone off and bought an EEPROM programmer? Definitely. But I didn’t want to give up and now at least I can share with others. But my advice would be – go and get something better than a PICkit3…