Author Topic: FLASH memory write without pre-erase  (Read 17862 times)

0 Members and 2 Guests are viewing this topic.

Offline Peabody

  • Super Contributor
  • ***
  • Posts: 2795
  • Country: us
Re: FLASH memory write without pre-erase
« Reply #25 on: February 26, 2022, 04:03:26 pm »
Would you consider using something other than flash?  Nothing else would be as cheap, but it seems FRAM or battery-backed SRAM might perform better for what you're doing.  Not sure you would find anything at 4MB though.

 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: FLASH memory write without pre-erase
« Reply #26 on: February 26, 2022, 06:15:37 pm »
Quote
you must rewrite nearby cells after some write cycles

The Adesto data sheet (and actually the data sheets for the same ATxxxx devices, under the Atmel or Microchip brand) document this issue, with some limiting the sector total page write to as little as 10k. But none say anything about "nearby" cells; the affected cell can be anywhere within the same sector.

If you can be sure you always have power, or you have a rock solid power fail detection giving you a margin of > 20ms, then the solution is fairly easy to implement: whenever you write a page, you set a "this sector needs a refresh" flag. That flag can probably be in RAM, because it doesn't really matter if you don't get around to it the 1st time. Or you could have a proper counter in RAM, and when it reaches say 10k, increment a count in FLASH. Then you have an RTOS task which runs when that FLASH write count reaches 5 and which refreshes that whole sector. Or some smarter variation...

The funny thing is that these chips have another 16 bytes per page, which can obviously be used for counters and such, but the data sheet doesn't give you any hint on how to do it intelligently. Have lots of people solved this independently, or maybe nobody bothers? It is quite possible that in most applications one gets away with it, by accident.

Quote
FRAM or battery-backed SRAM might perform better for what you're doing

FRAM is expensive, and poorly multi-sourced. Battery backed SRAM is a really big problem because of poor battery options. I have been doing that for decades; the basic problem is that all the batteries which have a long functional life (decades) are primary (and you can get maybe 20 years before they fail into a short circuit), and the rechargeable ones have a poor life. This product has to work for > 20 years. I already have a 0.22F supercap on the RTC (which is inside the 32F417) and that runs for about 3 days which is OK for the application.

Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 6939
  • Country: es
Re: FLASH memory write without pre-erase
« Reply #27 on: February 26, 2022, 07:44:37 pm »
Oops, what I had read was for MLC flash.
Anyways, it was read disturbance, not nearby-cells-anything :D
https://users.ece.cmu.edu/~omutlu/pub/flash-read-disturb-errors_dsn15.pdf

What about a low power sram or sdram + supercap?
Some chips have a retention-only ultra low power state.
And a 1F supercapacitor isn't that expensive anymore?
« Last Edit: February 26, 2022, 07:49:02 pm by DavidAlfa »
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3437
  • Country: au
Re: FLASH memory write without pre-erase
« Reply #28 on: February 27, 2022, 08:25:01 am »

BUT: While I think we can say that on info currently known this approach isn't suitable for repeated writes of 0 with 0.  But what if you write a 0 with a 1? It will still be a 0 afterwards :)
This is for the scenario where you have a byte of say 00000001 and you want to make it 00000000, so you write 11111110. What is wrong with that, physically, in the silicon?

It should be easy to try that, and it seems a good and simple idea to avoid potential issues.

I think one failure mechanism of multiple 0 writes is charge bubble overflow into adjacent bits, so you could program a checker board pattern and use your zero mask on one half, and skip the zero mask on the other half, and then thrash it for a day or two, and see if any 1's ever read 0 unexpectedly.

The HW may be smart enough to avoid multiple zero write attempts, but I'm not sure how you'd prove that ? maybe record the program time via polling ?
 

Offline abyrvalg

  • Frequent Contributor
  • **
  • Posts: 898
  • Country: es
Re: FLASH memory write without pre-erase
« Reply #29 on: February 27, 2022, 01:10:58 pm »
I thought about comparing programming times for 1->0 and 0->0 cases too, but this would prove nothing I guess: internal programming algorithms are iterative (pretty same as algos applied externally on 27xx series) - give a HV pulse, read back, compare, repeat if doesn’t match, give some more "finalizing" pulses to move further from the margin, end. So in both cases (with prior 0 detection and without) 0->0 should be faster.
 

Offline peter-hTopic starter

  • Super Contributor
  • ***
  • Posts: 6149
  • Country: gb
  • Doing electronics since the 1960s...
Re: FLASH memory write without pre-erase
« Reply #30 on: February 27, 2022, 04:10:51 pm »
0 to 0 should program very fast if the state machine skips such bits, but it is probably byte-wide so it doesn't have the opportunity to do so.

The adjacent line disturbance is a bigger problem. I think I will implement some page write counters, pne per sector, in RAM and when any gets to say 1000, increment a corresponding counter in FLASH.

When that counter gets to 50, an RTOS task can be triggered which refreshes that whole sector. The problem is that the exec time for that is 2 seconds! So it will need to be spread out. It's a crappy solution really... but at least the risk is zero until 50k writes in any sector is reached, which will probably never happen in most applications, which is probably how these devices manage to be used successfully :)
« Last Edit: February 27, 2022, 06:18:00 pm by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->