The size of my file is less than 512 bytes.
Flashdisk size is 1GB. All the flashdisk is used to store just one file (file size is less than 512 bytes)
Flash can be erased in 512Byte blocks.
Each Flash block can be erased 10K times.
Windows is managing corrupted blocks.
Size of Flashdisk 1GB: 1.000.000 Kilobytes
Amount of 512Byte Blocks in Flashdisk: 2.000.000 Blocks
Each Block can be erased 10.000 Times: 20.000.000.000 Erase cycles
So in this Theory the file could be written 2,0e+10 times.
What do you think about this theory?
There are a number of factors which reduce your estimated erase cycle count:
The smallest writeable unit is a page (2 kB)
Only unallocated space is used for wear leveling. Let’s assume the OS image, reserved management area and your application occupy 200MB, there’s only 800MB left for your file.
Writing a file also requires to update the TFAT table (3 pages)
There are lower-layer mapping tables which are required for wear leveling (10 pages)
Steps 2 and 3 are cached, they are updated not more than once or twice a second. But you see, for rare writes, there’s a massive overhead required.
Please be aware that my statements are rough estimations, not precisely evaluated data.
To recalculate your use case:
Total space: 800MB / 2kB = 400.000 pages
14 pages per file write => 400.000/14 = 29.000 file writes to fill the flash once
10k erase cycles => 10.000 x 29.000 file writes = 290e6 file writes total