# PICkit 3 requires device erase in IPE before programming in MPLAB-X

I'm seeing a new behavior of my PICkit 3 that I did not have before. I hope someone can point me to a direction, it seems that I either messed with some MPLAB-X configurations, or my PICkit 3 is simply broken.

Device: PIC24FV16KM204 MPLAB-X: 1.90

During firmware development I usually could just program my device at any time after I made some changes to the firmware. I could also debug my project at any time. Now the PICkit 3 always returns the error message "Failed to program device" when the device is not empty. So after each Firmware change, I'm currently closing MPLAB-X, starting the IPE, erasing the device and finally restarting MPLAB-X. Then I can successfully program the controller without error message.

What I have checked so far:

• The project properties / Config PICkit3 / Program Options have a default setting for erasing everything before a new programming.
• My configuration bits in the firmware disable the write protections (FBS and FGS)

This is the output of the PICkit 3:

Connecting to MPLAB PICkit 3...
Firmware Suite Version.....01.29.08
Firmware type..............dsPIC33F/24F/24H

Target detected
Device ID Revision = 0

The following memory area(s) will be programmed:
configuration memory

Programming...
Calibration memory
Failed to program device


Any hints are greatly appreciated. Regards,

• Have you exceeded the maximum number of times you can reprogram the device? Try a new device. It might be getting borderline between failure and working... – Spoon Oct 27 '15 at 19:53
• Or alternatively the calibration register for the oscillator should be non zero... I recall I had to make a note of it so it could be reprogrammed next time. Very Silly error message tho – Spoon Oct 27 '15 at 20:03
• I'm using an external crystal so I don't think I need to configure the calibration register. However I'm new to the PIC24 world and will check the datasheet once more about this. In the meanwhile I got hold of a ICD3. I can program the µC without problems. But with the PICkit 3, the reprogram still fails if I didn't erase the part before. – Ulminpoika Oct 29 '15 at 7:19