Chipkit Uno32 Debug with mplabx

debuggingmicrochipmplabpicpickit

I bought a good night chipKIT Uno32 to use for projects. I am using the language of c32 with the MPLABX IDE and a pickit 3 debugger. Everything went well but when I want to debug a project, it says disposito not ready to debug (editor: Disposito likely means device), and I get the following message:

Programming / Verify complete
The target device is not ready for debugging . Please check your configuration bit settings and program the device before Proceeding.

What should I do? Here follows my bit configurations:

/ / # pragma config UPLLEN = ON / / USB PLL Enabled
    # pragma config = FPLLMUL MUL_20 / / PLL Multiplier
/ / # pragma config = FPLLMUL MUL_24 / / PLL Multiplier
/ / # pragma config = UPLLIDIV DIV_2 / / USB PLL Input Divider
    # pragma config = FPLLIDIV DIV_2 / / PLL Input Divcaider
/ / # pragma config = FPLLIDIV DIV_12 / / PLL Input Divcaider
    # pragma config = FPLLODIV DIV_1 / / PLL Output Divider
/ / # pragma config = FPLLODIV DIV_8 / / PLL Output Divider
    # pragma config = FPBDIV DIV_1 / / Peripheral Clock divisor
    # pragma config FWDTEN = OFF / / Watchdog Timer
    # pragma config WDTPS = PS1 / / Watchdog Timer Postscale
/ / # pragma config = FCKSM CSDCMD / / Clock Switching & Fail Safe Clock Monitor
    # pragma config OSCIOFNC = OFF / / Enable CLKO
/ / # pragma config POSCMOD = XT / / Primary Oscillator
    # pragma config POSCMOD = HS / / Primary Oscillator
    # pragma config IESO = OFF / / Internal / External Switch -over
    # pragma config FSOSCEN = OFF / / Secondary Oscillator Enable
    # pragma config = FNOSC PRIPLL / / Oscillator Selection
/ / # Pragma config CP = ON / / Code Protect
    # pragma config CP = OFF / / Code Protect
    # pragma config BWP = OFF / / Boot Flash Write Protect
    # pragma config PWP = OFF / / Program Flash Write Protect
    # pragma config = ICESEL ICS_PGx1 / / ICE / ICD Comm Channel Select
    # pragma config DEBUG = ON / / Debugger Disabled for Starter Kit

Best Answer

In order to use the debugger the debugging signals must be configured to communicate on the correct PGEC / PGED pair of pins. It's hard to find in the chipKIT Uno32 manual which pins are used for the programmer header, but it is a little easier referring to the schematic.

From that schematic we can see that the programming header uses pins RB6 and RB7. Looking at the data sheet for the PIC32MX320F128H chip those pins are PGEC2 and PGED2.

However, in your configuration, you have:

# pragma config = ICESEL ICS_PGx1 / / ICE / ICD Comm Channel Select

That will be attempting to communicate on PGEC1 and PGED1, which are pins RB0 and RB1.

If you change that to:

# pragma config = ICESEL ICS_PGx2 / / ICE / ICD Comm Channel Select

then you should find that debugging works.