• AVR Freaks

Hot!Once again the message "The target device is not ready for debugging."

Author
jpdesroc
Junior Member
  • Total Posts : 119
  • Reward points : 0
  • Joined: 2011/01/31 11:20:06
  • Location: 0
  • Status: offline
2021/02/22 16:10:35 (permalink)
0

Once again the message "The target device is not ready for debugging."

I'm running inside MPLAB X IDE v5.45 using ICD3 debugger
and HiTech PRO v9.83
with an old PIC16F876A on a working and tested demo board.
When trying to use only one breakpoint OR if I hit the PAUSE button
I'm starting to get the annoying message:
.
.
Running
Target Halted
The target device is not ready for debugging. Please check your configuration bit settings and program the device before proceeding.
The most common causes for this failure are oscillator and/or PGC/PGD settings. Failed getting PC
.

The PIC DATA/PGM/CLK pins are free for the installed ICD3 debugger.
Nothing there to make problems on the debug time.
The program compiles Ok and runs Ok too.
The PIC16F876A runs on an 20Mhz external crystal.

Here are the FUSE setings:
__CONFIG(FOSC_HS & WDTE_OFF & LVP_OFF & PWRTE_OFF & BOREN_OFF & DEBUG_ON);

What can I do ?

And please.. don't tell me this PIC is way too hold to put any work on it...
I have a small quantity of these and would like to use them..
#1

16 Replies Related Threads

    ric
    Super Member
    • Total Posts : 29917
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 16:44:57 (permalink)
    +1 (1)
    How exactly is the ICD3 connected to your PIC?
    i.e. what sort of cables, and how long?
     
     

    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!
    #2
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 17:48:39 (permalink)
    0
    The PIC16F876A is mounted on a demoboard like this one:
    https://www.ebay.com/itm/PIC-Development-Board-PIC-EK-for-DIP4-8-14-18-20-28-40-PIC-microcontrollers-/132910307777
    I've designed many projects using this demoboard in the past. Reliable.
    The USB cable is a better one than the original USB cable that came with the ICD3.
    The original black chinese USB cable always disconnected/reconnected (and so forth).
    I replaced it with a new reliable Startech transparent one.
    https://www.newegg.ca/transparent-startech-6-ft-usb/p/N82E16812200228
    It's about 3 feet long.
    If I remember well, 4 days ago,  using a PIC16F877A instead was not giving me such errors..
    The demoboard power connections are reliable too.
    #3
    ric
    Super Member
    • Total Posts : 29917
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 18:24:07 (permalink)
    +1 (1)
    I did specifically ask about the connection from the ICD3 to the PIC, which is not the USB cable.
     

    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
    ric
    Super Member
    • Total Posts : 29917
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 18:24:08 (permalink)
    0
    I did specifically ask about the connection from the ICD3 to the PIC, which is not the USB cable.
     

    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
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 19:06:51 (permalink)
    0
    You asked 2 things:
    >How exactly is the ICD3 connected to your PIC?
    >what sort of cables, and how long?
     
    If you did not check the picture of my demoboard on the previous reply post
    just do it. The ICD connector is located down left aside of the 8 LEDS array.
    The ICD connection from the ICD3 to the PIC is done on the demo board.
    There is a 6 pins SIP dedicated for the ICD works. Here it's for the ICD3.
    This connection works fine and goes to the appropriate PIC's ICD pins.
    #6
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 19:08:27 (permalink)
    0
    I just replaced the PIC16F876A for a PIC16F877
    and now I don't get the 'The target device is not ready for debugging.' anymore
    but when I put a breakpoint in my program the program won't stop to it..
    until I click the PAUSE button. Then it stops at the breakpoint and I can see
    the available variables.
    Weird..
    I think my ICD3 has a problem here..

    And by the way, when I compile there is that message:
     
    Warning: The hex file has the debug bit set.  The debug bit has been cleared during load to memory.  The original hex file has not been modified.
     
    With this in my listing:
    __CONFIG(FOSC_HS & WDTE_OFF & LVP_OFF & PWRTE_OFF & BOREN_OFF & DEBUG_ON);
     
    #7
    ric
    Super Member
    • Total Posts : 29917
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 20:06:43 (permalink)
    0
    jpdesroc
    ...
    The ICD connector is located down left aside of the 8 LEDS array.
    The ICD connection from the ICD3 to the PIC is done on the demo board.
    There is a 6 pins SIP dedicated for the ICD works. Here it's for the ICD3.
    This connection works fine and goes to the appropriate PIC's ICD pins.



    Yes, there is a 6 pin SIP connector on your board labelled "ICSP"
    You must be connecting that to your ICD3's modular connector using some sort of cable.
    It is THAT cable I have been asking about.
    Are you using the original "Modular Cable to Target Board Header" supplied with the ICD3, or something else?
    If you are, is that header plugged directly into the SIP6 on the demo board, or via some sort of extension cable?
     

    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!
    #8
    GlennP
    Super Member
    • Total Posts : 853
    • Reward points : 0
    • Joined: 2009/03/29 15:04:55
    • Location: El Paso County, CO, USA
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/22 20:18:59 (permalink)
    +2 (2)
    jpdesroc ...
    And by the way, when I compile there is that message:
    Warning: The hex file has the debug bit set.  The debug bit has been cleared during load to memory.  The original hex file has not been modified.

    With this in my listing:
    __CONFIG(FOSC_HS & WDTE_OFF & LVP_OFF & PWRTE_OFF & BOREN_OFF & DEBUG_ON);


    Never specify DEBUG_ON.  This bit is set/cleared by the debugging tools.
     
    I'm not sure why the definition exists for users.  Symmetry?
     
    GP
    post edited by GlennP - 2021/02/22 20:20:03
    #9
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 08:00:16 (permalink)
    0
    ric
    jpdesroc
    ...
    The ICD connector is located down left aside of the 8 LEDS array.
    The ICD connection from the ICD3 to the PIC is done on the demo board.
    There is a 6 pins SIP dedicated for the ICD works. Here it's for the ICD3.
    This connection works fine and goes to the appropriate PIC's ICD pins.



    Yes, there is a 6 pin SIP connector on your board labelled "ICSP"
    You must be connecting that to your ICD3's modular connector using some sort of cable.
    It is THAT cable I have been asking about.
    Are you using the original "Modular Cable to Target Board Header" supplied with the ICD3, or something else?
    If you are, is that header plugged directly into the SIP6 on the demo board, or via some sort of extension cable?

    The cable I am using and you are asking about is the original Microchip 5" long grey fllat cable
    attached to the small original Target Board Header that came with the ICD3 package.
    No extension cable of any sort..
     
    From the previous post suggestion I just removed the DEBUG_ON from the FUSES list
    and the "Warning Debug bit set.. " message cleared out. Thanks.
    Again, When I place a breakpoint in the program (tried many different lines)
    The program stops like it should but the STOP and PAUSE buttons stay highlighted (available) !
    If I push the PAUSE button then the program finally shows the variables I'm watching
    and then both STOP and PLAY buttons are highligthed (like a breakpoint should have done).
    It looks like ICD3 and MPLAB X IDE are sort of unsynchronized together..
     
    Here is part of my working program.
    I won't put all the lines but some for explaination of  my breakpoints problem..
     


    #include "23LC512.h" // This header file has this line in it: #include <htc.h>

    __CONFIG(FOSC_HS & WDTE_OFF & LVP_OFF & PWRTE_OFF & BOREN_OFF);

    #define _XTAL_FREQ 20000000

    //////////////////////////////////////////////
    //////////////////////////////////////////////
    void interrupt TMR1_isr (void)
     {
         
      TMR1H = 0xEC;
      TMR1L = 0x77;
     
      // Interrupt stuff here removed to clear code example space ..
     
      TMR1IF = 0; // clears interrupt flag
     }

    // ************************************************************
    // *********************** Main Program ***********************
    // ************************************************************

    void main(void)     // Main function, this function starts to run after the microcontroller is turned on       
     {
      unsigned char volatile temp, x;
      unsigned int volatile temp_int;
     
      OPTION_REG = 0b00001000;
      TRISA=0b00111111;   // RA0,1 are for potentiometers readings,
      TRISB=0b00000000;   // PORTB all outputs
      TRISC=0b00010000;   // PORTC RC0,1 for Gate1,2 outs, and SPI: RC3=SCK, RC4=MISO, RC5=MOSI             
     
      PORTA=0b00000000;   // All inputs so don't care state
      PORTB=0b00011111;   // Chip select pins idle state = high
      PORTC=0b00000011;   // RC0,1 outputs idle state=high, SPI settings: RC3=SCK=0, RC4=MISO, RC5=MOSI=0
     
      init_TIMER1();
      init_SPI();     // 23LC512 SPI mode 0 protocol & pins initialization
      init_23LC512(); // Erase all the SRAM memory (takes around 3sec.)
      init_A_to_D();
     
      PEIE = 1; // Authorizes peripherals interrupt   
      GIE =1;   // Authorizes global interrupt

      // reset SRAM addresses counters to starts
      address_counter1=0;
      address_counter2=0;
     
      old_max_SRAM_address1=0; // <-------- For example Breakpoint placed here
      new_max_SRAM_address1=0; // MPLAB won't stop here to let me see some variables
      old_max_SRAM_address2=0; // but will only if I hit the PAUSE button (???)
      new_max_SRAM_address2=0;  

      //////////////////// Main loop ///////////////////

      while(1)  // Endless loop. All the process is within the interrupt function..
       {
        ;  
       } // while(1)  
        
     }
    #10
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 12:05:30 (permalink)
    +1 (1)
    New tests done..
     
    Still running on Windows 10 64bits,
    MPLAB X IDE v5.45, HiTech C compiler v9.83

    New test now using a PicKIT3:
    While pressing the reset button on PicKIT3
    I connected the PicKIT3 to PC USB port.
    I then saw its firmware updating. Ok.

    I then connected it to my demo board and
    recompiled the program. Same behaviour as the ICD3 here.
    when I put a breakpoint in my program the program won't stop to it..
    In fact it has stopped but not showing it in the IDE.
    Until I click the PAUSE button. Then it stops at the breakpoint and I can see
    the available variables.
    And the "Step Into" debug button does nothing..
    #11
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 13:35:56 (permalink)
    0
    To find the problem, one thing I just found:
    To debug, I still put a breakpoint on one of the first program lines,
     
      while(1)
      {  
       RC2 ^= 1;
       __delay_ms(500);  // <--- breakpoint here
      }
     
    instead of clicking the first option of debug
    "Debug Project (my program)"
    Instead I chose the next choicse which is:
    "Launch Debugger (Project my program)"
    and I got this message:
    Launching
    User program stopped
    No source code lines were found at current PC 0x1. Open program memory view to see instruction code disassembly.
    Is it showing something to you ?
    post edited by jpdesroc - 2021/02/23 13:56:25
    #12
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 14:18:11 (permalink)
    0
      while(1)
      {  
       RC2 ^= 1;
       __delay_ms(500);  // <--- breakpoint here, line is highlighted inside a RED bar
      }
     
    But then if I click "Debug Project (my program)"
    The program runs for about 40 sec. then stops
    (buttons STOP and PLAY highlighted)
    and where the breakpoint line is, there should be a highlighted GREEN bar
    showing the breakpoint stop, but nothing shows..
    The breakpoint line is still highlighted inside a RED bar
    #13
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 15:08:14 (permalink)
    0
    Digging deeper..
    I changed the C compiler from Hitech to XC8 v2.32
    and same thing happens..

    #14
    Murton Pike Systems
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2020/09/10 02:13:01
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 18:04:28 (permalink)
    0
    Last time i had these sort of problems my pickit3 to pcb connector had a bad connection.
    Bought a new one off ebay and that fixed it.
    However, I am a heavy user, always plugging and unplugging over many months.
     
    #15
    jpdesroc
    Junior Member
    • Total Posts : 119
    • Reward points : 0
    • Joined: 2011/01/31 11:20:06
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 19:03:25 (permalink)
    0
    This problem happens with ICD3 or PicKIT3.
    Same behaviour..
    I hope someone at Microchip can help since I'm stuck now.
    I'm in the midlle of a project and I need the breakpoints to work.
    #16
    Murton Pike Systems
    Super Member
    • Total Posts : 224
    • Reward points : 0
    • Joined: 2020/09/10 02:13:01
    • Location: 0
    • Status: offline
    Re: Once again the message "The target device is not ready for debugging." 2021/02/23 19:21:05 (permalink)
    +2 (2)
    I always add an LED to my projects.
    Pretty basic, but it can flash if your code reaches a certain point or if a variable becomes an expected value.
    Even a quick blink on power up to show PIC has initialised ok is useful.
     
    I sell model railway controllers and you can guarantee someone will attach dc power the wrong way around.
    So  I protect the circuit with a diode and flash LED for 4 seconds on power up so they know power is correct.
     
    Sorry this doesnt fix your problem.
     
     
    #17
    Jump to:
    © 2021 APG vNext Commercial Version 4.5