• AVR Freaks

ICD reads code space as all zeros

Author
RouseA
Starting Member
  • Total Posts : 85
  • Reward points : 0
  • Joined: 2003/11/07 12:35:04
  • Status: offline
2008/12/18 03:03:14 (permalink)
0

ICD reads code space as all zeros

I have developed several products using in-circuit programming of PICs without any problems.  However, the latest product is causing problems:
 
The design uses a PIC16F876A running at 3.3V.  The PGC and PGD pins are dedicated solely for programming, and MCLR has a 10K pull-up, but is also taken to the programming socket.
 
My problem is that although on occasion I have been able to use ICD2 to program and/or debug the product, most of the time programming fails, reporting memory locations as holding a value of 0x000 instead of the required value.  If I erase the device through ICD2, MPLAB says the erase has succeeded, but if I then verify that the device is blank it fails, saying address 0x0 reads a value of 0x0 instead of 0x3FFF.  If I read the device all locations read 0x00.
 
ICD2 correctly recognises the target device as a PIC16F867A, revision 0x8. 
 
I know from previous experience that there are issues using in-circuit programming at 3.3V (particularly that Code Protection cannot be re-programmed at less than 5V, so if it is set there is no way of programming at 3.3V).  However, my design is 5V tolerant, so I have tried configuring ICD2 to power the target. ICD2 then passes self-test and shows valid level on the target Vdd (4.8V), Target Vpp (12.6V) and MPLAB ICD 2 Vpp (12.7V), but programming still fails, with memory contents reading 0x00.
 
I have watched PGC and PGD on a scope while attempting to program (inside the ICD2 to confirm no problems with the connecting cable), and they have valid data levels.  I have tried two different ICD2's (both of which work on other products), and I have run MPLAB on two different computers.  I have also tried four different targets, but I get the same results every time.
 
I can unplug the ICD2 from the new product and plug it instead into a different target that uses a PIC18F252 running at 3.6V, then change the project on MPLAB, and I can program it using power from either the target or from the ICD2.
 
I am running out of ideas. Can anyone offer any suggestion why I should have this problem?
 
Regards

Regards
Alan Rouse
#1

13 Replies Related Threads

    Fetzo
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2007/06/17 13:15:57
    • Location: 0
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/16 14:52:47 (permalink)
    0
    I have exactly the same problem with my PICDem board using 18f4520. When I use ICD2 for programming, it succeeds but verification fails (all memory after address 1000 is read 0x0000). All voltage levels are OK, short cable between ICD2 and target. Same problem when erasing the device. All 0xFFFF up to address 0xFFF but at address 0x1000 and above all zeros.
     
    Programming and easing works well with a different programmer so I assume the device is OK.
     
    When I google I get the impression that this is not an uncommen problem. Any other idea than above what can be checked?
    #2
    asmallri
    Super Member
    • Total Posts : 1864
    • Reward points : 0
    • Joined: 2004/05/26 09:00:05
    • Location: Perth, Australia
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/16 16:10:40 (permalink)
    0
    I had a similar problem. Once I included a linker script in the project, the problem went away.

    Regards, Andrew

    http://www.brushelectronics.com/index.php?page=software
    Home of Ethernet, SD Card, and Encrypted Serial and USB Bootloaders for PICs!!
    #3
    Fetzo
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2007/06/17 13:15:57
    • Location: 0
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/17 07:24:33 (permalink)
    0
    Thanks for feedback. I have included linker scripts (18f4520.lkr for release and 18f4520i.lkr for debug build) but this didn't help. the strange thing is that programming works well with a different programmer, therefore I assume electrical problems.
     
    RB5 and RB6 are only connected to ICD, MCLR has a 10k R to Vdd. Vdd measured is 5.15v, Vpp programmer is 13.1V, Vpp target is 9.4V.
     
    To me this seems OK.
    #4
    Dredd
    Super Member
    • Total Posts : 549
    • Reward points : 0
    • Joined: 2003/11/07 12:36:53
    • Location: Montreal, Canada
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/17 07:57:04 (permalink)
    0
    It happened to me once to. I replaced the 10k on MCLR with a 4.7k. All went well after that...
    #5
    RouseA
    Starting Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2003/11/07 12:35:04
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/19 04:41:16 (permalink)
    0
    Since posting my problem I discovered the cause:

    The target board has a 3.3V regulator on the power supply.  I know from past experience that you cannot program a Flash PIC at a supply less than 5V if Code Protection is set, so I configured ICD2 to power the target and the ICD Setting confirmed that the power supply was 5V.

    However, I had overlooked the fact that the 3.3V regulator was between the PIC and the ICD2 connector, so although I was feeding 5V to the board the processor was only running from 3.3V.  Coupled with this I had downloaded a configuration that set the Code Protection bit.

    I cut a track and fitted a wire link so the ICD2 connector on the target was directly connected to the PIC and the problem was solved.



    Regards
    Alan Rouse
    #6
    DevMod
    Super Member
    • Total Posts : 327
    • Reward points : 0
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/19 10:16:14 (permalink)
    0 (2)
    A.R. --thanks for following up and posting your problem resolution.
     
    I'm going to pin this to the top.  It may help others with a similar problem.

    Please read the forum posting guidelines. Do not double post, please help keep these forums professional and comments respectful.
    Please notify the moderators of problems/spam/trolls.
    #7
    RouseA
    Starting Member
    • Total Posts : 85
    • Reward points : 0
    • Joined: 2003/11/07 12:35:04
    • Status: offline
    RE: ICD reads code space as all zeros 2009/01/19 10:57:57 (permalink)
    0
    As I said, I knew of the problem from past experience:

    Some time ago I developed a product using a PIC with a radio modem chip.  The maximum allowable supply to the radio was 4V, so the system ran from a 3V battery.  I inadvertently programmed some of the devices with Code Protection set.  When I subsequently tried to re-program them I couldn't.  Furthermore I couldn't use ICD2 power to raise the supply to 5V since this would damage the radios.  The PIC's were SMT devices, so we had no option but to unsolder them from the boards and replace them.

    Remembering the amount of work incurred then I should have spotted earlier that the problem I excountered recently had the same symptoms!

    Regards
    Alan Rouse
    #8
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: RE: ICD reads code space as all zeros 2010/07/10 05:05:26 (permalink)
    0
    liufang898186

    Excellent list! I've learned more from this forum in about 2 days than I have at any other forum community.


    argh! getting wiser and wiser!! Smile

    GENOVA :D :D ! GODO
    #9
    Brick
    Super Member
    • Total Posts : 1684
    • Reward points : 0
    • Joined: 2006/05/25 09:10:40
    • Status: offline
    Re:ICD reads code space as all zeros 2010/07/19 19:27:45 (permalink)
    0
    Yup I had the same issue once, it was code protected to :)
    #10
    Brick
    Super Member
    • Total Posts : 1684
    • Reward points : 0
    • Joined: 2006/05/25 09:10:40
    • Status: offline
    Re:ICD reads code space as all zeros 2010/07/21 19:56:30 (permalink)
    0
    Yup as with everyone else, had the code prototection issue to! :)
    #11
    gertvanloo
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2010/07/23 01:03:34
    • Location: 0
    • Status: offline
    Re:ICD reads code space as all zeros 2010/07/23 01:36:47 (permalink)
    0

    I think it is the latest SW release.
    Let me tell you what I found.
    I had a PIC16F1938 connected to my ICD2.
    It was connecting fine but reported something along the lines of :
    "Have ID code <XXXX> expected <YYYY> "
    (Sorry I don't have the exact text but that does not matter here)
    Both XXXX and YYY where non zero!
    The basic fast is : It could read the ID.
    The I realised that I had developed with version PIC16F1939 but
    for easy off soldering was prototyping on a (DIL) PIC16F1938.

    So I tried to switch to PIC16F1938 but it was not in the list of devices.
    That was because I was using version IDE 8.3.
    So I download 8.53, ran it and PRESTO! The ID it reads is ALWAYS ZERO!!
    I did not change any connections, no hardware changes whatsoever!
    The new version 8.53 did download a new OS to my ICD2.

    This evening whan I am back home I will try version 8.4x

    -- Gert.



    #12
    finarfin
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2011/02/28 05:58:07
    • Location: 0
    • Status: offline
    Re: ICD reads code space as all zeros 2011/02/28 06:32:11 (permalink)
    0
    I have the same problem with ICD-S and a PIC16F877.
    #13
    aflex
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2014/01/06 03:53:50
    • Location: Santa Ana, CA
    • Status: offline
    Flagged as Spam (3)
    Re: ICD reads code space as all zeros 2014/02/25 22:02:57 (permalink)
    0
    Without reviewing code it is difficult to say. So you need to consult with micro-programming expert in your area. He can easily resolve your problem.
    For basic problems these books may help you
     
    You can also contact . As they have same business niche as you.
     

    High Quality Manufacturer
    #14
    Jump to:
    © 2019 APG vNext Commercial Version 4.5