Electronic – Programming Pins (PGC/PGD) problem on PIC32mx

microchipmicrocontrollerpic

I made a design using PIC32mx and everything is working well. I was trying to debug my first program and for this case instead choosing PGEC1 and PGED1 I am using PGED2 and PGEC2. Problably that's the reason why I am getting the following message while debugging:

The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding. The most common causes for this failure are oscillator and/or PGC/PGD settings.

This is the schematic I have done:

PGC/PGD schematic

Where can I modify the configuration bits to enable the debug mode?

Best Answer

The sentence to enable the debug mode for my case is:

#pragma config   ICESEL = ICS_PGx2