@CHIP-RTOS - Flash write/erase cycles
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.
To decrease the flash write accesses in your program, you should follow the hints below:
2. Use setvbuf with a size of 1024 bytes.
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.
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
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.