How many writes can a 24LC256 take ?, let's find out !

Buzby

Senior Member
I've just started a 28X2 writing and reading a Microchip 24LC256, at 200 operations per second.

Let's see how long it lasts before it fails.

What's your guess ?
 

hippy

Ex-Staff (retired)
It depends upon exactly what your test does; are you repeatedly writing one location or cycling through memory and what's your definition of "fails" ?

If hammering one memory location it could all be over within a couple of hours but I expect you will achieve better than that.
 

westaust55

Moderator
This sounds interesting!

I'm going with 10,000,000 not sure why! ;)
ten times the Microchip defined life for 24LC256 . . .
Features
• Low-power CMOS technology:
- Maximum write current 3 mA at 5.5V
- Maximum read current 400 μA at 5.5V
- Standby current 100 nA typical at 5.5V
• 2-wire serial interface bus, I2C™ compatible
• Cascadable for up to eight devices
• Self-timed erase/write cycle
• 64-byte Page Write mode available
• 5 ms max. write cycle time
• Hardware write-protect for entire array
• Output slope control to eliminate ground bounce
• Schmitt Trigger inputs for noise suppression
• 1,000,000 erase/write cycles
• Electrostatic discharge protection > 4000V
• Data retention > 200 years
but certainly not to say it cannot last longer. The 10^6 wrie cycle life would be seen as a guaranteed minimum though you could have a task proving it failed before that in a warranty claim.

Nevertheless we await Buzby's EEPROM test outcome :confused:


However for the EEPROM in PIC chips (Across many datasheets):
D124 TREF Number of Total Erase/Write Cycles before Refresh (4) min =1M typ =10M max= n/a — E/W -40°C≤TA≤+85°C
 

Buzby

Senior Member
It's reached 1,000,000.

Now we are in uncharted territory, the datasheet doesn't guarantee anything past this.
 

westaust55

Moderator
as asked already,

are you writing to a single location or all loactions the same number of times.
Then coul see how long betfore one byte fails, how long before say 10 bytes fail (bit like how many "dead"/faulty pixels on an LCD screen) and how long before 10% fail.
 

hippy

Ex-Staff (retired)
It's worth looking through the forum for previous discussions and tests, and I'm sure a lot of comments will apply here; particularly regarding what any result shows and what that means compared to Microchip's figure which is based on more than just one or two random tests.

My guesstimate would be 5,000,000 erase cycles; half way to the the next magnitude up from Microchip's figure. Unlikely to fail at 1m, unlikely to reach 10m, so half way seems a good bet.
 

Buzby

Senior Member
I writing to location 0 only, but obviously a whole page is written each time.
The test is that the value written to 0 is the same when read back 5ms later.
It could be that a fault first occurs anywhere in page 0, or maybe anywhere in the memory, but testing for that will take too long.
 

Buzby

Senior Member
I'm getting bursts of 'fails', count around 1,100,000.
Suspect it maybe timing error due to hserout.
Stopping test to investigate.

Edit : Yes, it was hserout causing problems.
Added some pauses between hserouts, working OK now.
 

hippy

Ex-Staff (retired)
I writing to location 0 only, but obviously a whole page is written each time.
But is it ? I honestly don't know and haven't looked at the datasheet but there can be clever tricks such as being able to set bits low without erasing the byte affected. Unless the datasheet deigns to tell us exactly how things are implemented we may never know.

There is a Microchip note on Eeprom Endurance which might give some details.
 

westaust55

Moderator
Microchip app note on EEPROM endurance suggests writes are on a per byte basis:

Each programming cycle is usually referred to as an erase/write cycle
, since virtually all EEPROMs include an automatic erase step before programming.
Since E2s can be programmed down to the byte level, an erase/write cycle could be for as little as one byte to as much as a full page.
We will see later how these different write modes have an effect on endurance
Refer: http://www.microchip.com/stellent/groups/SiteComm_sg/documents/Training_Tutorials/en532276.pdf

Note also:
The second key effect on endurance is the choice of write mode. When a single byte is programmed, the energy from the
charge pump is concentrated on that one byte. If a page write is used, that energy is dissipated over more bytes, so cell wear
is decreased. Microchip builds in circuitry to minimize the wear effect of byte writes, but overall, designers should use Page mode
whenever possible
and
More information on Endurance
1. AN 1019 : Endurance Tutorial
2. AN 562 : Using Total Endurance S/W
 
Last edited:

Buzby

Senior Member
... there can be clever tricks such as being able to set bits low without erasing the byte affected. ...
I knew about that trick years ago with UV erasable EPROMs, where you could 'write' without 'erase', but only if bits were going low.
Microchip maybe doing something like that, but as I'm writing random bytes there will have to be an erase most of the times.

This test is not meant to be a full blown scientific investigation, just a quick(?) experiment.

So the guesses at the moment are 10M and 5M, anyone have any other guesses ?
 

Buzby

Senior Member
The bit about 'page mode' v 'byte mode' :

The second key effect on endurance is the choice of write mode. When a single byte is programmed, the energy from the
charge pump is concentrated on that one byte. If a page write is used, that energy is dissipated over more bytes, so cell wear
is decreased. Microchip builds in circuitry to minimize the wear effect of byte writes, but overall, designers should use
Page mode whenever possible.
Is this mode selection controlled by the PICAXE firmware ?
 

westaust55

Moderator
If you sent a single byte at a time then you use byte write mode.
send two or more bytes in the one hi2cout command and you are using page write mode
 

nick12ab

Senior Member
From Using i2c with PICAXE:
Note: One of the biggest mistakes made by beginners is that they don’t realise that page writes can only ‘start’ at a multiple of the buffer size, and cannot overflow the page buffer size. In effect this means (for an 8 byte buffer) you can write 8 bytes up from address 0 (or 8 or 16 etc.) but only up 6 bytes from address 2 (10, 18 etc.), or else you would overflow the 8 byte page write boundary.
The buffer size is 64 for a 24LC256.

There was a previous thread where someone was exceeding the capacity of the page write buffer and their additional data was getting written over the first data. So multiple bytes would have to be in the same page to avoid this, unless a short delay is added between them.
 

westaust55

Moderator
From the Microchip 24LC256 datasheet:
6.2 Page Write
The write control byte, word address and the first data byte are transmitted to the 24XX256 in much the same
way as in a byte write. The exception is that instead of generating a Stop condition, the master transmits up to
63 additional bytes,
which are temporarily stored in the on-chip page buffer, and will be written into memory
once the master has transmitted a Stop conditi
Nothing stating that one must start at a specific point. Only ensure you do not try to cross a page boundary.
16 bytes for the 24LC16 thru 64 bytes for the 24LC256, etc
 

Buzby

Senior Member
Sorry, I'm counting in 10,000's, so yours will be rounded to 4,750,000.

Should we have a prize for the closest guess ?
 

g6ejd

Senior Member
1h 20min is a million counts, you are a bit late, it's just passed 3 million !
I know, so now I'm going to 6-Million as my second guess.

This is a good experiment, as I have wondered many times as to the life of EEPROM.
 

Buzby

Senior Member
So how are you checking to see if it's failed? (Just curious!)
Code:
' Interrupt
' ---------
interrupt:

	' Generate another interrupt at next overflow
	' -------------------------------------------
   timer = 0xffff 					
   toflag = 0   
 
   ' Count writes
   ' ------------
 	inc ecount_low
 	if ecount_low > 9999 then
 		ecount_low = 0
 		inc ecount_hi
 	endif
 
 
 
 
 
 
 	' Test that this read = last write
    hi2cin 0, (rd_val)
 	 if rd_val <> wr_val then
	 	 
	 	 inc failed
	 	 
	 	 fr = rd_val
	 	 fw = wr_val
	 	 
 	 endif
 
 	' Write new value	 	
 	wr_val = randwrd
   hi2cout 0, (wr_val)
 
 
 
         
    ' Count time
    ' ----------
    inc ms_count 				' Count up in 5mS increments	
    if ms_count > 199 then
    	ms_count = 0    	
    	inc sec_cnt
    	if sec_cnt > 59 then
    		sec_cnt = 0
    		inc min_cnt
    		if min_cnt > 59 then
    			min_cnt = 0
    			inc hrs_cnt
				if hrs_cnt > 23 then
					hrs_cnt = 0
					inc day_cnt
				endif
			endif
		endif
    endif
 

erco

Senior Member
Pretty exciting stuff, this destructive testing.

Next, place your bets on what exact voltage will release the magic smoke...!

First prize, a lightly burned PicAxe.

Second prize, two burned Picaxes.
 

Buzby

Senior Member
Bugger, I've just realised I'm running this all at 3.3v, it will last till Christmas at this rate !

Count is now at 6.25M, how can I switch my AXE401 to 5v, without interrupting the power ?
 

Buzby

Senior Member
Isn't it about now that you realise you have a bug in your code?:D
Good Morning,

14,000,000 ... and I've purposely stopped it.

IWP's suggestion maybe true, I might have a bug.

Here is the code I was running :
Code:
#PICAXE 28X2
#NO_TABLE
#NO_DATA


sertxd ("EEPROM Test",cr,lf)

' Inputs
' ------
symbol pbStart      	= b.4		' Start


' Outputs
' -------

symbol ledIntActive 	= c.0	  	' Interrupt activity indicator 
symbol ledLoopActive = c.1    ' Main loop activity indicator
symbol Hz200	     	= c.2	  	' 200 Hz output

; hserout           	= c.6
' hserin             = c.7
' hi2c scl           = c.3
' hi2c sda           = c.4

' Variables
' ---------

symbol wr_val     = b0
symbol rd_val     = b1
symbol ee_val     = b2

symbol ms_count 	= w2		' Millisecond count ( b4,b5 )

symbol sec_cnt  	= b6		' Seconds count
symbol min_cnt  	= b7		' Minutes count 
symbol hrs_cnt  	= b8		' Hours count 
symbol main_cnt   = b9     ' Main loop count
symbol sec_old    = b10    ' Seconds memory
symbol day_cnt 	= w6		' Days count
symbol randwrd   	= w7
symbol failed     = w8
symbol ecount_low = w9
symbol ecount_hi  = w10     
symbol fr = w11
symbol fw = w12

' Code starts here
' ================

	setfreq em64					' Run at 64MHz
	
	pause 10
	
	hsersetup B115200_64, 2		' Set serial TX parameters 	

   pause 10

   hi2csetup i2cmaster, %10100000, i2cfast_64, i2cword

	pause 10

restaart:

	setintflags %00000000,%00000000 	' Stop interrupting on timer overflow 
	
	ms_count = 0   
	sec_cnt  = 0
   min_cnt  = 0
   hrs_cnt  = 0
   day_cnt  = 0
   failed 	= $FFFF
   
   ecount_hi = 110

	pause 2000

	hserout 0,(13,10,"EEPROM Test",13,10) 	 ' Say hello	
    
	pause 2000
	
	settimer 64286 						' Set timer preload value
	
   timer = 0xffff 						' Generate interrupt at next overflow
   toflag = 0 								' Clear timer flag
   setintflags %10000000,%10000000 	' Interrupt on timer overflow 
   
    
Do 'Main_loop:

	' Main loop activity indicator
   ' ----------------------------
	inc main_cnt 						' Toggle main loop activity indicator every 200 cycles
	if main_cnt > 200 then
		main_cnt = 0
		toggle ledLoopActive
	endif	
		
		
	' Make random
	' -----------
	random randwrd	
		
		
		
		
   ' Interrupt activity indicator
   ' ----------------------------
   if ms_count > 100 then' Toggle interrupt activity indicator every 500mS
   	high ledIntActive
   else	
		low ledIntActive	    
	endif


	' Print status every second
	' -------------------------
   if sec_old <> sec_cnt then
   	sec_old = sec_cnt
   	
   	gosub TXtimers
   	
   	hserout 0, (" ",#ecount_hi)
   	pause 5
   	hserout 0, ("0,000")
   	pause 5
   	hserout 0,(" F=",#failed)
   	pause 5
   	hserout 0, ( " fw=",#fw," fr=",#fr)
   	pause 5
   	hserout 0,(cr,lf)	
		  		     
   	
   endif
					
Loop ' End of Main_loop


' ==============================================================================================
' ==============================================================================================

' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' Interrupt
' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


' Interrupt
' ---------
interrupt:

	' Generate another interrupt at next overflow
	' -------------------------------------------
   timer = 0xffff 					
   toflag = 0   
 
   ' Count writes
   ' ------------
 	inc ecount_low
 	if ecount_low > 9999 then
 		ecount_low = 0
 		inc ecount_hi
 	endif
 
 
 
 
 
 
 	' Test that this read = last write
    hi2cin 0, (rd_val)
 	 if rd_val <> wr_val then
	 	 
	 	 inc failed
	 	 
	 	 fr = rd_val
	 	 fw = wr_val
	 	 
 	 endif
 
 	' Write new value	 	
 	wr_val = randwrd
   hi2cout 0, (wr_val)
 
 
 
         
    ' Count time
    ' ----------
    inc ms_count 				' Count up in 5mS increments	
    if ms_count > 199 then
    	ms_count = 0    	
    	inc sec_cnt
    	if sec_cnt > 59 then
    		sec_cnt = 0
    		inc min_cnt
    		if min_cnt > 59 then
    			min_cnt = 0
    			inc hrs_cnt
				if hrs_cnt > 23 then
					hrs_cnt = 0
					inc day_cnt
				endif
			endif
		endif
    endif
    
    

 	setintflags %10000000,%10000000 ' Interrupt on timer overflow


return ' Return from interrupt
' ==============================================================================================
' ==============================================================================================


 
' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' Subroutines
' xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


TXtimers:

	' TX time
	if day_cnt < 100 then : hserout 0,("0") : endif	
	if day_cnt < 10 then : hserout 0,("0") : endif	
	hserout 0,(#day_cnt,":")
	if hrs_cnt < 10 then : hserout 0,("0") : endif
	hserout 0,(#hrs_cnt,":")
	if min_cnt < 10 then : hserout 0,("0") : endif
	hserout 0,(#min_cnt,":")
	if sec_cnt < 10 then : hserout 0,("0") : endif
	hserout 0,(#sec_cnt)

return
Before posting yesterday, I did test the code by shorting the I2C bus, and got failures as expected.

This morning I ran the following code :

Code:
#PICAXE 28X2
#NO_TABLE
#NO_DATA


pause 1000

sertxd (cr, lf, "EEPROM Test 2",cr,lf)

pause 100

hi2csetup i2cmaster, %10100000, i2cfast_8, i2cword

pause 100

hi2cout 0, (11)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (22)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (33)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (44)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (55)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (66)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (77)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10

hi2cout 0, (88)
pause 10
hi2cin 0, (b0)
pause 10
sertxd (#b0,cr,lf)
pause 10
Results were perfect.

one.png

So we have two options :

1 - There is a bug in my code, and it does not 'write' to the EEPROM

2 - The EEPROM really did keep going after 14 million writes.

Thoughts please.

Buzby

EDIT : Tested code integrity again, by commenting out the 'hi2cout'. Got just under 200 fails per second, exactly as expected, so I think the code is working OK.

Running again still at 3.3v, will be running all day as I'm going out till tonight.
 
Last edited:
Top