Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

dsPIC33f internal Flash as EEPROM

Status
Not open for further replies.

STSCBE

Member level 2
Member level 2
Joined
Jul 9, 2016
Messages
43
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
360
Dear all,
For my application IÂ’m using 16-bit - dsPIC33FJ64GS606 microcontroller. The controller haven't EEPROM option. I found an option to use Program memory as for EEPROM from Microchip website

https://www.microchip.com/SWLibraryWeb/product.aspx?product=Data%20EEPROM%20Emulation%20for%20PIC

Actually i Got Project file but it cannot compile.

I dont know How to use that library for my application.
Help me out, or Is there any other option to use Flash memory as for EEPROM?


Thanks..
 
Last edited:

You didn't tell what's the exact problem is. The dee_emulation library is ready to use with xc16, other compilers need some adaption. I've used it e.g. with CCS C.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
You didn't tell what's the exact problem is. The dee_emulation library is ready to use with xc16, other compilers need some adaption. I've used it e.g. with CCS C.


Actually im using xc16 compiler, but how to add this lib to my application?

Thanks
 

If I remember right, it's well described in the accompanying doc.

Basically, add the *.c and *.h files to your project, configure the occupied memory range appropriately, call DataEEInit() at start and read/write functions in your code.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
Be careful about how you use the FLASH as an EEPROM.
The FLASH as a minimum of 10,000 erase/write cycles. I have no idea of what you intend to store in the emulated EEPROM and how often the values update but remember that you erase either a block or a row at a time (although you can write a single work as well as rows and blocks). While the EEPROM emulation can hide a lot of that from you, you can still reach the minimum number of erase cycles for a cell quite easily if you are not careful.
Also remember that the processor will stall during erase/write operation completes. This can impact other aspects of your application.
In general I've found that an external EEPROM overcomes all of these and is often a better design option.
Susan
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
I second what Susan explains.

I came across an application (not mine I hasten to add!) logging data every second and storing it in FLASH. The idea obviously seemed good at the time but the endurance of the storage was only a few days before the IC had to be removed, erased and reprogrammed. In my applications logging to EEPROM (25LC1024) every second I've got devices still working perfectly well after 10 years.

Brian.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
If I remember right, it's well described in the accompanying doc.

Basically, add the *.c and *.h files to your project, configure the occupied memory range appropriately, call DataEEInit() at start and read/write functions in your code.

Thnx, i Got :thumbsup:

- - - Updated - - -

Be careful about how you use the FLASH as an EEPROM.
The FLASH as a minimum of 10,000 erase/write cycles. I have no idea of what you intend to store in the emulated EEPROM and how often the values update but remember that you erase either a block or a row at a time (although you can write a single work as well as rows and blocks). While the EEPROM emulation can hide a lot of that from you, you can still reach the minimum number of erase cycles for a cell quite easily if you are not careful.
Also remember that the processor will stall during erase/write operation completes. This can impact other aspects of your application.
In general I've found that an external EEPROM overcomes all of these and is often a better design option.
Susan

but my application, I just read internal flash(2bytes), when my system power ON....After main loop i Wont...
 

And also, How to find user EEWrite Functions's data memory allocation in internal program memory?
Program Memory Window.PNG
 

And also, How to find user EEWrite Functions's data memory allocation in internal program memory?
Not clear what you're exactly asking for. All ram and rom allocations are shown in link map.

Be careful about how you use the FLASH as an EEPROM.
That's right of course. Eeprom emulation is primarily suited for parameters that are modified by user interaction, not for automatically generated data. The dee_emulation library provides a kind of flash file system which minimizes the number of erase cycles, a single parameter might be updated more than 10000 times. You can reduce the flash wear by assigning more flash sectors to the emulation.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
From what you say in Reply #7, if you only want to read a value on power-up and never write to the emulated-EEPROM, then you don't need an EEPROM at all.
Simply declare the value as 'const' and the compiler will place it in the FLASH memory for you and generate all of the required code when you read the variable in your code.
Susan
 

From what you say in Reply #7, if you only want to read a value on power-up and never write to the emulated-EEPROM, then you don't need an EEPROM at all.
Simply declare the value as 'const' and the compiler will place it in the FLASH memory for you and generate all of the required code when you read the variable in your code.
Susan
okay, but
in between, if i need to update that declared value, what i do?
 

I did flash usage by additional task. If data have to be readed, it taken directly from flash array. If we need to write data, we read full page to RAM, than modify necessary value, than erase flash and write new data.
Normally, I keep all values in RAM and writing to flash by additional command to save endurance.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
Hi,
I'm trying to test the DEEEmulation library's read and write function and i found that some issue, they are,
1. After programming at the first time, Need to Writes twice time in the same location that is,
Code:
DataEEWrite(01,05);        // data, location
DataEEWrite(02,06);        // data, location
DataEEWrite(01,05);        // data, location
DataEEWrite(02,06);        // data, location
if i give single time it reads gives different values instead of what i Written :sad::sad:

2. And before 10 to 12 times the DataEEWrite and DataEERead function is works very good. but after that, reads only last written value. even writing new values.
and find the Terminal Test Image
RS232.PNG

:roll: :oops: :sad: ?????????????
 
Last edited:

Guess you are using DEEEmulation somehow incorrect, e.g. not initializing it properly.

It's just impossible to debug your work from a distance.

I suggest usual debugging methods, e.g. tracing code execution in MPLAB, watching what each write action does to the flash array. If you feel this is all over your head, consider the previously suggested external EEPROM solution.
 
  • Like
Reactions: STSCBE

    STSCBE

    Points: 2
    Helpful Answer Positive Rating
Guess you are using DEEEmulation somehow incorrect, e.g. not initializing it properly.

It's just impossible to debug your work from a distance.

I suggest usual debugging methods, e.g. tracing code execution in MPLAB, watching what each write action does to the flash array. If you feel this is all over your head, consider the previously suggested external EEPROM solution.

Hmm, but as per procedure, i followed the initialization of DEEInit(); ... Can u see the image? there might clearfull
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top