Tuesday, October 29, 2013

Fun with the Microchip PICKit 3 and the Sure Electronics DB-UD11111 ZIF adapter

For many years now I've been using my old, trusty Picstart Plus programmer for my PIC-based projects.  Having used PICs since about 1990 - and having a reasonable suite of development tools, including the CCS C Compiler.

Since (before?) the introduction of MPLAB-X a while ago, the Picstart Plus was not been actively supported - and it never did/will support some of the newer, fancier devices anyway, so I started to look around for a replacement.

I quickly came to the realization that the most reliable path to the newer chips was the PICKit 3, a USB-based device which is much more convenient - and faster - than the serial-based Picstart Plus, but I soon realized that in order to use it with a wide variety of devices I'd need to have some sort of external board with several different sockets on it:  Unlike the Picstart Plus - which would actually "rewire" itself to program about any PIC you threw at it, the PICkit 3 simply had several pins on it which connected to the user's board or to an external socket using the ICSP (In-Circuit Serial Programming) capabilities of modern PIC processors.

In looking around the web I spotted the Sure Electronics DB-UD11111 for just $9.95 - and it looked as though it would fit my needs:  It was fairly cheap and it looked as though it would be able to handle most of what I needed it to do having 40, 20 and 18 pin ZIF (Zero-Insertion-Force) sockets to accommodate the different PICs.  While it appears to have been originally designed for the PICkit 2, the same ICSP programming is used in the newer PICkit 3 so it would work equally well for both.  At $9.95, I knew that I would probably have trouble even buying three ZIF sockets for that price!

Comment:
It would appear that the Sure Electronics DB-UD11111 has vanished from the above web site (at least I couldn't find it there!)  It does seem to be available from other vendors on the web for a higher price than the original $9.95 and, at the time of this update (August 2015) it seems to be available on EvilBay, being sold by Sure Electronics in their very own store for around $15 - search for "DB-UD11111".
I'm sure that there are other ZIF socket arrangements that will permit the PicKit 3 to work with a wide variety of devices, but I am not familiar with them.

Several weeks after placing the order with Sure, both it and the PICkit 3 arrived from China and I sat down to study the board.

Unfortunately, the documentation supplied is very sparse to say the least as it is just a .PDF of the schematic diagram of the board!  In looking at the board - which seems to be fairly well built but a bit awkward to use (more about that shortly) - I could see that it was labeled for 18, 20 and 40 pin devices.


What about programming  8, 14 and 28 pin devices?

In seeing the 18, 20 and 40 pin sockets, I wondered about the other devices.

To answer this question looked at the data sheets for typical 8, 14 and 28 pin devices (e.g. PIC12F675/683, PIC16F688 and PIC18F2620, respectively) on the Microchip web site and compared them to the schematic of this ZIF board to satisfy a hunch - which I verified to be correct:  Microchip had thoughtfully placed the Vdd, Vss, Vpp, PGC and PGD pins - everything that you'd need to program modern PICs - in locations that physically translated to the the appropriate pins on different package sizes of these PICs.

In other words:
  • 18 pin PICs:  You program those in the 18 pin socket - that's obvious!
  • 28 pin PICs:  The programming pins on the 40 pin socket also align physically with those on the 28 pin PICs, so pin 1 of the 28 pin devices go in pin 1 of the 40 pin socket.
  • Figure 1: 
    The PICkit 3.  As you can see I
    added a label to remind me of the
    "power" configuration to make it
    work with devices plugged into
    the passive ZIF socket adapter.
  • 20, 8 and 14 pin PICs:  The connections on the 20 pin socket physically align with those required on both 8 and 14 pin PICs, so use that socket, aligning pin 1 of the 8 and 14 pin devices with the socket's pin 1.

Making it work:

After getting the PICkit 3 and firing up MPLAB, I initially had trouble getting it to see any PICs at all - that is, until I remembered that the PICkit 3 had the option of powering the PIC chip being programmed - or not. As it turned out, it defaults to "not" so I had to go into the "power" sub-menu and check the box that told the PICkit to power the target device.

After that, I could read and write to a PIC16F88.  "Great!", I thought,  so I tried a PIC12F683 - an 8 pin device.

No dice!

Hmmm...

Using an ohmmeter I verified that all of the pins went where the schematic said that they should go (they did) so why didn't the PICKit 3 "see" the 12F683?

On a hunch I put the voltmeter on the power supply pins of the PIC and saw about 4.75 volts - lower than the 5.00 volts that I'd selected in the "power" menu.  Setting it to 5.5 volts, I saw no change, so I dropped it to 4.5 volts and not only did the voltage on the PIC now read 4.55 volts (close enough!), but I could now read and write to the PIC12F683!

What's the deal, then?

As it turns out, the PICkit 3 gets its voltage for powering the PIC being programmed from the computer's USB port which, by definition, is somewhere around 5 volts - and in the case of this particular computer was right at 4.85 volts.  What this means is that the PICKit3 could never supply more than about 4.75 volts to the PIC as there is about 0.1 volts drop within its circuitry.
Figure 2:
The Sure DB-UD11111 socket adapter.
It's pretty well built, but the cover gets
in the way of the levers!  After
taking this picture I took the cover
off, saving it by sandwiching it
on the bottom cover to avoid
losing it somewhere.

What seemed to be happening was that at a voltage that was "too high" to be supplied by USB connection, the Vdd being supplied to the PIC could not be regulated by the PICkit 3 and was likely "dirty."

Setting it to a lower voltage safely below that which was provided on the USB port - say, 4.5 volts - "fixed" this problem.

Unfortunately, there doesn't appear to be a way in MPLAB to have it supply power to the target device by default so I have to remember to re-select these anytime I make a change to the configuration or start the program.  After a bit of fiddling I "discovered" that if you exit MPLAB (Version 8.9x) with the unit configured for 4.5 volts that it may remember that voltage setting next time it is powered up - but it still seems to require you to tick the box for the PICkit supplying power to the target device and verify that the programming voltage is still set to 4.5 volts.

In further testing with a few different PICs I found that I could read/write them at least as low as 3.5 volts, but I couldn't immediately find a specification as to the low end of Vdd range.  Since I was not using LVP (Low Voltage Programming) and the PICkit 3 was supplying the Vpp, this specification is likely somewhat relaxed for most devices.

One suggestion that has been made online is to connect the PICkit 3 to a powered USB hub that is supplied with 5.25 volts.  Interestingly, the voltage specification for USB 2.0 is 5.0 volts +/- 0.25 volts so their inclusion of 5.5 volts as a  valid programming voltage would never be satisfied by an in-spec USB connection!

A few more comments about the Sure DB-UD11111 socket adapter:

This socket adapter is built fairly well, but I removed the translucent top cover after taking the picture in Figure 2 as it also somewhat obscured the silkscreen notation on the board, including the indication of the location of pin 1 of the connecting cable. (it's the white wire on the right, if you are curious).

Another problem with this cover is that it gets in the way of the levers on the ZIF sockets:  You may need to use either your fingernails or a small tool to operate some of these levers unless you have fairly small fingers.

Was removing this cover much of a loss?  No, since I'll just make some labels, anyway to remind me where/how to orient 8, 14 and 28 pin devices.

On the bottom plastic cover on the board I attached some small, stick-on rubber feet to keep the unit from sliding around on the desk, as well.

Some final comments on the PICkit 3:

In the forums, blogs and comment boards, the PICkit 3 has been oft-maligned - and I can see why:  It is decidedly less user-friendly and idiot proof than the Picstart Plus in many ways as there are many things that can go wrong - particularly if you have integrated a PIC with ICSP in your project where there is more than jut the PIC being programmed to deal with.

To be sure, the "problem" with the Vdd supply being derived from the USB power source is a problem for those who use the PICkit 3 to supply power to the target device - and it would be really nice if there was the option in MPLAB to allow all of the power options to "stick":  A warning comes up anyway about powering 3.3 volt devices from 5 volts, so why not have that warning include any settings that you have overridden, too?

In my (thusfar) limited use, it is much faster than the Picstart Plus and it has been very reliable - once you know the tricks - with it being powered entirely by the USB interface, which is much more convenient than the Picstart with which required not only a USB-to-serial adapter to work with my laptop, but also a "wall wart" just to power the programmer.

Additional comment:

I occasionally have trouble programming PIC12F675's and PIC12F683's with the PICkit 3 because of this same problem.  In those cases, attaching a separate Vdd supply of 5 volts to the programming socket - to power the chip being programmed - always solves the problem.

I have no idea why it works most of the time and then fails at other times...

Why PICs?

These days, the PICs seem a bit passe to many as the Arduinos and their variants have caught the fancy of many experimenters.  True, there are many "shield" modules with lots of cool peripherals to be found and, perhaps most attractive of all, huge libraries of code available to get done what you might want to do.

While I have used the pre-built Atmel/Arduino devices peripherally (pun intended!) and they look cool, they have usually been a bit of an overkill - and certainly much more expensive (hardware-wise) than just a PIC and a few parts.  In most cases, when I have a project, it would take a bit of effort to shoehorn an already-made Arduino board into place to fit my needs than it would have been to simply design the device from the ground up to do just what I need:  After all, to get the processor, alone, working it may take as little as a capacitor, IC socket (in some cases, less than $2 in parts) and the processor itself to provide the basis of the hardware to which the rest of the project to which you'd need to connect any processor that you might use (PIC or not) to the rest of the project!

Since I have long had the development tools for the PIC (e.g. CCS C compiler, since the "Version 2" days) and was familiar with it, I already have a fairly large library of my own code from which to borrow - and occasionally, I may even "borrow" some ideas from other platforms as well!

In doing my PIC projects I have found the 8-pin devices to be the most all-around useful as it is often the case that just 6 I/O pins is enough to do what I need to do - anything from flashing some lights to controlling a fire siren to even doing some audio DSP/filtering - and I've probably dropped hundreds of these things into projects that I did on my own and for others.  Where 6 pins of I/O isn't enough, the 18 pin devices are about the right size for most other things - but I have used the 14, 28 and 40 pin devices where it made sense to do so!

Having said that, the Arduinos do look fun and one of these days I may just try one of the "canned" boards and then think how I might incorporate that into another project.  More likely, though, I'd probably just build something around the raw chip itself - just as I've been doing for years now with the PICs...


Update:
Since this was post was originally written I got another PicKit 3 and DB-UD11111 adapter - just so that I would have two:  One for the bench, and one for "on the go" when I needed to haul the programmer somewhere else, or for those times that I can't find the other one because there's too much junk on the workbench!

[End]

This page stolen from ka7oei.blogspot.com

5 comments:

  1. It's good that this adapter can be used to connect the different devices.

    Thanks
    Charlie Electra

    Buy Electronic Products

    ReplyDelete
  2. ty for this post , helped me alot u deserve a bunch of thanks =D

    ReplyDelete
  3. very helpful.. thank you :)

    ReplyDelete
  4. Couldn't find a device list... Can the Pickit/DB-UD11111 program non PIC devices? Generic Flash chips, ex. AM29F004?

    ReplyDelete
    Replies
    1. In theory, the UD11111 could be used to program a wide variety of serially-programmed chips, but...

      I don't know the extent that the PICKit2 or 3 (you didn't specify which) will support "other" brands than Microchip, but if one uses one of the many "compatible" 3rd party programmers that could have some custom firmware, it should be possible to re-jumper (possibly flying leads) to connect the appropriate lines for many different chips.

      It would appear that the example that you give - the AM29F004 - is not serially-programmable based on a very quick overview of the data sheet.

      One inexpensive possibility is to use a "universal" programmer like the "MiniPro" TL866CS (beware of counterfeit clones!) which programs a wide variety of devices - but I do note that the AM29F004 is conspicuous by its absence - although it does program the equivalent devices from other manufacturers which *may* work.

      Best of luck!

      Delete





PLEASE NOTE:


While I DO appreciate comments, those comments that are just vehicles to other web sites without substantial content in their own right WILL NOT be posted!

If you include a link in your comment that simply points to advertisements or a commercial web page, it WILL be rejected as SPAM!