• AVR Freaks

AnsweredHot!PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 4

Author
Idodio
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2020/09/16 04:53:25
  • Location: 0
  • Status: offline
2020/11/23 07:23:01 (permalink)
4 (1)

PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 4

Hello,
When I try to debug the device(PIC18F27K42 using MPLAB X IDE V 5.15) with PICkit 3 I get the following error:
"Address: 200405 Expected Value: d8ea Received Value: d8e8
Failed to program device"
 
And when I try to debug with ICD4 I get this one:
"Verify of debug exec failed
Could not enter debug mode because programming the debug information failed. Invalid combinations of config bits may cause this problem"
 
When I program without the debugger I get no errors.
#1
mbrowning
USNA79
  • Total Posts : 1846
  • Reward points : 0
  • Joined: 2005/03/16 14:32:56
  • Location: Melbourne, FL
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 11:37:21 (permalink)
+1 (1)
I haven't used my ICD4 yet, but I use V5.15 and PK3 with 56/57k42 frequently with no issues in debugging. I suppose compiler version is probably different - I use 2.05 - what's yours?
 
Address 0x200405 is in a reserved area. debug executive?
 
Since the ICD4 message gives more detail and suggests config bits could be at fault, why don't you show us your config settings?
#2
NorthGuy
Super Member
  • Total Posts : 6467
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 14:06:05 (permalink)
+1 (1)
Most likely this is because your PIC cannot run. For example, because you use an external crystal or oscillator which either is not connected correctly or doesn't work.
 
You first need to check if the PIC runs Ok. Create a LED blinker and run it without the debugger. If it works, your PIC can run. Then you can start working on the debugging.
#3
ric
Super Member
  • Total Posts : 29435
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 14:09:14 (permalink)
0
That doesn't explain the verify error messages...
 

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#4
NorthGuy
Super Member
  • Total Posts : 6467
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 14:58:31 (permalink) ☼ Best Answerby Idodio 2020/12/09 03:08:50
+3 (3)
ric
That doesn't explain the verify error messages...



Thank you for bringing this up. I think you're right. I didn't read the message well. In fact, didn't notice the PICkit3 message at all. And it is telling more.
 
I have an idea of what this could be.
 
Microchip tools may forget to erase the debug executive. Usually, this is not a big deal because the debug executive is always the same. So, programming without erase still succeeds. But, if an old debug executive was on the chip and they want to upgrade to a newer debug executive (or if some non-Microchip tools have programmed a different debug executive) then re-programming without erase will fail. Like, in your case, they try to program 0xD8EA, but bit 2 is already programmed (set to '0' as opposed to '1' for an erased flash), so bit 2 stays at '0' giving 0xD8E8. I've seen this before (not remember which chip though).
 
Another explanation is that the flash at this address is damaged. I've seen similar damages which only affect one address too.
 
In either case, if you take a different brand new chip, the problem should go away.
#5
dan1138
Super Member
  • Total Posts : 4162
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 15:33:44 (permalink)
0
@NorthGuy,
 
Let me be clear, I do not think that the device programmer the Original Posters(OP) is using is burning out the debug executive flash space. The OP should follow your suggestion and try a brand new, never before programmed chip.
 
If the program/debug executive space is corrupt a chip erase done using high voltage programming mode should erase that space. I am not sure that the PICkit3 or ICD4 will do this if the programming executive is in place and responds correctly.
 
The OP may need a device programming tool that can issue a chip erase without activating the programming executive.
 
Something like this happened to me some years ago.
 
I used a PICkit3 for in circuit programming a few thousand PIC24FJ256GB106 controllers.
 
Fourteen fail to program and could not be recovered even after a chip erase.
 
It turned out that one location in the area used for the program/debug executive failed with a bit stuck at zero that would not erase.
 
I switched to using a RealICE and have not see this kind of failure again.
 
While I suspected that the PICkit3 was responsible for the burnout I could not prove it.
#6
NorthGuy
Super Member
  • Total Posts : 6467
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 17:18:38 (permalink)
+2 (2)
dan1138
... a chip erase done using high voltage programming mode should erase that space.



There might be some tricky method to erase debug executive with the bulk erase, but normal chip erase, even if done with high voltage, doesn't erase the debug executive. The debug executive persists through the erase. I've tried right now:
 
>NSREAD 200400 200410 -d PIC18F25K42 -h
200400: d017 0000 d015 0000 |........|
200408: d013 0c4e 0c53 0c44 |..N.S.D.|

>NSPROG e -d PIC18F25K42 -v -h
NSPROG 142 (C) 2015-2020 Northern Software Inc. All Rights Reserved.
Target device is PIC18F25K42.
Connected to NSDSP100000000 Version 0103.
Communications with target device established at 6000kHz.
Erasing ... Done
Operation complete. Time elapsed 0.140s.

>NSPROG b -d PIC18F25K42 -v -h
NSPROG 142 (C) 2015-2020 Northern Software Inc. All Rights Reserved.
Target device is PIC18F25K42.
Connected to NSDSP100000000 Version 0103.
Ranges to be verified:
   code   0x00000000-0x00008000: 512 rows
   config 0x00300000-0x0030000a: 5 words
   userid 0x00200000-0x00200010: 8 words
   eeprom 0x00310000-0x00310100: 4 rows
Communications with target device established at 6000kHz.
Reading ... Done
The chip is blank.
Operation complete. Time elapsed 0.624s.

>NSREAD 200400 200410 -d PIC18F25K42 -h
200400: d017 0000 d015 0000 |........|
200408: d013 0c4e 0c53 0c44 |..N.S.D.|

 
Thus, some special methods are needed. I erase row-by-row. Microchip may use some other undocumented method.
#7
upand_at_them
Super Member
  • Total Posts : 765
  • Reward points : 0
  • Joined: 2005/05/16 07:02:38
  • Location: Pennsylvania
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 18:02:43 (permalink)
0
Is the debug executive more than just the DEBUG config bit?
#8
ric
Super Member
  • Total Posts : 29435
  • Reward points : 0
  • Joined: 2003/11/07 12:41:26
  • Location: Australia, Melbourne
  • Status: online
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 18:15:12 (permalink)
+1 (1)
upand_at_them
Is the debug executive more than just the DEBUG config bit?


Yes, it is a small program written in PIC machine language that handles talking to the debugger via the ICSP pins.

I also post at: PicForum
Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
NEW USERS: Posting images, links and code - workaround for restrictions.
To get a useful answer, always state which PIC you are using!
#9
dan1138
Super Member
  • Total Posts : 4162
  • Reward points : 0
  • Joined: 2007/02/21 23:04:16
  • Location: 0
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 18:18:22 (permalink)
+1 (1)
@NorthGuy,
 
The behavior of the bulk erase command depends on the contents of the Program Counter.
 
The region that holds the program/debug executive (0x200010 - 0x2FFFFF) is defined in the programming specification as "reserved".
 
Perhaps if the PC has the value 0x200400 when the bulk erase command is issued the "reserved" region would get erased.
 
It looks like I am wrong about this region being erased when using High Level Voltage Programming(HLVP). Although HLVP could be a necessary but not sufficient condition for bulk erase to act on this region.
 
Unlike you I don't have my bit-banged PIC programmer setup and working at present. It's on my list of things to do.
post edited by dan1138 - 2020/11/23 18:21:10
#10
NorthGuy
Super Member
  • Total Posts : 6467
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 20:36:35 (permalink)
+1 (1)
dan1138
Perhaps if the PC has the value 0x200400 when the bulk erase command is issued the "reserved" region would get erased.



This is a definite possibility. There are lots of undocumented features.
 
I once worked with bulk erase on one of the PIC18 J series. I was doing something wrong and it didn't want to erase. Then, all of a sudden, it mutated to a different part number - with more memory. All the extra memory was working and the PIC id has changed. I have no idea what I did. I'm not even sure this was a direct consequence of my actions.
 
But I'm sure there are lots of undocumented things out there.
#11
NorthGuy
Super Member
  • Total Posts : 6467
  • Reward points : 0
  • Joined: 2014/02/23 14:23:23
  • Location: Northern Canada
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/11/23 20:36:36 (permalink)
0
duplicate
#12
Idodio
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2020/09/16 04:53:25
  • Location: 0
  • Status: offline
Re: PIC18F27K42 MPLAB X IDE V 5.15 can program but can't debug with both PICkit 3 and ICD 2020/12/09 03:10:22 (permalink)
0
Using a new chip made the problem go away.
Thanks for the answers!
#13
Jump to:
© 2021 APG vNext Commercial Version 4.5