PicKit 2 Clone and 18F452 error 0028 problem

Page: 12 > Showing page 1 of 2
Author
rmsante
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2009/03/25 00:55:04
  • Location: 0
  • Status: offline
2009/03/25 01:15:56 (permalink)
0

PicKit 2 Clone and 18F452 error 0028 problem

I am trying to use a AU Electronics PicKit 2 clone to debug a project on a Rapid iXL prototyping board using an 18F452 based circuit. I am using MPLab v8.20a. I can successfully program the PIC but can't get it to enter into debug mode. I can also use the PicKit2 Programmer v2.60 application to check connectivity, read, write, verify,... without problems. I even performed the calibration procedure. I've use this prototyping board and PicKit 2 for other projects in the past without problems. To make sure it wasn't a problem with my code, I used a new template file and wrote a simple Flashing LED program which works fine. As stated above, it programs fine when enabled within  the Programmer menu but here is the output when I choose the PicKit 2 within the debugger menu and try to program the PIC:

Initializing PICkit 2 version 0.0.3.61
Found PICkit 2 - Operating System Version 2.32.0
PICkit 2 Unit ID = PicKit2 Unit 1
Target power detected ( 4.99V)
PIC18F452 found (c0)
PICkit 2 Ready

PIC18F452 found (c0)
Erasing Target
Programming Program Memory (0x0 - 0xF)
Programming Program Memory (0x18 - 0x7F)
Verifying Program Memory (0x0 - 0xF)
Verifying Program Memory (0x18 - 0x7F)
Programming EEPROM Memory (0x0 - 0xFF)
Verifying EEPROM Memory (0x0 - 0xF)
Programming Debug Executive (0x-7DC0 - 0x7FFF)
Verifying Debug Executive (0x7DC0 - 0x7FFF)
Programming Debug Vector
Verifying Debug Vector
Programming Configuration Memory
Verifying Configuration Memory

It hangs here and the status bar message reports that it's programming and the progress indicator continuously loops from 0 to 100%. After waiting for a long time, I then unplug the cable between the PicKit 2 and the prototype board and control returns to the program and the following two lines appear:

PK2Error0028:  Unable to enter debug mode
PICkit 2 Ready

Any thoughts or suggestions appreciated, thanks!
--rob--
post edited by PICkit2Dev - 2009/03/25 07:54:19
#1

23 Replies Related Threads

    TCM
    Super Member
    • Total Posts : 502
    • Reward points : 0
    • Joined: 2005/06/26 02:01:25
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 08:11:38 (permalink)
    0
    I would suggest a genuine PICkit2 programmer. I don't think 49$ is so expensive.

    Once i had a spectrum computer , today i am throwing away my pentium PC , tomorow i will write to you from a Microchip internet-enabled device.
    #2
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 10:36:00 (permalink)
    0
    Greeting Rob,
    Would you please verify that following items before we proceed to other points:
    1. some code space has been reserved for debugging on your project,
    2. Check your configuration bits, and for easy debugging purpose, please make sure all Flash/EEPROM code protection is turned off, WDT is turned off.
    3. If you use C compilor, please make sure you do select the Link Option for "In circuit Debug"; e.g. for HI-Tech PICC18, it is Link Option for "ICD2"
    Also please refer to Chapter 4 on the PICkit 2 User's manual for details on debugging a chip with PICkit 2.

    The following picture is a screen cut from the User's Manual,  Compare with what You have posted, you are hold on the last step. There are many possible reason to cause this issue, let's sort them out one by one.

    post edited by FunnyNYPD - 2009/03/25 10:39:20

    Attached Image(s)

    #3
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 10:46:03 (permalink)
    0
    Resource used by debugging:
    Reserved Resources Due to the built-in in-circuit debugging capability of ICD devices and the ICSP function offered by the debugger, the PICkit 2 Debug Express uses some on-chip resources when debugging. It also uses program memory and file register locations in the target device during debugging. These locations are not available for use by user code. In MPLAB IDE, registers marked with an "R" in register displays represent reserved registers.
    For information on device resources that are needed for in-circuit debugging, please refer to the MPLAB ICD 2 Help, found in the MPLAB IDE under Help>Topics. The device reserved resource information found under "Resources Used By MPLAB ICD 2" is the same for the PICkit 2 Debug Express.

    #4
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 10:51:10 (permalink)
    0
    A few recommended 452 configuration setting from a 452 Debugging tutorial:

  • OSC Switch Enable - Disabled

  • Power-Up Timer - Enabled

  • Brown-Out Detect - Disabled

  • Watchdog Timer - Disabled
  • CCP2 MUX - RC1
  • Stack Overflow Reset - Disabled
  • Low Voltage Programming - Disabled
  • All other configuration bits should be disabled.
    #5
  • FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 10:58:42 (permalink)
    0
    The following resource should be reserved for debugging programming use only:


    Attached Image(s)

    #6
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 11:34:21 (permalink)
    0
    Here is a list of some possible reason to get a 0028 error:
    PK2Error0028: Unable to enter debug mode
    Description: PICkit 2 Debug Express is unable to connect to the debug executive in the
    target device.
    Suggested Actions: Common reasons for this error:
    1. If the target is a Baseline or Mid-Range device (PIC10F, PIC12F, PIC16F) it may require an ICD header to debug with. See Section 4.4.3 ìUsing an ICD Headerî.
    2. The device oscillator is not working. Check the Configuration bits and ensure the device has a working oscillator.
    3. Make sure to select Debugger>Program in MPLAB IDE before trying to run or step your code.
    4. If you have a PICkit 2 with a black colored push button, you may need pull-down resistors to debug reliably. See Section 4.3 ìInstalling the Hardware and Softwareî.
    5. The target board is not powered or is not powered properly. Check the power supply.
    6. The PICkit 2 VDD output pin has not been connected to the target board. Even if the target board has its own power supply, this pin must always be connected to the target VDD supply.
    7. The PICkit 2 unit has become disconnected from the target board or has an inter-mittent connection on one or more pins. Check the PICkit 2 connections to the target board.
    8. The incorrect Linker Script was used. The ì-iî ICD linker script must be used when debugging. (For example, 16F887i.lkr must be used instead of 16F887.lkr).
    9. The target application is attempting to use resources reserved for the debug executive, causing the debug executive to become corrupted. For example, the target application is writing to a reserved File Register. See Section 4.4.2 ìReserved Resourcesî.
    10. For PIC24 and dsPICÆ DSC devices, the incorrect PGXn/EMUXn port is selected in the ìComm Channel Selectî Configuration bits. Check that the port the PICkit 2 Debug Express is connected to is selected.
    11. A configuration setting may be preventing the target from operating properly and executing code. The target will not enter Debug mode if it is unable to execute code.
    12. The device is code-protected. Check Configuration bits for code protect settings.
    13. An operation may be attempting in an invalid context. For example, PICkit 2 Debug Express cannot set a breakpoint if the target application is currently running.

    #7
    Stefan Uhlemayr
    Super Member
    • Total Posts : 4292
    • Reward points : 0
    • Joined: 2005/05/12 12:25:46
    • Location: Germany
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 13:21:56 (permalink)
    0
    ORIGINAL: TCM

    I would suggest a genuine PICkit2 programmer. I don't think 49$ is so expensive.
    Hm, you may have a closer look to the parts from AU Electronics, especially look for the "BB0703+", because they have two improvements to the PICkit2, which are pretty nice:

    - RJ12-connector like the ICD2 (so you can't connect it the wrong way to the target-board)
    - they have a USB-buck/boost-regulator, which give you a stable 5V-supply for your target-board, even if your USB-voltage is 4.2V only (still inside USB-spec.)

    I was never a big friend of clones, but this one seems to be better then the (already pretty good) original...

    Greetings,
    Stefan


    ps: No, I'm not an advertising-guy from AU-electronics... wink
    #8
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 15:04:50 (permalink)
    0
    I do managed entering the debugging mode with the 2550 chipset I have on MPLAB V8.14 and V8.20,  here is the screencut of V8.14:

    [image]local://46613/7C05248AFBA849FC81E743565A303B41.JPG[/image]
    post edited by FunnyNYPD - 2009/03/25 15:06:44

    Attached Image(s)

    #9
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 15:15:39 (permalink)
    0
    Here is the screen cut on V8.20: 

    [image]local://46613/9A37FE359AE24D34B001DB76C9DCBD08.JPG[/image]

    Attached Image(s)

    #10
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 15:23:20 (permalink)
    0
    There are some tricks to get to the above debugging screen, here is a list of a few.
    On Configuration bits make sure the following condition met:
    1. Disable Power up timer,
    2. Disable BOR,
    3. Enable MCLR
    4. Disable WDT
    post edited by FunnyNYPD - 2009/03/25 15:57:53
    #11
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 16:21:17 (permalink)
    0
    Here is a screen cut on a 16F877:

    [image]local://46613/1D5CCD21B19D41F29ACC23D23B6343EA.JPG[/image]

    Attached Image(s)

    #12
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/25 17:32:52 (permalink)
    0
    After some debugging test on the 16F887 and 18F2550 at our facility, there might be a MPLAB software glitch when using PICKIT 2 debugging for the PIC18F2550 family on the MPLAB V8.14 and V8.20.

    The Debugging on the 16F877 is very robust on V8.20 and V8.14.

    The PICkit 2 Debugging on the 18F2550 might have some issue on both V8.14 and V8.20. (It seems no issue on ICD2, actually, a MPLAB debugging image generated for ICD2 can be used very robust for PICKIT 2. However, it will create error 0028 when a debugging image is generated with PICkit 2 selected as the debugging tool even with all the right debugging settings.)
    post edited by FunnyNYPD - 2009/03/25 17:35:34
    #13
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/26 07:30:25 (permalink)
    0
    Here is a screen cut of debugging 18F2550 in assembly language under V8.20:

    post edited by FunnyNYPD - 2009/03/26 07:49:39

    Attached Image(s)

    #14
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/26 07:59:46 (permalink)
    0
    Since I cannot find a 18F452, I used a 18F4520 instead and here is the assembly language debugging under V8.20:

    Attached Image(s)

    #15
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/26 09:31:22 (permalink)
    0
    "CONFIG    DEBUG = ON;Background Debugger: Enabled" is recommended.
    I tested with this bit turned off, it works on 4520, but turning it on would be better in debugging mode.
    #16
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/26 11:29:34 (permalink)
    0
    With some test on different chips and different programming languages, two issues were found:
    1. PIC18F458
    PIC18F458 with assembly language, under MPLAB V8.20, the chip can be programmed fine, can enter debug mode, can do step and Animate, but cannot keep running, it will halt just by itself after one step is accomplished, so "run" becomes "step". (Chip running at HS mode with 2MHz frequency input)

    Same assembly program runs good on 18F2550 and 18F4520, under these two chip, when "run" is clicked, it will run until a "Halt" is clicked.

    The attached photo illustrates auto halt at run.

    2. One potential issue with PIC18F2550 and PICC18 V9.50PL3
    The Code generated by the PICC18 V9.50PL3 compiler can let both PICKit 2 and ICD2 enter debug mode only when a ICD2 is selected as debugging tool.

    When PICkit 2 was selected as debugging tool and re-compile the same project, it will make error 0028 --- cannot enter debug mode.

    Once the debug mode is entered, both PICKIT2 and ICD2 control the debugging functions very well (step, reset, animate, break, etc.).

    Attached Image(s)

    #17
    rmsante
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2009/03/25 00:55:04
    • Location: 0
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/26 20:47:40 (permalink)
    0
    UPDATE:  First of all, thanks for all the suggestions and information from everyone. I continued trying various configuration settings as well as older versions of MPLab including v8.00, v8.10, v8.14 and the latest. Nothing I tried worked. They all allowed the PicKit 2 to program the 18F452 but would never enter into debug mode always reporting and error 0028. I then remembered I have an 18F4685 so I swapped it into my prototype board, commented out the invalid CONFIG items and guess what...it entered into debug mode on the first try! Seems to run fine and single steps too. So it seems there is something special about the 18F452 that is preventing it from entering into debug mode. After spending all that time on it, it would be nice to know exactly what the real issue is. Thanks again for all the help!
    --rob--
    #18
    FunnyNYPD
    Super Member
    • Total Posts : 1553
    • Reward points : 0
    • Joined: 2007/09/28 20:06:59
    • Location: USA & Canada
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/27 05:52:56 (permalink)
    0
    The 18F452 and 18F458 belong to the relatively "old"silicon design and not recommended for new designs. I don't have 452, so I did some test on 18F4520, 18F2550, and 18F458.

    Debugging working in full condition on both 4520 and 2550.
    Some issue found on 458 too, I can enter debug mode, animate and step successfully, but the "run" doesn't work, the "run" becomes a "step" instead. So is gone the "run to cursor" and "break points" functions due to the malfunction of "run".

    All test are written in Assembly language at MPLAB V8.20.
    post edited by FunnyNYPD - 2009/03/27 06:11:54
    #19
    PICkit2Dev
    Super Member
    • Total Posts : 994
    • Reward points : 0
    • Joined: 2006/09/27 08:41:47
    • Location: 0
    • Status: offline
    RE: PicKit 2 Clone and 18F452 error 0028 problem 2009/03/27 08:39:00 (permalink)
    0
    I had no problem programming and running (without halting) on a PIC18F452 (and 458) with MPLAB 8.20:

    Programming Target (3/27/2009  10:31:19 AM)
    PIC18F452 found (c0)
    Erasing Target
    Programming Program Memory (0x0 - 0xF)
    Programming Program Memory (0x18 - 0x4F)
    Programming Program Memory (0x1D70 - 0x1D97)
    Verifying Program Memory (0x0 - 0xF)
    Verifying Program Memory (0x18 - 0x4F)
    Verifying Program Memory (0x1D70 - 0x1D97)
    Programming EEPROM Memory (0x0 - 0xFF)
    Verifying EEPROM Memory (0x0 - 0xF)
    Programming Debug Executive (0x-7DC0 - 0x7FFF)
    Verifying Debug Executive (0x7DC0 - 0x7FFF)
    Programming Debug Vector
    Verifying Debug Vector
    Programming Configuration Memory
    Verifying Configuration Memory
    Debug mode entered, DE Version = 1.0.3
    PICkit 2 Ready

    The PIC18F4685, 4520, & 2550 all have internal oscillators, whereas the 45x does not.  The oscillator must be running for the part to enter debug mode, and oscillator problems are a very common cause of failure to enter debug mode.  So be sure the correct OSC setting is selected in the config bits.

    If you would also post a screenshot of the configuration bits window in MPLAB after compiling the code, this might also help track down the issue.
     
    (Note that I did testing with a Microchip PICkit 2 unit)
    post edited by PICkit2Dev - 2009/03/27 08:40:10
    #20
    Page: 12 > Showing page 1 of 2
    Jump to:
    © 2017 APG vNext Commercial Version 4.5