Search This Blog

Saturday, December 17, 2011

Programming 16F Series Pics WIth pk2cmd

   Okay, this has happened before.  I solved it and forgot how I did it.  Lesson learned.  Here is the problem and solution.  I'm using a PicKit2 programmer with the open source pk2cmd software on Linux to program my Microchip PICs.  Most of the time, I have no problem.  Today, my 16F88 simple failed to do an erase and verify blank.  After a ton of Googling, I found a post that suggested that the -X switch may help.  This switch raises VPP before VDD.  I tried it, and it works!  Here are some samples:

pk2cmd -ppic16f88 -x -e
pk2cmd -ppic16f88 -x -c
pk2cmd -ppic16f88 -x -mcp -fmyCoolProg.hex

More later!

EDIT: So, I had the same troubles with my PIC18F2455 the other day.  This freaked me out a bit because I don't have the picp software for my PicStart Plus programmer anymore, and I don't think it can program my 18F2455s.  I tried the trick above, but it didn't work.  After a few deep breaths, I fiddled around a bit more.  The PicKit2 could identify the chip correctly when I used autodetect ( -p ).  I tried an erase and verify with autodetect, and it worked!  So, if you have trouble, first try autodetect.  If that doesn't work, try the voltage trick above.  If it does work, try using autodetect:
 pk2cmd -p -e
 pk2cmd -p -c
 pk2cmd -p -mcp -fmyCoolProg.hex

Once this has worked, the PicKit2 was able to take a chip reference again with no problem.  I was programming 2 different chips ( 16F88 and 18F2455 ) back and forth rather rapidly.  I think the PicKit2 just got confused or failed to reinitialize after each programming effort.

No comments:

Post a Comment