CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

m25p40 question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

m25p40 question
PostPosted: Wed Apr 11, 2007 2:22 am     Reply with quote

Hello,

In my project I currently use a m25p40 flash chip for data end settings storage. I've written code to use this chip and I have it working. My problem is that the chip cannot write bits from 0 to 1. This causes the need for a page erase when I write to the flash (in most cases). Since pages are 64 KB and I need to backup the other (non written) bytes of the page to a recovery page. So I need 4 cycli, a backup cycle, a erase cycle, a recover cycle and a erase recover area cycle. This currently takes about 30 secs. when I have a power failure during these 30 secs I might end up with a corrupted memory.
All these things add up to my problem.
I need to have a reliable system but I am very concerned by the 'features' of this memory chip.

My question is: have others used memory and avoided the problem I mention above? May there be better memory chips to use?

I must add that, in the near future, I want to upgrade to an 1MB part, but that cost must be kept as low as possible and SPI is preffered. The M25P80 is therefore selected as a possible replacement, but is there a better chip?

Thanks in advance, Jos
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Apr 11, 2007 6:51 am     Reply with quote

Are you using the same page again and again for the backup copies? If yes, than be aware that flash memory has a maximum number of program/erase cycles that can be performed after which defects can occur. For the M25P40 device Grade 3 this is 10.000 and for Grade 6 devices it is 100.000 cycles. Allowing a safety margin you will reach these numbers sooner than expected.

An alternative approach is to use a separate backup page for each data page at the cost of double the memory. Adding a copy sequence number to the page you can then optimize the algorithm to half the time:
- Erase destination page
- Read source page
- Increase sequence number and write destination page
For reading the data you have to check both possible pages, the one with the highest copy number is the most recent version.

As an addition add a CRC-check over the data page. If the write failed for some reason you always can revert to the previous version.

Alternative serial memory chips:
- FRAM chips are great! Fast, unlimited write cycles and you can update each byte individually (no need for byte or page erase). Disadvantages are price and smaller memory capacities so you need more chips. www.ramtron.com
- MMC memory cards, etc. Price per byte is extremely low and getting lower every year (at 128Mb for EUR5 about double the price of an M25P40, but 256 times as large capacity). The huge memory capacity allows for different design approaches (for example: who says you have to fill a memory page completely? Effectively using the first 2 bytes of a page can be afforded). Easy upgrading the performance of your device without design changes.
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Thu Apr 12, 2007 12:42 am     Reply with quote

Thanks for your reply, it is really usefull!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group