• AVR Freaks

Hot!PIC24FJ128GC010 Data EEPROM Emulation

Author
WMaier
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2016/07/28 12:44:12
  • Location: 0
  • Status: offline
2016/08/15 08:55:08 (permalink)
0

PIC24FJ128GC010 Data EEPROM Emulation

Hi,
 
I am attempting to use Data EEPROM Emulation with my PIC24FJ128GC010, as per this.   However, I am finding that I cannot save memory between programmings.  In the project settings (I am using MPLABX v3.30), I do not see a setting to preserve EEPROM.  Is there a way to do this with the PIC24FJ128GC010.  If not, is there a better way I can use flash memory for saving data?

Thanks,
Billy
post edited by WMaier - 2016/08/15 10:30:36
#1

10 Replies Related Threads

    steverap
    Super Member
    • Total Posts : 162
    • Reward points : 0
    • Joined: 2003/11/07 12:38:54
    • Location: San Jose, CA, USA
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2016/08/15 10:28:35 (permalink)
    4 (1)
    There is no EEPROM on the PIC24FJ128GC010. The link you posted is bad; I assume you are using program flash to emulate EEPROM. I assume you are programming flash at a different address than that your program uses. You also didn't specify what programmer or debugger (if any) you are using. Debuggers typically use up a little bit of program space. You have to make sure you are not emulating EEPROM at a flash address that is being used by your program and the debugger code. 
     
    After you've verified the above, you will need to go to your debugger properties, and go to "Memories to Program", and click on "Preserve Program Memory" and set the start and end ranges for the flash area you want to preserve. 
    #2
    WMaier
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2016/07/28 12:44:12
    • Location: 0
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2016/08/15 10:58:43 (permalink)
    0
    Yes, we are trying to use the EEPROM Emulation in program flash.  I am using the REAL ICE programmer, and no debugger, although we are able to load the program memory with "Read Device Memory Main Project" button on the MPLABX toolbar.
     
    When looking at the program memory, is there a way to determine which areas have been programmed with the emulated EEPROM?  I cannot really decipher the different blocks of data and the address doesn't appear to be clearly set in any of the DEE Emulation code.
     
    Also, I have updated the link in the original post.
     
    Thanks!
    #3
    rcervantes
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2017/06/07 01:22:24
    • Location: 0
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2017/06/27 03:00:58 (permalink)
    0
    There is a way to preserve to over write memory. Go to your project->properties-><<Your configuration>>->Pickit3 (or your programmer)
     
    There, in "memories to program" choose the "preserve program memory" check and select the range 4000-6fff (for example)
     
    Note the 4000 should be the same as the one you set in #define DATA_ORIGIN 0x4000 in DEE_emiulation_16bits.c
    #4
    vicoET
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/09/06 06:56:01
    • Location: 0
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/02 01:33:14 (permalink)
    0
    hi, 
     i have the same need but i don't have #define DATA_ORIGIN in my DEE_emulation_16bits.c (probably newest revision).
    How can i determine the starting address and the range to be preserved?
    thank you
    #5
    ric
    Super Member
    • Total Posts : 28024
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/02 01:35:53 (permalink)
    2 (1)
    There must be a setting somewhere controlling which part of memory is used by the emulation software.

    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!
    #6
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11937
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/02 01:54:26 (permalink)
    5 (1)
    I don't think the 16-bit version lets you specify the address of the emulated EEPROM.  I think you'd have to manually apply __at to the emulationPages array.
    #7
    vicoET
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/09/06 06:56:01
    • Location: 0
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/03 12:20:00 (permalink)
    0
    jtemples
    ..  I think you'd have to manually apply __at to the emulationPages array.

    hi jtemples,
     sorry i don't understand what you mean. How can i do that?
     
    In the meantime, following a suggestion found in other forum, i read the program memory and inspect it "manually": i found that the storing area starts from the 2000h and (not sure) is DATA_EE_TOTAL_SIZE wide (=1FEh in my program).
    Then it was easy to set the prevent area 2000-21FF, and it works.
     
    But i'd like to fully understand to be absolutely sure that it wasn't just luck.
     
    regards
    vicoET
    #8
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11937
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/03 12:44:04 (permalink)
    0
    I've only used DEE on PICs with auxiliary flash, so I haven't had to worry about this, but I wouldn't expect the DEE allocation to always be at the same address if you make other unrelated changes to your software. 
     
    If you look at the DEE source code, you can see the storage is allocated by the definition of the emulationPages array.  No specific address is given for this array, but you can change that with the __at specifier.  Refer to the "Absolute addressing" section of the compiler's user's manual.
     
     
    #9
    vicoET
    New Member
    • Total Posts : 8
    • Reward points : 0
    • Joined: 2019/09/06 06:56:01
    • Location: 0
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/03 13:05:24 (permalink)
    0
    thanks,
     i think that you are referring to the section here, but i don't see any __at specifier (nor in the rest of the files)
     
     
     
    <DEE Emulation 16-bit.c>
        unsigned char emulationPages[DATA_EE_BANKS * NUM_DATA_EE_PAGES][NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2]

            __attribute__ ((space(psv), aligned(NUMBER_OF_INSTRUCTIONS_IN_PAGE * 2), noload));
     
        #define DEE_BANK_SIZE (sizeof(emulationPages[0])*NUM_DATA_EE_PAGES)
     
        #define DEE_PAGE_SIZE (sizeof(emulationPages[0]))    #define DEE_PAGE_TBL(bank, page) ((__builtin_tbladdress(&emulationPages) + (DEE_BANK_SIZE * (bank)) + (DEE_PAGE_SIZE * (page))) >> 16)
        #define DEE_PAGE_OFFSET(bank, page) ((__builtin_tbladdress(&emulationPages) + (DEE_BANK_SIZE * (bank)) + (DEE_PAGE_SIZE * (page))) & 0xFFFF)

     
    I honestly don't know much about that, i need to study more about it and compiler options.
    regards
     
     
    post edited by vicoET - 2020/08/03 13:07:14
    #10
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11937
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: PIC24FJ128GC010 Data EEPROM Emulation 2020/08/03 13:38:29 (permalink)
    0
    To clarify what I said above, you can change that by adding an __at specifier.
    #11
    Jump to:
    © 2020 APG vNext Commercial Version 4.5