Content originally posted in LPCWare by Tsuneo on Mon Sep 17 06:36:26 MST 2012
Quote:
Oh Yes, my flash is 2MB. It has 64KB sector size and so I prefer to have 64KB per cluster: 512*128 sector.
Are you making the mass storage on a 2M bytes FLASH of 64K bytes page?
The FLASH page size isn't good for a writable disk. Select smaller page size, 512, 1024, 2048 or 4096.
The FAT management regions, BPB, FAT and root directory, are assigned in the unit of sector. The sector size is limited to 512, 1024, 2048 or 4096. On a writable disk, FAT and root directory regions are often rewritten. If the FLASH page size is greater than these sector size, you have to repeat this process to rewrite the target region, which is a part of the page.
1) copy the target FLASH page into RAM
2) modify target region on the copied page
3) erase the FLASH page
4) write back the copy into the FLASH page
Tsuneo