• AVR Freaks

Hot!ICD 4 debugging, debugger cannot step through parts of program

Author
Jungle Jim
Starting Member
  • Total Posts : 49
  • Reward points : 0
  • Joined: 2009/11/20 10:03:16
  • Location: Salisbury, U.K.
  • Status: offline
2020/06/27 05:07:23 (permalink)
0

ICD 4 debugging, debugger cannot step through parts of program

I suspect I have done something stupid or turned a setting off somewhere that has totally altered the ICD4 operation.
 
I have been using the ICD4 for 2-3 months with no problems debugging two different board designs using 16F884. I had some strange issues programming an old 16F690 with a header. When I went back to a 16F884 board the debugger operation had changed. Somewhere during various operations I used the MPLAB X (V5.25) command 'reset windows' and it seemed to me that it was around then that the ICD4 operation changed. After a lot of testing I assumed I had damaged the ICD4. I put in a support ticket but I have a deadline so I have bought another ICD4 as well.
 
The new unit works in exactly the same way as the original so either I have a problem with my hardware design, my interface cable, or a setting somewhere. The hardware has been fine for months so I doubt that. The cable continuity is fine, and ICD4 with this cable programs boards for production without issue.
 
When debugging, I build and download a program. I have set the debugger start-up to both 'run' and 'halt at reset vector', both immediately run. If I set a breakpoint very early on in the program it does not stop.When I pause and view the code, it has gone past the breakpoint (and it has run code and set parameters around the breakpoint so I know it went through it) and will be sat correctly running code somewhere else.
 
Reset does not appear to reset to the reset vector either. If I press reset and single step, the PC is still in the same place in code as before pressing reset.
 
I have pruned everything down to a bare minimum code as a test with the same results, which I have uploaded. I have commented where a breakpoint is missed. Does anyone know what is happening?
I have just had a thought, we had a windows 10 update recently. Is this a coincidence?
 
EDIT: I have tired this before and after applying debugging fix 1.2.804, still the same results
post edited by Jungle Jim - 2020/06/27 05:15:39
#1

13 Replies Related Threads

    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/27 14:01:57 (permalink)
    0
    Hello Jim,
     
    For anyone who needs to reproduce this could you answer these questions?:
     
    1) What MPLAB X IDE version are you using when you see the issue with your pruned-down 'test.asm' snippet? Is it still MPLAB X IDE v5.25 you are using?
     
    2) Could you share your schematic portion regarding the circuitry 'PGM' pin? I am not 100% certain the side-effects if this pin gets asserted (if it is floating) during a debug mode.
     
    3) What silicon Revision ID does MPLAB X IDE report? (This is related to #2 above.)
     
    4) Based on your BOR setting it sounds like you might be supplying the PIC16F884 5 volts (w.r.t. Vss) -- is that correct?
     
    Thank you.
     
    Best regards,
     
    Ken
    #2
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/27 14:51:51 (permalink)
    0
    Ken_Pergola
    2) Could you share your schematic portion regarding the circuitry 'PGM' pin? I am not 100% certain the side-effects if this pin gets asserted (if it is floating) during a debug mode.

    The CONFIG setting shows "LVP_OFF", so why should that be a concern for an active debug session?
    I agree, the PGM pin is often the culprit if the chip can't be programmed at all.
     

    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!
    #3
    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/27 15:23:09 (permalink)
    0
    ric
    Ken_Pergola
    2) Could you share your schematic portion regarding the circuitry 'PGM' pin? I am not 100% certain the side-effects if this pin gets asserted (if it is floating) during a debug mode.

    The CONFIG setting shows "LVP_OFF", so why should that be a concern for an active debug session?...



    Hi Ric,
     
    Yes, of course -- I saw 'LVP_OFF' as well. I just have never run experiments during a debug session to be 100% certain whether asserting the 'PGM' pin causes any detrimental side-effects during debugging. I should have been more clear about my post but that is all I was trying to get at. I probably should not have mentioned it at all but I like to leave no stones unturned so things can be ruled off the table.
     
    Best regards,
     
    Ken
    #4
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/27 15:34:42 (permalink)
    0
    Thanks Ken. Was just curious if you were aware of some new danger with that pin. :)
    this whole problem sounds like the sort of thing thta happens if the programmer has firmware from a newer MPLABX release installed, wihch can play up iof you then go back to an older MPLABX.
    In that case, forcing a full re-upload of the ICD firmware can help.
     

    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!
    #5
    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/27 15:51:20 (permalink)
    5 (1)
    ric
    ...Was just curious if you were aware of some new danger with that pin. :)...

     
    Hi Ric,
     
    Yeah, it was a long time ago but I remember getting bitten by the 'PGM' floating issue when our Development Tools group was supporting the new PIC16F88x family with the MPLAB ICD 2 tool. I contacted the silicon group and it eventually led to the errata. I would have hoped that if it affected debugging in some obscure way, extra verbiage regarding 'debugging' would have been added in the errata document.
     
    These are horrible problems for customers to experience so I would like to help Jim overcome this issue. I am trying to get more details to help determine the exact root cause. If it can be reliably reproduced the chances for finding the root cause quickly are much greater and I can write up an internal bug report.
     
    Best regards,
     
    Ken
     
    #6
    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 01:34:23 (permalink)
    0
    Hi Jim,
     
    The MPLAB ICD 4 debugger (or any debugger for that matter for this device) is going to need to control the '/MCLR' pin for resetting and running the part in a debug session.
     
    Did you inadvertently change the configuration bit setting from '_MCLRE_ON' to '_MCLRE_OFF'?
     
    Please change it to '_MCLRE_ON' and let us know if it at least solves your debug reset issue.
    Then we can focus on your breakpoint issue.
     
    Are you at liberty to share the schematic portion of your ICSP/debug connections to the PIC16F884?
     
    Best regards,
     
    Ken
    #7
    Jungle Jim
    Starting Member
    • Total Posts : 49
    • Reward points : 0
    • Joined: 2009/11/20 10:03:16
    • Location: Salisbury, U.K.
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 02:28:49 (permalink)
    0
    Hi Ken,
     
    [EDIT] sorry Ken, just spotted your later post after answering your first one. I have changed MCLR to ON and my reset now works as expected :-) However I have just looked back at every project I have ever written and they all have the MCLR off setting and never had issues with the ICD3. Is that possibly different between ICD3 and ICD4?
     
    Thank you very much for your help.
     
    I'll leave the answers to your earlier question in case it helps anyone in the future
     
    I am still using MPLAB X IDE v5.25
     
    I have a 10K pull-down on PGM. I have learned by experience to not use RB3 as I/O in any design as I forget and connect things to it which gives me problems when I need to connect a debugger. I have also left VPP, ISPDAT AND ISPCLK dedicated to an off-board connector with just a 10k pull down on VPP for similar reasons.
     
    Not sure on silicon revision, I've got this from the output window:
     
    Connecting to MPLAB ICD 4.
    Currently loaded versions:
    Application version............01.06.08
    Boot version...................01.00.00
    FPGA version...................01.00.00
    Script version.................00.03.10
    Script build number............5aef1e175b
    Target voltage detected
    Target device PIC16F884 found.
    Device Revision Id = 0x0
     
    Is that the info you need? I have just tried the second ICD4 and it gives the same data.
     
    It is a 5v device.
     
    post edited by Jungle Jim - 2020/06/28 02:42:18
    #8
    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 03:12:58 (permalink)
    0
    Hello Jim,
     
    Thanks for the details -- yes it helps.
     
    If you do not have a ~4.7 k ohm pull-down resistor on the 'PGC' signal and 'PGD' signal, definitely configure your MPLAB ICD 4 tool settings to provide a ~4.7 k ohm pull-down value on those two pins.
     
    Take a look at 'MPLAB ICD 4 In-Circuit Debugger User's Guide' and 'MPLAB ICD 4 Quick Start Guide' here:
    https://www.microchip.com/Developmenttools/ProductDetails/DV164045
    There are guidelines on the 'MCLR/Vpp' pin as well as other guidelines.
     
    What was your rationale for the 10 k ohm pull-down on 'MCLR/Vpp'?
     
    Maybe you can re-summarize where you are at in terms of any remaining issues you are having with your debugging woes?
     
    I will try to check in again Sunday or next week.
     
    Best regards,
     
    Ken
     
    P.S. When we are over your final issue then we can discuss your MPLAB ICD 3 versus MPLAB ICD 4 disparity -- a schematic would be helpful. The MPLAB ICD 3 would need to also control the 'MCLR' line during a debug session -- as would any debugger.
    #9
    Jungle Jim
    Starting Member
    • Total Posts : 49
    • Reward points : 0
    • Joined: 2009/11/20 10:03:16
    • Location: Salisbury, U.K.
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 06:26:36 (permalink)
    0
    Hi Ken,
     
    All of my debugging woes are now over, everything is back to working as expected.
     
    The pull-down on MCLR/Vpp is I suspect historical and probably a result of some confusion on my part. I started out some years back with a 16F690 and PICKIT 2 then advance to ICD3. That was where I learned the hard way about RB3 pull-downs. Unless a PICKIT wanted pull-downs, I guess that throughput the evolution of boards, chips and designs I've got the RB3 pull-down erroneously placed on a schematic onto the MCLR pin, then replaced the 'forgotten' RB3 pull-down. Or maybe I think I have seen somewhere in documentation that unused inputs should be pulled down? As the ICD3 didn't seem to care about it and I don't use the pin in my circuits it's never been flagged as a problem until now.
    #10
    ric
    Super Member
    • Total Posts : 28009
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 13:12:48 (permalink)
    0
    I guess you are saying that removing the pulldown on MCLR fixed the problems.
    It's sort of implied, but you never state it.
     

    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!
    #11
    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 13:17:50 (permalink)
    0
    Jungle Jim
    ...All of my debugging woes are now over, everything is back to working as expected...



    Hello and good day Jim,
     
    I'm very happy for you that you are now able to move forward.
    (I would also take your response to mean that your breakpoints are hitting fine now?)
     
    Thanks for your patience, sincerity, candor, and good attitude (and for answering the questions I peppered you with). Regardless of the root cause, it can be maddening not being able to debug one's code.
     
    Have a good week and best wishes with your products/projects.
     
    Best regards,
     
    Ken
    #12
    Ken_Pergola
    Super Member
    • Total Posts : 2239
    • Reward points : 0
    • Joined: 2003/11/07 12:48:48
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/06/28 13:31:18 (permalink)
    0
    Hello Jim,
     
    Ric has a good point.
     
    Maybe we can summarize what turned things around for you which could help others reading this thread in the future:
     
    1) You mentioned:
    "I have changed MCLR to ON and my reset now works as expected :-)"
     
    2) I mentioned: "
    "If you do not have a ~4.7 k ohm pull-down resistor on the 'PGC' signal and 'PGD' signal, definitely configure your MPLAB ICD 4 tool settings to provide a ~4.7 k ohm pull-down value on those two pins."
     
    After these changes did you you also see breakpoints working?
     
    Were there any other changes you made?
     
    Best regards and thank you,
     
    Ken
    #13
    Jungle Jim
    Starting Member
    • Total Posts : 49
    • Reward points : 0
    • Joined: 2009/11/20 10:03:16
    • Location: Salisbury, U.K.
    • Status: offline
    Re: ICD 4 debugging, debugger cannot step through parts of program 2020/07/12 09:24:35 (permalink)
    4 (1)
    Hi guys, sorry for the late reply, I've only just seen the last post.
     
    After changing MCLRE to ON in the config, the program reset to the start of the program as expected, and breakpoints all worked as expected.
     
    I do not have a ~4.7 k ohm pull-down resistor on the 'PGC' signal and 'PGD' signal, I confirmed that the  MPLAB ICD 4 tool was set to provide a ~4.7 k ohm pull-down value on those two pins.
     
    I did not have to remove the pull-down resistor on the MCLR pin, but I have looked further into this and realised it is definitely an error on the board design. I have now tested it both with and without the pull down, both work, so as it is not doing anything I will remove it from the design. I think it was originally supposed to be the RB3 pull down but got placed on the MCLR in error.
     
    I have made a note in my historic codes that worked when used with ICD 3 and MCLRE_OFF to change that to MCLRE_ON if I have to revisit any using an ICD 4.
     
    Thanks again for all you help.
     
     
     
     
    #14
    Jump to:
    © 2020 APG vNext Commercial Version 4.5