Olimex Support Forum

Microcontrollers => PIC => Topic started by: Gregor1971 on March 06, 2013, 01:22:03 AM

Title: debugging pic32-t795h
Post by: Gregor1971 on March 06, 2013, 01:22:03 AM
Hi,

i use mplab x and a pickit3 to progrgamm my pic32-t795h. That works fine and the blink example is running.

Now i just want to try showout some debug messags on the debug console. When i start the programm for debugging i receive the following message:

The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding.

Here is the configuration code i use:

Quote
// Configuration Bits
#pragma config FNOSC    = PRIPLL        // Oscillator Selection
#pragma config FPLLIDIV = DIV_2         // PLL Input Divider (PIC32 Starter Kit: use divide by 2 only)
#pragma config FPLLMUL  = MUL_20        // PLL Multiplier
#pragma config FPLLODIV = DIV_1         // 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           // CLKO Enable
#pragma config POSCMOD  = XT            // Primary Oscillator
#pragma config IESO     = OFF           // Internal/External Switch-over
#pragma config FSOSCEN  = OFF           // Secondary Oscillator Enable
#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_PGx2      // ICE/ICD Comm Channel Select
#pragma config DEBUG    = OFF           // Debugger Disabled for Starter Kit

Even after changing the pragma config DEBUG to ON the message appears again.

Any suggestions?

Thanks for your effort.

Regards
Gregor
Title: Re: debugging pic32-t795h
Post by: LubOlimex on March 06, 2013, 10:53:54 AM
Hey Gregor,

I believe you have configured the wrong ICSP channel for the debugging. MX795 has two ICSP channels and in PIC32-T795H we have used channel 1.

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

Should be:

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

Best regards,
Lub/OLIMEX
Title: Re: debugging pic32-t795h
Post by: Gregor1971 on March 07, 2013, 10:29:48 PM
Hello Lub,

thanks for your hint. It solved the initial problem.

Now i just tried to use the macro DBPRINTF to print some text to the debug console. Unfortunatly the message is not shown in the mplab x.

Do you have any ideas concerning this problem?


Kind regards,
Gregor
Title: Re: debugging pic32-t795h
Post by: LubOlimex on March 19, 2013, 12:04:59 PM
Hey Gregor,

I recommend you to head to the Microchip forums about the DBPRINTF console. There are a lot of topics covering the topic of debug console and MPLAB X. Unfortuantely, I don't remember ever using this console due to its slow speed.

Here are some of them:

http://www.microchip.com/forums/m564387.aspx (http://www.microchip.com/forums/m564387.aspx)
http://www.microchip.com/forums/m672844-print.aspx (http://www.microchip.com/forums/m672844-print.aspx)

Best regards,
Lub/OLIMEX
Title: Re: debugging pic32-t795h
Post by: Gregor1971 on March 28, 2013, 10:13:26 PM
Hi Lub,

thanks for your advise. I'll read at microchips-forum.

Regards Gregor