- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I am using Cy8C27443. I'm trying to write an array of int type (ADC values) to E2PROM then read back using button polling. However, I am facing problem writing values to E2PROM. I test the writing by iniitializing a RAM buffer as in this app note (http://www.cypress.com/?id=4&rID=60878). However it didn't work, I have read the E2PROM datasheet and technical reference manual, checked the size of my buffer, modified flash security.txt but it's not working.
I attached my prj below. Could you please give it a look and tell me what I did wrong, thank you very much!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, you write twice the amount of data your Writebuffer contain.
Second, you read data from a different buffer than you used to write your data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, you write twice the amount of data your Writebuffer contain.
Second, you read data from a different buffer than you used to write your data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is an example project in PSOC designer using the EEPROM,
CE57347.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Eric and Danaa,
@EricS: I thought that int type takes 4 bytes of data but when I checked the Compiler Guide and found out that the int type in psoc only takes 2 bytes, so I was wrong about it. Besides I made a mistake at "if (bError == E2PROM_1_NOERROR)".
About a different buffer, do you mean the address of the E2PROM I have written to or something? I learned from the app note which Danaa provided, they did the same, I found nothing wrong here.
Now my code works well, thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are right my second comment is wrong. I read your code too quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I have another question about E2PROM.
In the example CE57347, the E2PROM is initialized with the StoredValues at address 0x7FC0 and there is only "U" in the flashsecurity.txt so I assume the StoredValues is saved at that address.
Then the WriteData struct is written to the E2PROM so is the StoredValues overwritten or not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
'U' stands for unprotected, so when the EEProm address is 0x7FC0 it will be overwritten. Note that this may fail depending on the PSoC you use, there might be different EEProm start addresses.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some additional hints:
I usually put into my EEProm-structure a datafield to count the number of writes, when the value is zero (0) I assume that it has not been written yet and I initialize it by writing to it the first time. Later in the life of the device I have the opportunity to change the target address within the EEProm array when there have been too many writes (could be limited to 10K or 100K).
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, it's me again. I have a problem with reading an array in E2PROM.
After writing an array to E2PROM, I want to read each value in the array by its index.
The process I've done in the prj is read it back to a readbuffer, each time I push a button the index will be up (down) by one value, reflected by the readbuffer.address and then the LCD will display the value at the indexed value.
However, when I push button, the address value just goes up (or down) and doesn't stop, even after I release the button. I thought that would be debounce problem but it isn't.
(I followed the debounce example here: http://www.ece.drexel.edu/courses/ECE-C304/notes/PSoCDesigner_PSoC1_SleepTimer.txt One thing that in my project, I have already used a timer interrupt so I don't want another interrupt.)
Please take a look at my attached project and give me some advice, thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Normally you want to bounce a button on and then follow it by bouncing it off,
then execute the button function. Ie. a press and release approach before
executing the function.
Buttons come in many kinds of quality, some bounce several hundred mS.
Attached some approaches to debouncing.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider replacing this code -
writebuffer.buffer[0] = 1;
writebuffer.buffer[1] = 2;
writebuffer.buffer[2] = 3;
writebuffer.buffer[3] = 4;
writebuffer.buffer[4] = 5;
writebuffer.buffer[5] = 6;
writebuffer.buffer[6] = 7;
writebuffer.buffer[7] = 8;
writebuffer.buffer[8] = 9;
writebuffer.buffer[9] = 10;
writebuffer.buffer[10] = 11;
writebuffer.buffer[11] = 12;
writebuffer.buffer[12] = 13;
writebuffer.buffer[13] = 14;
writebuffer.buffer[14] = 15;
writebuffer.buffer[15] = 16;
writebuffer.buffer[16] = 17;
writebuffer.buffer[17] = 18;
writebuffer.buffer[18] = 19;
writebuffer.buffer[19] = 20;
writebuffer.buffer[20] = 21;
writebuffer.buffer[21] = 22;
writebuffer.buffer[22] = 23;
writebuffer.buffer[23] = 24;
writebuffer.buffer[24] =25;
with this
uint8 i;
for (i = 0; i < 25; writebuffer.buffer[ i ] = i + 1, i++);
For delay functions consider -
http://www.cypress.com/?id=4&rID=47960
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You set the variable "action" when a button is pressed, but you do not reset the action to not doing anything when the button is released.
I would suggest you to wait at the end of the loop for the button to be released.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your answers 🙂
As Bob says, I put everything in the while loop and it runs like forever so I take the "action" out and check it out of the loop, then I used the delay() functions instead of sleep timer decrement, now everything works fine 🙂
Again, thank you very much!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are always welcome !
Dana.