CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

HEF many write cycles
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
avro698



Joined: 11 Nov 2006
Posts: 9
Location: South Wales, UK.

View user's profile Send private message

PostPosted: Thu Sep 30, 2021 7:11 am     Reply with quote

Have you considered something like 47L04? (https://www.microchip.com/en-us/product/47L04)
SRAM and option to automatically backup on power fail + restore data on power up. Only requires an extra capacitor.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Sep 30, 2021 7:36 am     Reply with quote

Gee that 47L04 costs $1.25 CDN.. and I get RTC/EEP modules for $2, though I still think there has to be a pin compatible PIC that'll save 1 bit for less....
rodrigo_cirilo



Joined: 31 Mar 2019
Posts: 43
Location: Sao paulo/Brazil

View user's profile Send private message Send e-mail

PostPosted: Thu Sep 30, 2021 7:58 am     Reply with quote

Thanks everyone for the tips.
rodrigo_cirilo



Joined: 31 Mar 2019
Posts: 43
Location: Sao paulo/Brazil

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 01, 2021 6:04 am     Reply with quote

Hey guys.
About the amount of write cycles that the 10f322 HEF supports, which was the initial question of this topic and as the datasheet informs, this pic supports 100k write or erase right?
well, I wrote this code below, to write and erase the memory many times, with another pic with display and external interrupt, I take each output pulse and increment a counter that is shown on the display, I already passed the 300k counter and the 10F322 continues to work.
What they tell me, I've already passed 200k of the limit informed in the datasheet, is that right?

Code:

 
#include <10f322.h>
#fuses NOMCLR
#fuses NOPROTECT
#fuses INTRC      //INTOSC speed 4MHz
#FUSES NOWDT 
#FUSES NOWRT
 
#use delay(clock=8000000)//,restart_wdt)
#use fast_io(A)


 #ORG 0x1F8, 0x1FA {}
 #INCLUDE <STDLIB.H>
 #define HEF 0x1FF
 
 
 #byte PMADRH=getenv("SFR:PMADRH")
#byte PMADRL=getenv("SFR:PMADRL")
#byte PMDATH=getenv("SFR:PMDATH")
#byte PMDATL=getenv("SFR:PMDATL")
#bit CFGS=getenv("BIT:CFGS")
#bit WREN=getenv("BIT:WREN")
#bit FREE=getenv("BIT:FREE")
#bit LWLO=getenv("BIT:LWLO")
#BIT WR=getenv("BIT:WR")
#byte PMCON2=getenv("SFR:PMCON2")

int8 buffer[2] = {0,0};


int1 toggle;
unsigned int8 count, i, address, command;



void my_erase_program_eeprom(int16 address)
{
  //erases the page at the selected address
  disable_interrupts(GLOBAL);
  CFGS=FALSE;
  PMADRL=make8(address,0);
  PMADRH=make8(address,1);
  CFGS=FALSE;
  FREE=TRUE;
  WREN=TRUE;
  PMCON2=0x55;
  PMCON2=0xAA;
  WR=TRUE;
  delay_cycles(1);
  delay_cycles(1);
  WREN=FALSE;
  enable_interrupts(GLOBAL);
}

void my_write_program_memory(int16 address, int16 *data, int8 ctr)
{
  //Beware - this does not erase a page for you, and will not handle
  //a write that goes beyond the end of a page. Only works to
  //write ctr bytes, to the program memory starting at address
  int8 count;
  disable_interrupts(GLOBAL);
  WREN=TRUE;
  CFGS=FALSE;
  LWLO=TRUE; //load latches only
  PMADRL=make8(address,0);
  PMADRH=make8(address,1);
  for (count=0;count<((ctr/2)-1);count++)
  {
    PMDATL=make8(data[count],0);
    PMDATH=make8(data[count],1);
    PMCON2=0x55;
    PMCON2=0xAA;
    WR=TRUE;
    delay_cycles(1);
    delay_cycles(1);
    PMADRL++;
  }
  LWLO=FALSE;
  PMDATL=make8(data[count],0);
  PMDATH=make8(data[count],1);  //last word
  PMCON2=0x55;
  PMCON2=0xAA;
  WR=TRUE;
  delay_cycles(1);
  delay_cycles(1);   
  WREN=FALSE;
  enable_interrupts(GLOBAL);
}

//memory layout definitions
struct twobytes
{
     int8 l;
     int8 h;
};

union prog_mem
{
     int16 word;
     struct twobytes b;
};


void main(){
 
  setup_adc_ports(NO_ANALOGS);               // Configure AN pins as digital
  output_a(0);                               // PORTB initial state
  set_tris_a(0b1100);                             // Configure RB0 pin as input
 
 
  delay_ms(2000);                             // Wait 100ms
 
 
    read_program_memory(HEF,buffer,2);
     if(buffer[0] == 0xFF)
     {
       output_low(PIN_A1);
     
     }
     else if( buffer[0] == 0x10)
     {
       output_high(PIN_A1);
     }
   
   
 
  while(TRUE)
  {
 
 
        read_program_memory(HEF,buffer,2);
        my_erase_program_eeprom(HEF);
         if( buffer[0] == 0x10)
           {
              output_low(PIN_A1);           
              buffer[0] = 0xFF;
               buffer[1] = 0xFF;               
              my_write_program_memory(HEF, buffer, 2);
               delay_ms(100);
           }
           
         else if( buffer[0] == 0xFF)
           {
             output_high(PIN_A1);           
              buffer[0] = 0x10;
              buffer[1] = 0x10;             
              my_write_program_memory(HEF, buffer, 2);
                delay_ms(100);
           }
       
   
        buffer[0] = 0;
        buffer[1] = 0;
     
     
 
   
  }
}


I ran the code and then read the memory with pickit3 and the values ​​in memory were changing, proving that the code is working.
gaugeguy



Joined: 05 Apr 2011
Posts: 286

View user's profile Send private message

PostPosted: Mon Nov 01, 2021 7:12 am     Reply with quote

Going beyond the data sheet limits is not a guarantee it will fail right away. It will typically continue working past the limit but you will have no idea how long past. You only know you are safe when you are below the data sheet limits.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Nov 01, 2021 7:16 am     Reply with quote

Also, the HEF will often fail after the chip is switched off for a while. Repeated
writes tells you almost nothing... Sad
rodrigo_cirilo



Joined: 31 Mar 2019
Posts: 43
Location: Sao paulo/Brazil

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 01, 2021 7:44 am     Reply with quote

gaugeguy wrote:
Going beyond the data sheet limits is not a guarantee it will fail right away. It will typically continue working past the limit but you will have no idea how long past. You only know you are safe when you are below the data sheet limits.


Yes I understand that I will only be safe below what the datasheet tells me. I took this test to see how far it goes.
rodrigo_cirilo



Joined: 31 Mar 2019
Posts: 43
Location: Sao paulo/Brazil

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 01, 2021 7:47 am     Reply with quote

Ttelmah wrote:
Also, the HEF will often fail after the chip is switched off for a while. Repeated
writes tells you almost nothing... Sad


I went up to 200k, then I turned it off, 12 hours later another 50k, another time later, another 50k, and now I'm 40k more. and the code keeps working normal.
When it reaches 50k again, I'll turn it off, wait a while and run it up to another 50k.

What will happen when memory fails? the code will no longer run?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Mon Nov 01, 2021 7:54 am     Reply with quote

Problem is you are not testing/changing all the bits in the byte.
You need to write 0xAA, then erase, and write 0x55, then erase and repeat.
This way you are setting every alternate bit. On the reads you need to test
that the bytes are 0xAA then 0x55.
rodrigo_cirilo



Joined: 31 Mar 2019
Posts: 43
Location: Sao paulo/Brazil

View user's profile Send private message Send e-mail

PostPosted: Mon Nov 01, 2021 8:07 am     Reply with quote

But that's how I'm going to use it, so I'm testing it like that.
So if I use it that way, will I be safe if I go over 100k?
gaugeguy



Joined: 05 Apr 2011
Posts: 286

View user's profile Send private message

PostPosted: Mon Nov 01, 2021 8:22 am     Reply with quote

If you want to test for failure, you need to make sure to test it under the worst stress. This includes temperature which can also make a big difference in time to fail.

Regardless of the test results you are never "safe" to go beyond the data sheet limits. You must also have some type of error checking present to ensure your data is valid. A crc for a sequence of bytes, a parity check, using inverted bytes, or something that provides confidence the data read is valid.
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Nov 02, 2021 5:43 am     Reply with quote

re: .....
Quote:
make sure to test it under the worst stress

That'll be 3 hours before the 450 pcs of the product HAS to be shipped 1/2 way around the world........
.. and the coffee pot broke...

Agree about the data patterns. Should actually write/read at least 2 banks of checkerboard data. gets me wondering how mfrs test their RAM, EEPROM, HDs as that stuff is HUGE compared to the 'good old dayze'....
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Nov 02, 2021 7:20 am     Reply with quote

They often don't.
If you look, they have lines like 'this parameter is characterized but not
tested'.
What they do do is run very long test sequences, on quite large numbers of
chips from different batches, and then take the 'worst case' result as the
specification.
However you can then get a 'rogue' batch that performs hundreds of times
worse than the specification. I had a batch of several thousand PIC's that
were all failing after only a few dozen programming cycles. Microchip did
replace them, but it caused a lot of problems....
Flash failures rise massively with increased temperature, so the specification
will often be orders of magnitude below the real figure if you only test at
a 'room' temperature.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group