• AVR Freaks

Hot!ATtiny25 internal EEPROM endurance

Author
Fausti
New Member
  • Total Posts : 25
  • Reward points : 0
  • Joined: 2014/11/23 11:59:51
  • Location: Germany
  • Status: offline
2020/03/12 01:23:59 (permalink)
0

ATtiny25 internal EEPROM endurance

Hello,
the ATTiny has 2 modes for EEPROM handling:  Ersae_Write and Write_only.
 
My question is, which code does produce more wear in the EEPROM:
 
Code1:
    EECR = (0<<EEPM1)|(0<<EEPM0); /* Mode 00=Ersae and write 10=Write only*/
    EEAR = 0;    /* Set up address */
    EEDR = 1;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
 
    EEDR = 2;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
 
    EEDR = 3;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
 
Code2:
    EECR = (0<<EEPM1)|(0<<EEPM0); /* Mode 00=Ersae and write 10=Write only*/
    EEAR = 0;    /* Set up address */
    EEDR = 0b11111111;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
 
    EECR = (1<<EEPM1)|(0<<EEPM0); /* Mode 00=Ersae and write 10=Write only*/
    EEAR = 0;    /* Set up address */
    EEDR = 0b11111110;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
 
    EECR = (1<<EEPM1)|(0<<EEPM0); /* Mode 00=Ersae and write 10=Write only*/
    EEAR = 0;    /* Set up address */
    EEDR = 0b11111100;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
 
    EECR = (1<<EEPM1)|(0<<EEPM0); /* Mode 00=Ersae and write 10=Write only*/
    EEAR = 0;    /* Set up address */
    EEDR = 0b11111000;    /* Set up data */
    EECR |= (1<<EEMPE);   /* Write logical one to EEMPE */
    EECR |= (1<<EEPE);   /* Start eeprom write by setting EEPE */
    while(EECR & (1<<EEPE));  // Wait until write is finished
#1

1 Reply Related Threads

    Fausti
    New Member
    • Total Posts : 25
    • Reward points : 0
    • Joined: 2014/11/23 11:59:51
    • Location: Germany
    • Status: offline
    Re: ATtiny25 internal EEPROM endurance 2020/04/16 22:49:42 (permalink)
    0
    Maybe my question was not clear to understand.
    In my application I would like to implement a 10 Million cycle counter.
    After every power on, the last counter value will read from internal EEP,  has to increased and saved back. Then the power will be switched off.
     
    My question is, what exact will produce the wear of the internal EEPROM ?
    1) The erase of one byte from unknown value to 0xFF
    or
    2) The write of one bit from 1 to 0 in one already erased byte
     
    So will the use of a separate bit in each byte without erase between increase the life time of EEPROM by factor 8?
    post edited by Fausti - 2020/04/17 06:21:29
    #2
    Jump to:
    © 2020 APG vNext Commercial Version 4.5