EEPROM doesn't Write/Read

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Hello   
I'm using EEPROM to save the LCD's contrast value.   
At the Start of program, read this value but   
Always same bad value was read.   
When change this value, write into EEPROM   
It is in Cy8C24223A   
I never seen this failer on other chips.   
What is wrong?   
0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There were some mentions from Dana that debugging starts to fail when the program size reaching the amount of flash. Can you shorten your program to the pure EEProm part and test again?

   

 

   

Another hint:

   

In PSoC 1 world do not define variables inside main(). They will be allocated as for any simple function (and main() IS a function) on the stack, thus reducing unnecessarily the availlable stack-space.

   

 

   

Bob

View solution in original post

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

There were some mentions from Dana that debugging starts to fail when the program size reaching the amount of flash. Can you shorten your program to the pure EEProm part and test again?

   

 

   

Another hint:

   

In PSoC 1 world do not define variables inside main(). They will be allocated as for any simple function (and main() IS a function) on the stack, thus reducing unnecessarily the availlable stack-space.

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        Thank you.   
0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

I noticed the following -

   

 

   

1) In flashsecurity.txt you have 2 blocks set to "U", but your EEPROM size

   

is only 64 bytes, so you only need to set the last block to "U".

   

 

   

2) When main() starts the first thing on debug is ICE cube loads program,

   

so all FLASH (including EEPROM) erased and re-programmed. Then you read

   

EEPROM and get a bad value because nothing has been written to it. You need

   

to save in EEPROM, in a word location, a value indicating EEPROM was written

   

at least once under main() control and test that value. I usually use 0c5555 as

   

a value to test.

   

 

   

So when porogram starts, first time ever, test value is junk not 0x5555. So you

   

default the LcdCont value to a default value. Then later main(0 writes 0x5555, and

   

the LcdCont value into EEPROM, so next time it is read you verify main() wrote

   

EEPROM, and that LcdCont in EEPROM has a legit value.

   

 

   

Keep in mind each time you recompile, download porogram, and debug, EEPROM

   

gets erased, and so does LcdCont get erased.

   

 

   

Regards, Dana.

   

 

   

.

Anonymous
Not applicable
        Thank you very much   
All was a waste   
One "U", word access, length=2   
It is very clear, read just after write   
that was wrong value (same 0x30)   
   
This tiny chip was almost full   
Maybe this is a cause.   
I gave up EEPROM on this design.   
0 Likes