0
\$\begingroup\$

This question is an exact duplicate of:

I have a blackfin 533 and I connect it with external flash memory.

I have a software driver that erases a block, fills data, write to flash memory.

I'm using the following chip ST M29W800D.

How would I test and verify the flash that's working ?

Should I earse it, fill it with data and read it ? but how would I erase it, and I'm running the software that is checking the correctness of the flash eeprom ?

\$\endgroup\$

marked as duplicate by Chris Stratton, Daniel Grillo, Dave Tweed Oct 11 '16 at 22:41

This question was marked as an exact duplicate of an existing question.

  • \$\begingroup\$ Repeatedly posting the same question is not permitted, especially when the question itself is too broad for the mission of this site. \$\endgroup\$ – Chris Stratton Oct 11 '16 at 14:41
0
\$\begingroup\$

We are again on the same question as in your previous question - what are you going to test? That flash is there? If it was soldered onto the board, then flash has to be there physically. If it is operational or not? You will not know if it is operational or not without knowing something which should be in specific places of flash, or have checksum as @st2000 proposed.

You have answered your question by saying

I have a software driver that erases a block, fills data, write to flash memory.

Do it, then read data you filled with to compare with original. For that you need some distinguishable data to write, first which comes to mind you should not write FFs if you have data line pullups and 00s if you have data line pulldowns.

But in general flash is usually needed to hold some information. When application updates the flash chip, it must check that update is done properly by comparing sector written with content being read after programming.

If you need algorithm how to perform erase/program/read, you should refer to datasheet of the chip or application note for it.

Hope it helps.

I suspect that question you ask may not describe your main problem; you try to gather some side data to solve issue yourself.

ADD #1: (I removed comment, putting addition here)

my problem is, how would I erase block, fills the data, and I'm running the software on the flash itself.

Ah, this is for sure different problem. If you run code which is located in flash chip, then:

  • you must ensure that you do not erase/rewrite sector with code you are running. This is first thing.
  • then check datasheet if, during erase/write cycles, flash chip is readable for external device for the page which was not erased; it may happen that during erase/write cycles chip will be only outputting state of the erase/write operation, then processor will not be able to get proper instruction to run and malfunction;
  • if you need to erase everything, you will need to copy code you execute to some other physical location - e.g. in SRAM, and run it from there. After you update flash chip device will anyway need a hard reset to ensure new code within flash chip is in effect.

There're several issues with approach reading data from flash which is being erased and programmed. I would simply copy code somewhere else and run it from there - this way you will be 100% safe from malfunction of flash during erase and programming.

ADD #2

sorry I didn't understand, how would I copy the flash software into SRAM ? should I read the whole data and save it in a buffer for example ? but what should I do with this data ? how to verify it is correct ? so the steps is to read the whole flash and save it in a buffer, then what to do else

This is software technique, which must be allowed at hardware level. Processor must be able to "see" flash and SRAM in its addressing space. Flash chip programming code must be relocatable to SRAM addressing space, and after you copy this code to SRAM from flash, you just jump to it, and execution continues in SRAM.

Contents you are going to write to flash of course should not be located in flash because you are going to erase it. Thus SRAM (or some other source emulating RAM) needs to be used as source for data you are going to write to flash (as well as for instruction fetch for executing during flashing).

Some processors/MCUs may have small flash inside them, if this one is having such, you can put you flash chip flashing code in there.

The task actually is not an easy one, and results of implementation will much depend on architecture of your device.

I took a brief look into application note, it says

During the Program/Erase mode of the M29F800 a read cycle will output the Status Register of the P/E.C. The Status Register contains valuable information about the program or erase operation which is happening or has finished.

If it means that during program/erase cycles it can not give instruction code to CPU to run from flash, then you can not flash the chip executing flashing code from it.

am using blackfin 533

Looking to datasheet I see

Up to 148K bytes of on-chip memory

Thus there's a place to put flashing code inside the processor. Maybe you can use scratchpad RAM, or data bank SRAMs (I am not sure, not so much familiar with this chip)

External memory controller with glueless support for SDRAM, SRAM, flash, and ROM

And you can also connect external SRAM, SDRAM :)

\$\endgroup\$
  • \$\begingroup\$ my problem is, how would I erase block, fills the data, and I'm running the software on the flash itself. \$\endgroup\$ – andre Oct 11 '16 at 10:05
  • \$\begingroup\$ so I should to write some data to some sectors that are not used by the code, then read these data again ? \$\endgroup\$ – andre Oct 11 '16 at 10:13
  • \$\begingroup\$ I corrected a little, and put it into the main body of answer. \$\endgroup\$ – Anonymous Oct 11 '16 at 10:19
  • \$\begingroup\$ sorry I didn't understand, how would I copy the flash software into SRAM ? should I read the whole data and save it in a buffer for example ? but what should I do with this data ? how to verify it is correct ? so the steps is to read the whole flash and save it in a buffer, then what to do else \$\endgroup\$ – andre Oct 11 '16 at 10:21
  • \$\begingroup\$ check this support.technologicalarts.ca/docs/LegacyProducts/68HC12/… \$\endgroup\$ – andre Oct 11 '16 at 10:27

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