This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

byte vs. page write (serial flash vs. FRAM)

Other Parts Discussed in Thread: MSP430G2955

Hello,

i have an old project that used an external FRAM to log data from MSP430 to flash. FRAM is great as it allows byte writes. unfortunately the price is very high.

i would like to replace the external FRAM chip with a more common and cheaper serial flash, for example Winbond W25Q80BW. The physical connection is pin compatible, so thats an easy change.

However, what i am wondering about is how community members usually deal with the fact that such serial flash can only write a full page, rather than a single byte.

Is there a common library for MSP430 that abstracts the page access to the user so one can still write bytes individually?

  • pixbroker said:
    However, what i am wondering about is how community members usually deal with the fact that such serial flash can only write a full page, rather than a single byte.

    incorrect, read the datasheet again, for example page 6 of micron M25P40 specifications says:

    Functional Description

    The M25P40 is an 4Mb (512Kb x 8) serial Flash memory device with advanced writeprotection

    mechanisms accessed by a high-speed SPI-compatible bus. The device supports

    high-performance commands for clock frequency up to 75MHz.

    The memory can be programmed 1 to 256 bytes at a time using the PAGE PROGRAM

    command. It is organized as 8 sectors, each containing 256 pages. Each page is 256

    bytes wide.

    The entire memory can be erased using the BULK ERASE command, or it can be erased

    one sector at a time using the SECTOR ERASE command.

  • pixbroker said:

    i have an old project that used an external FRAM to log data from MSP430 to flash. FRAM is great as it allows byte writes. unfortunately the price is very high.

    i would like to replace the external FRAM chip with a more common and cheaper serial flash, for example Winbond W25Q80BW. The physical connection is pin compatible, so thats an easy change.

    Well, it is clear that you don't want to change old design (don't know what MSP430 is used), but with switching to new low cost devices (for example MSP430G2955 with 56 KB flash memory) it will be able to log data on MSP430 internal flash (writing bytes individually) without using any external memory.

  • The design is using CC430 and that cannot be changed, so external flash is required due to the amount of logging required.

  • While flash indeed can only be erase a whole page at once, it can still do individual writes. It works as long as for the new value y and the old value x the expression x&y = y is true.
    Some external flash memory chips have a smart controller that first checks if an individual write is possible, and If not, reads the page into an internal buffer, applies the change, does the erase and writes the page back.
    However, cheap chips only do complete page writes, so you’ll have to read the whole page, make the change, and then writ the whole page back. It depends on the flash you’re using.

  • Jens, do you have an example of such "smart" flash?

  • We use "smart" 24AA1025 from Microchip. Though it is EEPROM, not Flash... Any of M25PExx serial flash devices from Numonyx - Micron are "smart".

    There is a very good explanation of external behaviour of smart serial flash chips and how you can use them to replace EEPROMs (which are inherently smart) at Micron web site. Go to micron.com/products/support/technical-notes and search for an-2081.

  • I use M25P40 or similar, mainly because they have a lower current consumption than others I could find. Your selection depends on your needs and requirements, like: capacity, current consumption, price, size, ...

    Jan

  • Jan,

    The M25Pxx and M25PExx  devices are different in a sense that only PE can be considered as "smart" ones as Jens-Michael defined this term above.

    With M25Pxx if you want to change a byte, you'll have to read the whole sector back to the RAM, change the byte, erase the sector in flash and write amended sector from RAM to the flash.

    With M25PExx, you just write the byte (or several bytes), the flash itself will handle read-back buffering and erasing inside if needed.

  • Serge,

    Thanks for that explanation, I didn't know about it. Things are changing all the time and can be difficult to follow.

    The positive is that they are changing for better (I hope)

    Jan

  • Jan,

    So do I... I hope one day FRAMs become large in capacity and as cheap as today's Flash, so we'll be able to replace them and forget about many, many problems...

  • Hello,

    The Macronix MX25U8035E 1.8V, 8Mb serial flash device supports byte writes (from 1 to 256).
    Here is a link to the data sheet:

    http://www.macronix.com/Lists/DataSheet/Attachments/1618/MX25U8035E,%201.8V,%208Mb,%20v1.4.pdf

    If you cannot find a suitable MSP430 library routine to support byte writes to external serial flash, here is a link to example C code that might  help you build a driver for the MX25U8035E:

    http://www.macronix.com/Lists/TechDoc/Attachments/3581/MX25U8035E,%20LLD,%20v0.6.zip

    If you are updating your flash data very frequently, you might consider using wear leveling techniques
    to reduce the chance of wearing out a frequently used area of memory.  Here is a link to an application note that discusses wear leveling:

    http://www.macronix.com/Lists/ApplicationNote/Attachments/666/AN033_Ap%20Note%20for%20Wear%20Leveling.pdf

    I hope this helps.

     

     

     

  • Rick,

    Unfortunately the MX25Uxx devices can not be considered as “smart” either. Yes, they support byte writes as well as page writes. So do M25Pxx. But again, when you want to write a byte to it, it erases the whole 4K block. It does not create a local copy of it inside. Instead, the developer has to take care of it if he wants to preserve the rest of data contained in this 4K block. By reading the whole 4K to the RAM, amending the byte which needs to be changed, and then writing the whole 4K back to the flash.

    In regards of wear leveling you are absolutely right. It has to be taken very serious consideration. The document that you mentioned is a good starting point.

  • Hey guys,

    Does anyone have example code for external flash (M25Pxx) ? Help will be much appreciated.

    Thanks 

    Bharat 

**Attention** This is a public forum