Programming in-circuit can be tricky is you have Vpp, data and clock pins tied to the application circuit.
Programming voltage on /MCLR needs to rise fast enough to prevent the program counter from incrementing. If it does not rise fast enough, your code previously programmed into the device can start executing, and it screws up the whole process. In this case, you're trying to program a PIC that's already executing code, and is no longer in program mode.
The internal RC osc makes the start-up process even faster, so it's even more critical for Vpp to rise fast.
Try lifting the pull-down resistor you have on /MCLR, and make sure you have the programming clock & data pins disconnected from any external loads.
External loads on data & clock pins will also screw up ICSP.
That should allow you to re-program & erase in-circuit without any problems assuming the PIC isn't dead.
Bookmarks