On 11/01/2012 11:48 AM, Neil wrote: > On 10/31/2012 5:57 AM, alan.b.pearce@stfc.ac.uk wrote: >> This must come down to how much RAM you have available and how often >> you are writing a line of data. If writing a line every minute (say) >> to log temperate and pressure, then writing to the card on every line >> would be OK, as the card will then deal with a sectors worth of data >> write to the Flash, and it won't take a minute to do that, so it will >> be ready in time for the next line write. But if the speed of your >> writing means that you are writing a line fast enough that the next >> line write attempt will occur before the card has a chance to write a >> sectors worth to Flash, then buffering would be a better idea - until >> you are wanting to write a sectors worth faster than the card can >> handle ... > I'm writing approx 60 bytes of data per "transaction" (one transaction > per line), and approx 20 transactions per second. That's 1kB/s, far > within the card's spec. I've not yet found a way to tell if the card > has completed a transaction, before sending the next. If/when I do, I > can run tests to verify it's written and buffer if not. Is there any > reason to suspect that the card may not immediately write a transaction, > and I would have to verify each operation is complete? I'm using SPI > mode btw. > > I'm going off the info / docs / examples provided with the development > tools, so I suspect I should find the SD-card SPI spec. > > That's a high write rate. Is power rock solid, or does your solution=20 allow you to detect power loss early enough to complete writes before=20 power is gone? We had/have a serious problem with SD cards in systems with unreliable=20 power. We'd end up with corrupted cards pretty quickly... and we were=20 writing less frequently (maybe 300 bytes twice a second normally). One big problem is the wear levelling. ANY sector on the disk can be=20 lost at any power cycle. There's no amount of write verification you=20 can do to be sure you're safe. With modern filesystems, writes are=20 always going on at the same file structure portion of the disk... so=20 many writes are going to cause a wear level operation and swap with some=20 other random part of the drive. There are SD cards that are supposedly power failure tolerant. We're=20 going to look into those a bit more, but we haven't used any yet. We considered going raw disk and writing incremental data as you would=20 normally do for fault tolerance in FLASH, but it became obvious the SD=20 cards erase the sector first even if they technically don't have to. We ended up caching one day's data to an internal NAND-flash drive with=20 proper power failure handling, and we quickly dump this data to SD=20 exactly once a day to limit our exposure to the SD card power failure=20 problem. Writing 172,800 times less often should take our MTBF due to=20 this specific problem from 1 month to... well... somewhere in the=20 thousands of years. (Depends on write durations, OS behavior, etc) I=20 still want to find tolerant SD cards to completely get rid of this issue. Darron --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .