• AVR Freaks

Hot!Unable to debug PIC18F26K83

Author
M.Ali
Starting Member
  • Total Posts : 71
  • Reward points : 0
  • Joined: 2018/11/12 00:36:07
  • Location: 0
  • Status: offline
2019/04/25 01:28:13 (permalink)
0

Unable to debug PIC18F26K83

Hi,
I am using PIC18F26K83 along with PICkit3 . I am able to successfully load the program . But when I try to debug the project I get the following error : Programming/Verify complete.  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 are oscillator and/or PGC/PGD settings
I am using internal oscillator. Frequency = 64MHz
 
Regards
Ali
#1

14 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/25 05:13:55 (permalink)
    +1 (1)
    M.Ali
    I am using internal oscillator. Frequency = 64MHz

    Are you sure?
    Please show all your config settings that you used to select this.
     

    Nearly there...
    #2
    M.Ali
    Starting Member
    • Total Posts : 71
    • Reward points : 0
    • Joined: 2018/11/12 00:36:07
    • Location: 0
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/25 22:23:55 (permalink)
    -1 (1)
    Hi qhb,
     
    Here are the settings :
    #pragma config CONFIG1L = 0x04
    i.e FEXTOSC = b100 i.e oscillator is not enabled  &
        RSTOSC   = b000 = HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1; resets COSC/NOSC to 3’b110
     
     
    Regards
    Ali
    #3
    vloki
    Jo, alla!
    • Total Posts : 6803
    • Reward points : 0
    • Joined: 2007/10/15 00:51:49
    • Location: Germany
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/26 03:32:41 (permalink)
    +2 (2)
    Why not use this tool?
    http://microchipdeveloper.com/mplabx:view-and-set-configuration-bits
    (It may not help to solve your problem but makes your code easy to read/understand)

    Uffbasse !
    #4
    M.Ali
    Starting Member
    • Total Posts : 71
    • Reward points : 0
    • Joined: 2018/11/12 00:36:07
    • Location: 0
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/27 23:20:57 (permalink)
    0
    vloki
    Why not use this tool?
    http://microchipdeveloper.com/mplabx:view-and-set-configuration-bits
    (It may not help to solve your problem but makes your code easy to read/understand)


    Thank you vloki. I have used the tool to set configuration bits.
     
    qhb
    Please show all your config settings that you used to select this.



     
    Here are the configuration settings : 

    // CONFIG1L
    #pragma config FEXTOSC = OFF // External Oscillator Selection (Oscillator not enabled)
    #pragma config RSTOSC = HFINTOSC_64MHZ// Reset Oscillator Selection (HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1)
    // CONFIG1H
    #pragma config CLKOUTEN = ON // Clock out Enable bit (CLKOUT function is enabled)
    #pragma config PR1WAY = OFF // PRLOCKED One-Way Set Enable bit (PRLOCK bit can be set and cleared repeatedly)
    #pragma config CSWEN = ON // Clock Switch Enable bit (Writing to NOSC and NDIV is allowed)
    #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor disabled)
    // CONFIG2L
    #pragma config MCLRE = INTMCLR // MCLR Enable bit (If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR)
    #pragma config PWRTS = PWRT_64 // Power-up timer selection bits (PWRT set at 64ms)
    #pragma config MVECEN = ON // Multi-vector enable bit (Multi-vector enabled, Vector table used for interrupts)
    #pragma config IVT1WAY = ON // IVTLOCK bit One-way set enable bit (IVTLOCK bit can be cleared and set only once)
    #pragma config LPBOREN = ON // Low Power BOR Enable bit (ULPBOR enabled)
    #pragma config BOREN = ON // Brown-out Reset Enable bits (Brown-out Reset enabled according to SBOREN)
    // CONFIG2H
    #pragma config BORV = VBOR_2P85 // Brown-out Reset Voltage Selection bits (Brown-out Reset Voltage (VBOR) set to 2.8V)
    #pragma config ZCD = OFF // ZCD Disable bit (ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON)
    #pragma config PPS1WAY = ON // PPSLOCK bit One-Way Set Enable bit (PPSLOCK bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle)
    #pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack full/underflow will cause Reset)
    #pragma config DEBUG = OFF // Debugger Enable bit (Background debugger disabled)
    #pragma config XINST = OFF // Extended Instruction Set Enable bit (Extended Instruction Set and Indexed Addressing Mode disabled)
    // CONFIG3L
    #pragma config WDTCPS = WDTCPS_7// WDT Period selection bits (Divider ratio 1:4096)
    #pragma config WDTE = SWDTEN // WDT operating mode (WDT enabled/disabled by SWDTEN bit)
    // CONFIG3H
    #pragma config WDTCWS = WDTCWS_7// WDT Window Select bits (window always open (100%); software control; keyed access not required)
    #pragma config WDTCCS = LFINTOSC// WDT input clock selector (WDT reference clock is the 31.0 kHz LFINTOSC)
    // CONFIG4L
    #pragma config BBSIZE = BBSIZE_512// Boot Block Size selection bits (Boot Block size is 512 words)
    #pragma config BBEN = OFF // Boot Block enable bit (Boot block disabled)
    #pragma config SAFEN = OFF // Storage Area Flash enable bit (SAF disabled)
    #pragma config WRTAPP = OFF // Application Block write protection bit (Application Block not write protected)
    // CONFIG4H
    #pragma config WRTB = OFF // Configuration Register Write Protection bit (Configuration registers (300000-30000Bh) not write-protected)
    #pragma config WRTC = OFF // Boot Block Write Protection bit (Boot Block (000000-0007FFh) not write-protected)
    #pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM not write-protected)
    #pragma config WRTSAF = OFF // SAF Write protection bit (SAF not Write Protected)
    #pragma config LVP = OFF // Low Voltage Programming Enable bit (HV on MCLR/VPP must be used for programming)
    // CONFIG5L
    #pragma config CP = OFF // PFM and Data EEPROM Code Protection bit (PFM and Data EEPROM code protection disabled)

    #5
    JPortici
    Super Member
    • Total Posts : 693
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/27 23:30:26 (permalink)
    +1 (1)
    i would remove this line
    #pragma config DEBUG = OFF // Debugger Enable bit (Background debugger disabled)

    and retry.
     
    the debug bit should be set automatically when you select program vs debug operation.
    In fact, that configuration bit is usually left out so the user can't inadvertently set it to on/off. And in more and more datasheets this and other configuration bits are left undocumented (which is an issue to me for a number of reasons, the first being i want to know)
     
    If removing the line fixes the issue, you should then open a support ticket (it is a mplabx issue) so they can fix it in a future release.
    #6
    M.Ali
    Starting Member
    • Total Posts : 71
    • Reward points : 0
    • Joined: 2018/11/12 00:36:07
    • Location: 0
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/27 23:57:51 (permalink)
    0
    Jack_M
    i would remove this line
    #pragma config DEBUG = OFF // Debugger Enable bit (Background debugger disabled)

    and retry.



    Thank you JPortici .
    I tried by removing the above line , but the issue still remains. 
     
    Regards
    Ali
    #7
    JPortici
    Super Member
    • Total Posts : 693
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/28 00:10:06 (permalink)
    +1 (1)
    hm.. i hoped it worked.
     
    Let's see, can you try a super simple program, like
     
    #include <xc.h>

    void main(void) {
      while(1) {
        Nop();
        Nop();
        Nop();
        Nop();
      }
    }

     
    without defining the configuration, without adding anything else.
    Add a breakpoint on the first NOP and hit debug.
    This MUST work before doing anything else.
    If it doesn't you have problems in your hardware.
     
    if you can reach the breakpoint then add your configuration, if it still works start adding the first parts of your code. and so on, until you find the problem.
    #8
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/28 00:14:11 (permalink)
    +2 (2)
    Jack_M
    without defining the configuration, without adding anything else.
    ...

    If you don't have any config bits at all, then the CONFIG1L value will be 0xFFFF, which will select "External clock", which will give precisely the reported symptoms if there is not an external oscillator connected...
     

    Nearly there...
    #9
    M.Ali
    Starting Member
    • Total Posts : 71
    • Reward points : 0
    • Joined: 2018/11/12 00:36:07
    • Location: 0
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/28 01:07:14 (permalink)
    0
    Jack_M
    hm.. i hoped it worked.
     
    Let's see, can you try a super simple program, like
     
    #include <xc.h>

    void main(void) {
      while(1) {
        Nop();
        Nop();
        Nop();
        Nop();
      }
    }

     
     



    Thank you JPortici. 
    It's not working .
     
    qhb
    Jack_M
    without defining the configuration, without adding anything else.
    ...

    If you don't have any config bits at all, then the CONFIG1L value will be 0xFFFF, which will select "External clock", which will give precisely the reported symptoms if there is not an external oscillator connected...
     




    Yes. 
     
    Regards
    Ali
    #10
    malaugh
    Super Member
    • Total Posts : 398
    • Reward points : 0
    • Joined: 2011/03/31 14:04:42
    • Location: San Diego
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/29 08:42:58 (permalink)
    0
    Which button are you pressing to load the program? The toolbar has 3 methods of buildingthe program.  The hammer symbol build without loading, the square with the down arrow builds without debug info and programs the device.  You need to use the symbol with the computer paper? and right arrow to debug the program.
     
     
    #11
    JPortici
    Super Member
    • Total Posts : 693
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/04/29 08:51:10 (permalink)
    0
    qhb
    Jack_M
    without defining the configuration, without adding anything else.
    ...

    If you don't have any config bits at all, then the CONFIG1L value will be 0xFFFF, which will select "External clock", which will give precisely the reported symptoms if there is not an external oscillator connected...



    Yeah, i am too much spoiled by dsPIC where the default oscillator configuration is FRCDIV so you can still run the software in the unfortunate event of configuration erase.
    Anyway i would expect the FSCM (also active) to kick in and switch to HFINTOSC before the debugger decides it's too late, but i haven't tested.
    #12
    M.Ali
    Starting Member
    • Total Posts : 71
    • Reward points : 0
    • Joined: 2018/11/12 00:36:07
    • Location: 0
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/05/02 04:21:39 (permalink)
    0
    malaugh
    Which button are you pressing to load the program? The toolbar has 3 methods of buildingthe program.  The hammer symbol build without loading, the square with the down arrow builds without debug info and programs the device.  You need to use the symbol with the computer paper? and right arrow to debug the program.



    Hi malaugh,
    I am selecting the option "Debug Main Project" from the "Debug" from the menu bar.
     
    Regards
    Ali 
    #13
    jswanson
    Super Member
    • Total Posts : 354
    • Reward points : 0
    • Joined: 2003/11/07 12:44:05
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/05/02 07:28:04 (permalink)
    0
    I am using this part but with a 10MHz Xtal and 4XPLL.  It debugs ok with an ICD3, but for some reason I am unable to change the first element in an array in the variables window.  All the other elements are editable.
     
    Jeremy.
    #14
    hkv
    Starting Member
    • Total Posts : 15
    • Reward points : 0
    • Joined: 2018/08/06 10:11:49
    • Location: 0
    • Status: offline
    Re: Unable to debug PIC18F26K83 2019/05/20 15:18:55 (permalink)
    0
    Can you please share the project M.Ali?
    #15
    Jump to:
    © 2019 APG vNext Commercial Version 4.5