3
\$\begingroup\$

I am checking PCB board of a commercial device that has W25Q256JV 32MByte SPI Flash on it. The device is in use for more than a year now at more than 2000 client locations. It has internal backup battery that is put on charging at night and then at day time the device is used without the mains charger.

General Description

The Flash is being written and read continuously all the time for more than 1 year now. It's write cycles are surely reaching to its limits now.

Now faulty devices have started to come for repair from the client and mostly flash is the culprit in these devices. Once it is replaced with a new chip then the device again becomes functional.

It is observed that the event of faulty flash occurs at the instant when the connector of its power adapter is removed from the device.

How can the flash getting corrupt avoided at the instant when its power jack is removed?

How can we detect in the firmware that the flash has become corrupt and consequently display this message on device screen.. so that no guess work is done to re-live the device?

\$\endgroup\$

closed as too broad by Elliot Alderson, Chris Stratton, RoyC, Oleg Mazurov, Rev1.0 Aug 20 at 14:24

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ I'd guess that the flash fault is being detected when the power is removed because that's when the firmware in the device is trying to write to the flash and seeing an error. If you want to know before the power is removed whether ot not the flash is ok, then you have to have the firmware periodically do a check of the flash while the power is still present. However, checking the flash by writing to it will probably hasten the demise of the flash even faster ... \$\endgroup\$ – brhans Aug 6 at 13:38
  • 5
    \$\begingroup\$ The only proper solution is: don't write to flash so often, or use a different memory type. \$\endgroup\$ – Lundin Aug 6 at 13:44
  • 3
    \$\begingroup\$ Yikes. Are these devices doomed to be sent in for repair each year? \$\endgroup\$ – DKNguyen Aug 6 at 13:51
  • 1
    \$\begingroup\$ Well the question is does the flash become corrupt due to some sort of interrupted operation or condition when power source changes or is it reaching its write limit. If the first you would expect problems from day one. Showing a message is good, but the only lasting a bit over a year seems like the real issue. Changes to firmware and larger capacity flash would be a good start. \$\endgroup\$ – hekete Aug 6 at 14:24
  • 1
    \$\begingroup\$ If they always have power, consider SRAM or if not, FRAM... \$\endgroup\$ – rdtsc Aug 6 at 14:44
4
\$\begingroup\$

Are you sure the flash does not get corrupted because the number of maximum writes?

To prevent this, you can keep count of the number of writes; if it reaches a maximum (or better, way before that time), show a warning/notification.

I assume you don't write to the same address(es) every time but using an algorithm to write evenly over the flash memory?

\$\endgroup\$
2
\$\begingroup\$

To detect/create a corrupt flash memory we had to employ below theme at work recently

  1. Write several times, infact 100s of thousands of time
  2. Read back to make sure that the previous write was error free
  3. Store the write counter in another location or in an EEPROM.
  4. Once a flash sector fails, it might be okay again for some more times
  5. The stored results will be(mostly) okay for some time but if we read the content after some days some bytes would turn into junk values. The retain capacity also severely goes down once we cross the endurance write cycles

So detecting the failure is by Code review and use case study (theoretical) and keeping an eye on the number of writes already has happened with the help of a counter mechanism. Other two things we follow is to only write when needed (until battery is low or just before shutdown) and using more space in flash for distribution of write load over a period of time.

One hint about flash corruption

The flash access should be done always when the supply for flash memory is in the safe voltage operation region.. else any writes might some time corrupt the flash registers and the memory may become bricked too

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.