PSoC4: Emulated EEPROM

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

Hi All

   

I am currently working on Emulated EEPROM based project in which I am having a variable with data type "static const uint8 CYCODE" and I initialize it with value 0u. On certain event in my main code, I change the value of this variable and I want to retain this same value on power reset. But it is not happening at the moment. When I restart the device with power reset, I again end getting the value 0u. Is it mandatory to initialize this variable with some value? I think yes, because that only gives me output atleast once till power is ON though it is also a fact that after power reset I loose that value.

   

In short I need to have a variable in Emulated EEPROM that is independant of power cycles. Please provide a solution to this ASAP.

   

 

   

Regards

   

Shaunak

0 Likes
8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Hi Shaunak,

   

there is an example project for emeeprom (right click on component) which does work.

   

The initialization of your array or struct or whatever you'd define for eeprom data is required else the variable would be put into sram.

   

What is the returncode you get back from the Em_EEPROM_Write() ?

   

 

   

Bob

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

To put it another way? Do you actually use Eeprom_Write() at all? Or do you expect that defining the variable as CYCODE will make it automatically non-volatile?

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Another project that may be useful -

   

 

   

www.element14.com/community/community/design-challenges/smarter-life/blog/2013/11/24/psoc-4-tricopte...

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

@hli : I am using Em_EEPROM_Write() function

   

@Bob : As per your guidance, I have created a project, that works. Please find the attached one. In this project, I have used a single variable in order to test it. This code works well. Now I want to store a two-dimensional array in Emulated EEPROM, update it on certain events in main code and sustain the updated value even on power reset. I require help in doing that.

   

 

   

Thanks in Advance.

   

Shaunak

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

As long as the array is statically initialized (with a fixed size) you can handle it just a a large memory block. See http://beginnersbook.com/2014/01/2d-arrays-in-c-example/ . So you write as any other data structure, just the size is larger.

0 Likes
Anonymous
Not applicable

Shaunak,

   

Finally, an emulated EEPROM piece of code that works!  Using the emulated EEPROM in PSoC4 had me scratching my head, despite the Cypress example project.  Your code is straightforward.  Thanks.  My code will be completed in time for the trade show.

   

Jon

0 Likes
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

You are welcome, Jon !!!

   

 

   

Regards

   

Shaunak

0 Likes
lock attach
Attachments are accessible only for community members.
ShVy_264716
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

Hi Everyone. I am replying here after almost five years as I have an issue with Emulated EEPROM Component Versioned 2.20.

I have gone through the datasheet of Emulated EEPROM Component Version 2.20 and I have followed all the steps listed to set up fixed location based EEPROM in my PSoC4. While editing the linker script file "cm0gcc.ld" copy (custom_cm0gcc.ld), the key point is finding the line

.cy_checksum_exclude : { KEEP(*(.cy_checksum_exclude)) } >rom

in the code and adding the code segment

EM_EEPROM_START_ADDRESS = <EEPROM Address>;

.my_emulated_eeprom EM_EEPROM_START_ADDRESS :

{

KEEP(*(.my_emulated_eeprom))

} >rom

below it. I can not find the line in the linker file anywhere. What can be the reason behind this? Attached herewith is my project and linker file.

Regards

Shaunak Vyas

0 Likes