View previous topic :: View next topic |
Author |
Message |
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
HEF many write cycles |
Posted: Thu Sep 23, 2021 3:14 pm |
|
|
Hello.
I would like to ask a question.
I have a code that at each change of state of a pin that will turn on a light, on or off, so I need to record the state that is being turned off, to know how it is when turning on, so I'm writing in HEF, however I saw that in the datasheet it says 100k erase/write, I think it will take a long time to reach this value, but let's say that when it reaches 80k problems may start to occur, or only when it exceeds 100k?
thanks.
PIC 10F322 |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Thu Sep 23, 2021 5:53 pm |
|
|
The quoted life should not be interpreted as being a set-in-stone value which every unit will achieve before failures start to occur. I believe that your estimate of 80k cycles before "most units" start to see a failure is probably quite reasonable. Temperature extremes as well as power supply value (for example if powered directly from a battery) will impact that number/lifetime.
If my boss was asking the same question, I'd say that 50k would be a wise number to tell him so that his expectations are set appropriately. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Sep 24, 2021 12:31 am |
|
|
Agree with newguy on this.
Lots of other things:
1) Make sure the chip revision is new. If you look at the original 10F32x data
sheet it didn't have HEF. This was added in a later sheet revision. Older
versions of the chip do not have this... Caveat.
2) You can degrade the write life of flash memory very badly if the supply
smoothing is poor. Careful design needed if you are to get close to the
quoted figure,
3) The 'reliability' figures, have the big caveat:
"These parameters are for design guidance only and are not tested.".
4) Be aware the HEF, is only the low byte of each word involved. Don't
try to use the upper bits of the instruction you are writing.
5) The smallest block you can erase is 16 words. Every write or erase uses
a 'life'.
6) You can have failures from life 1. However the probability is very low.
This is why SSD's used instead of hard drives, have spare blocks, and error
checking. They don't rely on even one cell working 100% reliably. If
your data needs reliability, consider writing data with a checksum. |
|
|
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
|
Posted: Fri Sep 24, 2021 4:34 am |
|
|
Thank you for your answers.
I only need to save 1 byte and each state change, but I did some calculations and 50k or even 80k would be too little, considering that each write and erase consumes a lifetime.
What would be the other alternative I would have to do this? Does anyone have a tip? |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Fri Sep 24, 2021 5:15 am |
|
|
One possible solution..
Have main() during normal operation, save the status of the control pin in RAM. Probably already is.
When the power to the PIC fails or you turn it off, quickly write that 'status' byte to the HEF.
When the PIC is repowered, read the HEF 'saved status' byte and decide how to proceed.
The 'tricks' are
1) to monitor that the PIC has lost power
and
2) have enough reserve electrons in the PSU cap to have the PIC write to the HEF.
I don't know if that PIC can set an interrupt on 'losing power', others might.
How big a cap you need depends on actual PIC current draw and HEF write time. Say you need 20ms of write time....use a cap to give you 3-4x that amount, so it WILL sucessfully write to HEF.
Doing this you only use up an HEF write, once per 'power down' cycle NOT every switch on-off cycle.
Jay |
|
|
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
|
Posted: Fri Sep 24, 2021 5:45 am |
|
|
Got it, this PIC model doesn't have a power loss interruption. I would have to do it using external components and maybe with the portA state change interrupt. But I don't have more physical space on the board for more components. But it's a good option, I'll see if it could be done. Thanks |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1909
|
|
Posted: Fri Sep 24, 2021 7:05 am |
|
|
FRAM is quoted as having an "infinite" lifetime, but FRAM memories aren't cheap.
Can you incorporate RAM + small coin cell battery? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Sep 24, 2021 9:37 am |
|
|
Can I suggest something like an I2C clock chip. Most of these have
a small amount of RAM. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Fri Sep 24, 2021 10:55 am |
|
|
I'm thinking that since a 10F series is used, cost is a factor ??
Have to admit, I spend $4 for a premade DS3231/EEP module that comes WITH battery. There's 7 or 8 bytes you can use as battery backed RAM in the DS3231 AND you get a 'free' 1Hz interrupt.....oh yeah a real time clock as well.... |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Fri Sep 24, 2021 11:23 am |
|
|
Actually Cypress has serial FRAM for less than 2 bucks
apiece. I have used them for years and no failures yet. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Fri Sep 24, 2021 12:06 pm |
|
|
If (haha) you had a spare pin, configure it as analog, to measure VDD. Have main() read it, if say >4.5, take no action. when it drops below, indicating a power fail, then save the 'status'. ? |
|
|
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
|
Posted: Fri Sep 24, 2021 2:11 pm |
|
|
newguy wrote: | FRAM is quoted as having an "infinite" lifetime, but FRAM memories aren't cheap.
Can you incorporate RAM + small coin cell battery? |
I can't embed anything else. |
|
|
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
|
Posted: Fri Sep 24, 2021 2:12 pm |
|
|
Ttelmah wrote: | Can I suggest something like an I2C clock chip. Most of these have
a small amount of RAM. |
I can't embed anything else. |
|
|
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
|
Posted: Fri Sep 24, 2021 2:14 pm |
|
|
temtronic wrote: | If (haha) you had a spare pin, configure it as analog, to measure VDD. Have main() read it, if say >4.5, take no action. when it drops below, indicating a power fail, then save the 'status'. ? |
I thought about it, I'm going to test it, because I can't have delays or anything consuming processing, as it can affect the IR reading.
But it's the only option without adding anything. |
|
|
rodrigo_cirilo
Joined: 31 Mar 2019 Posts: 43 Location: Sao paulo/Brazil
|
|
Posted: Fri Sep 24, 2021 2:16 pm |
|
|
thanks everyone, i will test this option and be back to report success or failure. |
|
|
|