4 Replies Latest reply on Oct 19, 2013 8:16 AM by junichi.hiraoka

    EEPROM doesn't Write/Read

    junichi.hiraoka
              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?   
        • 1. Re: EEPROM doesn't Write/Read
          user_1377889

          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

          • 2. Re: EEPROM doesn't Write/Read
            junichi.hiraoka
                    Thank you.   
            • 3. Re: EEPROM doesn't Write/Read
              user_14586677

              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.

                 

               

                 

              .

              1 of 1 people found this helpful
              • 4. Re: EEPROM doesn't Write/Read
                junichi.hiraoka
                        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.