1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Pickit 2 overwriting 16F internal EEPROM

Discussion in 'Microcontrollers' started by Mosaic, Jun 27, 2017.

  1. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,569
    Likes:
    128
    Location:
    Caribbean
    Ok, I can't seem to get the Pickit2 (V2.61) to stop overwriting the EEPROM in a 16F886. Even whn I deselect it the internal EEPROM is rewritten by the hex code EPROM (0x2100 allocation) .
    I have CPD as off and CP as on:

    #include "P16F886.inc" ; processor specific variable definitions
    __CONFIG _CONFIG1, _IESO_OFF & _FCMEN_OFF & _PWRTE_ON & _WDT_OFF & _INTOSCIO & _BOR_ON & _LVP_OFF & _CP_ON &_CPD_OFF & _MCLRE_OFF &_INTRC_OSC_NOCLKOUT; EEPROm data not locked to allow readout before reflashing and rewrite after firmware changed.
    __CONFIG _CONFIG2, _WRT_OFF & _BOR40V

    Any advice on this?
     
  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    You have to de select it on the programmer!

    Pickit 2 and 3 have a "preserve eeprom" check window and it can stop any data being overwritten... If you use MPLAB then it will always clear the eeprom ( fills it with 0xff )
     
  3. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    ONLINE
    By "MPLAB," I assume you mean ICD3. Are you sure ICD3 erases eeprom? Using MPLAB IDE 8.92, one has a choice for retaining it, which is the same option screen I get for PicKits:
    upload_2017-6-28_4-28-14.png

    John
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE

    He mentions pickit2 but not the IDE so I assume pickit2 ( older ) so possibly MPLAB 8.xx
     
  6. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,569
    Likes:
    128
    Location:
    Caribbean
    No MPLAB. Just a load hex and flash, I did deselect the EEPROM with the PICKIT2. It still overwrites.
     
  7. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,165
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    Are you using the standalone PK2 software?... I have preserved the eeprom many times.. Once deselected it should read "preserve Device Eepom on write" in red!
     
  8. Mosaic

    Mosaic Well-Known Member

    Joined:
    Jun 3, 2010
    Messages:
    2,569
    Likes:
    128
    Location:
    Caribbean
    It does...I am really not sure why it appears unreliable.
    I am usung the standalone PK2 s'ware.

    EDIT
    It seems that if I deselect the EEPROM and try to reflash the hex autoload sequence of the PK2 renables the EEPROM writes.

    I must load the hex, then deselect the EEPROM, then flash to get it right.
     
    Last edited: Jun 28, 2017
  9. Pommie

    Pommie Well-Known Member Most Helpful Member

    Joined:
    Mar 18, 2005
    Messages:
    10,022
    Likes:
    317
    Location:
    Brisbane Australia
    Your hex file must contain the EEPROM data. You could try removing it manually. This page explains the sections of the hex file.

    Mike.
     

Share This Page