Saturday, March 31, 2018

Trick MPLAB-X 1.80 to offer debugging and programming support to Pickit 2 for PIC18F46K22

If you are a PIC programmer under Linux, you already have the pk2cmd installed, including support for the PIC18F46K22. If you use the MPLAB-X IDE, the programmer is painted in red for this microcontroller.

What follows, it works for MPLAB-X version 1.80, did not tried for the others. In the following folder, you will find the mplabinfo.jar archive:

/opt/microchip/mplabx/mplab-ide/mplablibs/modules/ext

Inside the archive is another folder structure. The file mplab.deviceSupport is what we need, and can be found in the folder showed bellow:

content/mplab/

Open the file for edit (as root) and search for the PIC18F46K22 word. On that line, the items mp:pk2d and mp:pk2p must be changed from "no" to "yes" values - you will understand once you see the content of the file.

Save the file (take care to be saved as a Windows file) back into the archive, go back to your normal user rights and start the MPLAB-X. On your project, you will see that the Pickit 2 programmer is now painted in yellow which means that the debug part is in beta stage for that microcontroller. I not tried it yet programming the micro from inside the IDE or the debug part but I will update the article with my result.

Update:

Now I've realized that you have to add an entry for the PIC18F46K22 into the pk2.xml file that is found in the PICKIT2.jar file. This jar archive can be found in the same folder as mplabinfo.jar archive. So it seems that a little more work must be done in order to fully trick the IDE...

Update2:

After adding the required entries in pk2.xml and pk2xs.xsd files, the pickit2 programmer won't even blink a LED. No support under Linux... :( Someday I will have my PicKit3 programmer/debugger, but not anytime soon.

P.S., I can't post the code here, Blogger removes anything XML.

No comments:

Post a Comment