Writing 24LCxxx EEPROMs with PICkit3

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

My super duper programmer. Note: only pull-up pin 5, not pin 6. Here I’m using 2 x 1k8 in parallel for testing

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.

24LC64 is not acknowledging

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.

Occasional I2C ACK

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

One minute they’re still here…

…the next they’re gone.

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:

Greatly improved signal edges

Well, that looks aĀ lot better. And it makes the EEPROM happy, too:

Finally!

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…

8 thoughts on “Writing 24LCxxx EEPROMs with PICkit3

  1. Alex

    Hi, I’m trying to programm AT24C02 with PICIT3 chines clone.The shematics near pin 6 is a little different .What is the part PTS4 between TR3 and R 50 ? In my there are no PTS4 and if I remove R50 the pin 6 will be “in the air”.

    Reply
  2. remco Post author

    Hey Alex,

    If I’m not mistaken, you can treat the AT24C02 as a 24LC02 and the pinouts are the same.
    Now, I don’t know the schematic of your clone, but I’ve looked up what R50 and TR3 do in the original schematic here:
    https://c2.staticflickr.com/8/7037/26704675414_3cacc966d8_o.png

    It also shows PTC4 to be, well, a PTC (positive temperature coefficient resistor). Used to prevent overload during short circuit.

    hopefully you can find similar parts in your clone.
    Best,
    – Remco

    Reply
  3. Alex

    Hi,today I remove TR3 and R50 which were not as you show in your foto ,and connect pullup reziistor,and thanks God and you it worked.The problem solved and my best wishes to you.

    Reply
    1. remco Post author

      No idea! Probably those were protection components, so my next wiring error is going to cause a blowup of some sorts. Which should make for interesting content.

      Reply
  4. Gabor

    So you removed TR3 and R50, right?
    I’m not sure removing TR3 is necessary, is it?
    Do you still need the pullup resistors for SDA and SCK as well after the modification?
    Do you have experience with 25xx programming with pickit3? It also doesn’t work maybe because of same reason even the readme.txt doesn’t talk about it.
    Thanks

    Reply
    1. remco Post author

      It took me a day to figure out I don’t hate myself enough to spend time looking through Microchip’s obscure and incoherent documentation.

      You are obviously a lot smarter than me because instead of doing so you’re asking around. I am sticking with the original conclusion from this article: get an eeprom programmer. Probably a TL866A. And a beer. And in 5 minutes you’ll be done. With either one.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *