www.beck-ipc.com

@CHIP-RTOS - Flash write/erase cycles
Important information about IPC@CHIP® drives and file system
(Limited Number of Flash erase cycles per sector)



The internal Flash sectors of the IPC@CHIP® (used for drive A: and memory for @CHIP-RTOS code) have limited erase cycles. So you should avoid cyclic write access like writing into a log file every hour.

We guarantee 10.000 erase cycles per sector on SC1x and 100.000 erase cycles per sector on SC1x3. Note that one write access in your program (fwrite or write) can cause more than one write/erase access on the @CHIP's flash disk.


Optimizations:

To decrease the flash write accesses in your program, you should follow the hints below:
    1. Use fopen, fwrite, ...
    2. Use setvbuf with a size of 1024 bytes.

Description:

fopen internally works with a 512 byte stream buffer. The file system sectors have a size of 512 bytes. Flash physical sector size on SC1x can be 256 or 1024 bytes, depending on the flash memory used. Setting the stream buffered size to 1024 helps to avoid additional flash writes.
Flash physical sector size on SC1x3 is 64 kbytes. The internal Flash Translation Layer (FTL) on SC1x3 uses wear leveling to makes sure that data writes are evenly distributed over the whole storage media.

Note:
    The fwrite function in Borland C 5.02 has an unexpected behaviour when the size of data exceeds the buffered size (512 bytes default or size set with setvbuf). In this case the data blocks exceeding the buffered size are always written in an unbuffered manner instead of splitting them into smaller packets.
How a flash defect can be detected:

The return code tells you if a write access was not successful. If the failure was due to a flash disk defect there will be an error message
    "Flash error at sector: xx"
in the console text at the next system boot. Also the execution of the AUTOEXEC.BAT will be bypassed in this case.


Workaround:

If you need to generate a periodic log file, you should use the RAM disk to store the file. To save the file when the power goes down, you could use the Powerfail Interrupt (PFI) feature.

Another option is to use an IDE Drive (Hard disk, Compactflash, ..) to store the log file. How to connect an IDE Drive to the IPC@CHIP® is explained in the API documentation.


End of document