PDA

View Full Version : PK3Err0040: The target device is not ready for debugging



rocket42
- 19th July 2014, 10:49
hello, everyone
I am developing application using PIC18f4620
My framework: MPLAB IDE v8.70, mcc18 v3.31, and Microchip PICkit3
- The first, I set pickit3 as programmer (in mplab ide, I seleced "Programmer>select Programmer>PICkit3"):
Now, I programed it (programmer>program). it was successful.
and then I ran it. My application ran correctly.
- Now, I want to use PICkit3 for debugging
+ close PICkit3 in Programmer mode (Programer>select Programmer>none)
+ Set PICkit3 as Debugger (Debugger>select tool>PICkit3)
+ I recompiled application with DEBUG mode (Project>Build configuration>Debug)
+ reprogram application (Debugger>program)
+ now, I run debugging (Debugger>run or press "F9"):
the following error raised:
"PK3Err0040: The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding."
I solved this problem as following:
- recheck PICkit3's debug support for pic18f4620 through "Select Device" window (configure>select device...): in debuggers, PICkit3 led indicator is green. So pic18f4620 is supported by pickit3
- My configure code is:
#pragma config WRTC = OFF //Configuration Register Write Protection
#pragma config DEBUG = ON //Background Debugger Enable
#pragma config WDT = OFF //WDT disabled (enabled by SWDTEN bit)
#pragma config OSC = HSPLL
#pragma config BOREN = OFF //Brown-out Reset is Disabled
#pragma config PBADEN = OFF //PORTB<4:0> digital on Reset
#pragma config LVP = OFF //Low Voltage ICSP is disabled

I don't understand why it is false.
Please suggest me the solution. thank you very much!

pedja089
- 21st July 2014, 18:20
#pragma looks to me as C, this is basic forum...
MCLRE must be ebnabled, PWRT disabled, code protect disabled.

Dave
- 22nd July 2014, 11:24
Thats what I thought, I also don't know what "mcc18 v3.31" is? Maybe Microchip "C" forum is the place for the correct answer?

Archangel
- 22nd July 2014, 17:02
Google to the rescue:
http://gcc.gnu.org/onlinedocs/cpp/Pragmas.html