Checking in this forum, i've seen this is a very recurrent discussion, but i can't see a good solution or good recovery way.
My problem is I have a device with a 2 MB memory flash, and I'm using it to receive a 800K file through FTP. I've verified my system, including the filesystem and everithing is OK. Now, I'm testing the system against power or conection losts, and it's here where the problems begin: if the transfer is interrupted due to a power lost, when the system reboot, i verify the file and I detect is not a valid file (remember the transfer was interrupted), so I delete it. If I repeat this process 2 or 3 times, I arrive to a moment where the transfer can't be completed because, apparently, the flash memory is full.
I guess than because MFS corruption, when I delete the file, it is not being deleted completely, so there are sectors still marked as occupied.
What can i do??? I've tried my system using 2 FAT tables, or using CACHE, in the 3 different modes (write_back, mixed or through).... using codes like :
param = MFS_WRITE_THROUGH_CACHE; _io_ioctl ( g_MFS_SYSTEM_filesystem_handle, IO_IOCTL_SET_FAT_CACHE_MODE, ¶m ); _io_ioctl ( g_MFS_SYSTEM_filesystem_handle, IO_IOCTL_SET_WRITE_CACHE_MODE, ¶m ); _io_ioctl ( g_MFS_SYSTEM_filesystem_handle, IO_IOCTL_FAT_CACHE_OFF, NULL );
But the problem remains. I've too applied the patch mentioned in this thread (Howto flush MFS? (Use case: mfs onto ramdisk)), but with no results.
Is there a chkdsk function for MQX MFS???? Any other solution to avoid corruption???? :-(
Any help would be very appreciated. Thanks in advance.