How to Access EEprom

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

cross mob
Anonymous
Not applicable

Hello Folks,

   

I have seached but I haven't really found a way to simply access EEprom data!

I just want to save and retrieve non-volatile Data. And the simulated EE-prom API is unfortunatelly not available. Thank you for your help 🙂

   

 

   

LG NIklas

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Read "System Reference Guide" (to find under "Help" in Creator). See memory organization. Use top of flash for your data, there are consts defined for number pf bytes in a row, number of rows etc. No additional #include needed.

   

I would suggest to define a structure as large as a flash row or less. you can tpedefr a pointer to this structure ans assign the row's address to it. Will make handling easier. You'll need same structure in ram when you set new values and program the flash anew. Use a counter within the struct to see if struct is virgin (0) which needs an initialization and keep track of number of flash writes.

   

 

   

Bob

   

PS: Wo lebst Du? Ich bin nahe Bremen.

View solution in original post

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

Welcome in the forum, Niklas!

   

The EmEEProm is not availlable for the BLE-chips because it infers with clock settings and interrupt availlability.

   

Only way out is to "put aside" some flash memory and use the CySysFlashWriteRow() API to store some data.

   

 

   

Happy coding

   

Bob

   

PS: Bei den Temperaturen gestern hab ich mich auch wie eine Bratwurst gefühlt.

0 Likes
Anonymous
Not applicable

ahhh thank you! 🙂
 

   

 

   

Ps: jaa ich wurde mit dem Namen gestern inspiriert 😄
 

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

Read "System Reference Guide" (to find under "Help" in Creator). See memory organization. Use top of flash for your data, there are consts defined for number pf bytes in a row, number of rows etc. No additional #include needed.

   

I would suggest to define a structure as large as a flash row or less. you can tpedefr a pointer to this structure ans assign the row's address to it. Will make handling easier. You'll need same structure in ram when you set new values and program the flash anew. Use a counter within the struct to see if struct is virgin (0) which needs an initialization and keep track of number of flash writes.

   

 

   

Bob

   

PS: Wo lebst Du? Ich bin nahe Bremen.

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

Keep in mind your endurance un leveled is 100K cycles.

   

 

   

These might help on constants in FLASH -

   

 

   

    

   

          

   

http://www.cypress.com/?rid=91945

   

 

   

http://www.cypress.com/?id=4&rID=57109

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thank you guys for your help so far!
 

   

Unfortunately the CySysFlashWriteRow() function does not write to my desired Flash location ( I used

   

#define MY_FLASH_ROW (CY_FLASH_NUMBER_ROWS - 2) )

   

 

   

and the CYCODE or const declarator is not working for me because I need to be able to change the value (not very often so I am not destroying the flash)

   

 

   

What can I do to access the falsh memory safely?

   

 

   

Ps: Bin gebürtiger Oldenburger, wohne aber in Karlsruhe *schwitz*
 

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

Supervisory Flash might be of use -

   

 

   

    

   

          http://www.cypress.com/?rID=110097

   

 

   

And there is the general FLASH programming doc -

   

 

   

    

   

          www.cypress.com/?docID=48133

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

The Sflash sounds good but I just don't understand the pseudocode!
I can't use these macros and its not working writing data directly to 0x0FFFF200.

   

Can you give me an example on how to write a byte/row to the sflash?
 

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

On the link for the supervisory flash page there is a project

   

you can look at.....

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thank you soooo much 🙂

Its working now exactly how I wanted it to.
 

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

Glad I could help.

   

 

   

Regards, Dana.

0 Likes