8515 eeprom data

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello!
I use 8515 and I would like to save some user parameters on "shut-down" (like win registry..).
I know I can't do this in that way. I think I could store these parameters in internal eeprom variables. Now I ask you: are there problem to do this ? In other word, when user changes settings, eeprom data will be rewritten, could memory be damage ?

thanks and best regards,
Marco Trapanese

---
e-mail: marcotrapanese@tin.it
web: members.xoom.it/m_trapanese

ps. I'm sorry if my English isn't so good ! :-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!
You can put (deliver) one more microcircuit Flash and write on it

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Marco,

The AVR EEPROM is guaranteed to withstand 100K write/erase cycles. If you estimate you'll power down your chip more times than this, you should take advantage of the entire EEPROM by using a cyclic algorithm or something to the effect. If your requirements still haven't been met, you should begin to consider external components.

Best regards,

Morten, AVR tech. support, Atmel FAE

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Morten!
You said: "If you estimate you'll power down your chip..."
I don't undestand a thing: if I declare a variable like this (in CodeVision C Complier)

eeprom int a = 0;

value of 'a' will be stored into internal eeprom, now if I set a = 5; immediatly eeprom will be update with the new value, is it right ?. So I have to check how many times I change eeprom stored data values instead how many times I "power down" chip, isn't it ?
If I'm wrong... please tell me!!!

Best regads,
Marco Trapanese

---
e-mail: marcotrapanese@tin.it
web: members.xoom.it/m_trapanese

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Marco,

you Wrote ;-

>eeprom int a = 0;
>value of 'a' will be stored into internal eeprom, now if I set a = 5; immediatly eeprom will be update
>with the new value, is it right ?. So I have to check how many times I change eeprom stored data
>values instead how many times I "power down" chip, isn't it ?

That is right..
What I have on my synthesiser are a couple of menus, when you EXIT a menu it saves ALL the parameters to EEPROM, but ONLY when you exit a menu, I made a function called eeprom_write();
which writes to the eeprom when its called.
This way I can change the values in the program but only write to them once..

I'll explain how I do this ;-

int a = 0; // working value of a variable
eeprom int a_eeprom ; // value stored in eeprom

You'll notice I havent given 'a_eeprom' any value..
Now you have two variables, use 'a' whilst your normal program runs,

During startup, to recall a value from eeprom you can now do this;-

a = a_eeprom ; // get value from eeprom

Then when you need to save it simply do ;-

a_eeprom = a ; // save value to eeprom

this reduces the number of writes to the eeprom,
But does mean you need to have a "save settings" option in your software (maybe a button?)

Hope this helps
Paul Maddox

Http://www.wavesynth.com/

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your answer!
Yes, now I understand how eeprom works and how I could save some parameters on exit.
When I say "save setting", that means, for examples: I'm writing a software for digital tuning for a FM receiver. User can change frequency, but on power-up I would like display shows the last frequency used. So, I thougth store into eeprom this value. But, for discussed problems, I will not do this. I haven't a menu to select "exit" function and also another external command isn't useful. With uC programming we haven't event for "power-down", like VisualBasic !!!!

Thanks again,
bye

Marco Trapanese

---
e-mail: marcotrapanese@tin.it
web: members.xoom.it/m_trapanese

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Or, you could have the exit button connected to a port pin. Then, when hit it stores the values in EEPROM. Finally a MOSFET or Transistor is connected to another pin, and that is turned off, which in turn turns the power off. Hitting the on button triggers the MOSFET or transistor for a tiny time, in which the AVR stablizes and turns the MOSFET ot transistor on. The button is released, but power is still on.

Good Luck!

Colin

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You may wish to reduce the number of EEPROM writes by reading it first and only writing if there is a change to record. Grant

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you to all !
Your suggestions are very useful for me.
I'm a newbie and I don't know these tricks... thanks again!

bye,
Marco Trapanese

---
e-mail: marcotrapanese@tin.it
web: members.xoom.it/m_trapanese

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have build a receiver with a knob, which schould react in the same way as former tube receivers.
Means, I can change the frequency anytime and on power up the same frequency, which was selected on power off, must be received.

To avoid to many EEPROM write cycles I do the following:

- write only, if the value was different,
so no extra store button was needed

- write only, if not already written during the last 1 second,
so also on fine adjusting no excessive write cycles occur.

- write only, if 10 seconds gone after reset,
so power on effects should be avoided.

- set the address register to 00h, after any succesful read or write,
so unintentional write should not affect real data.

Peter

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Marco,

The other thign you could do , if its a radio, ia combination of Grants idea and an additional idea.

Read the value from your tuneing dial (assuming this is what you want to store) then if the value is different to eeprom value AND the new value hasnt schanged to 10 seconds then write to the eerpom.
In this way you write when a value has changed but only if its not constatly changing (ie, tuneing in a new station).. I would imagine you may be able to increase the 10 seconds, as after tuning in a station you would listen to it for longer than 10 seconds before turning off the receiver.
so anything up to a few minuets would be ok..

The points Peter makes about resetting address register and 10seconds after reset are VERY good points and worth remembering..

Paul Maddox

Http://www.wavesynth.com/

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paul,

your idea is a great idea!
Thanks also to Peter and Grant. Just a thing: I don't understand why (and how...) I should reset address register (however, I write in C).

Thanks!!!

best regards,
Marco Trapanese

---
e-mail: marcotrapanese@tin.it
web: members.xoom.it/m_trapanese

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Marco,

The reason for resetting the register (as Ive been led to beleive) is that sometimes on power down the EEPROM can mistakenly have data written to it.. if you reset the register to ZERO and avoid putting any data in the first byte you will avoid this 'slight' bug... I have to say Ive NEVER had this happen to me (on the projects where Ive forgotten to reset the register) but I have heard of people who have, its just a pre-caution..

Paul

Http://www.wavesynth.com/

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok Paul, but I write in C and I declare my eeprom variables like this:

eeprom int a;

now, how could I resetting register to 0x00 and avoid to store data into first cell ?

thanks,
Marco Trapanese

---
e-mail: marcotrapanese@tin.it
web: members.xoom.it/m_trapanese

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't use your compiler, but I suppose should be enough to declare a "scratch" char variable as 1st eeprom class variable, and the linker should put it in position 0. Have a look to the map file for a check.
I use ImageCraft and in this case there is a built-in protection, I mean linker simply starts allocating variables from EEPROM location 1, so I have nothing to do.

Regards,
Giuseppe

admin's test signature