2010-04-28 01:10 PM
FAT file system on NAND flash
2011-05-17 04:49 AM
Hi Afinko. Did you resolve your problem?
2011-05-17 04:49 AM
Hello,
what is the NAND Flash model or family ? Row and line addressing in Nand Flash are not always compatible between the ST Nand and the Atmel Nand.2011-05-17 04:49 AM
NO, I did not :(
2011-05-17 04:49 AM
2011-05-17 04:49 AM
hello, you must check that the address insertion in the read_block/write_block functions of your Nand Flash software driver comply with the address insertion format in the table above. regards.
2011-05-17 04:49 AM
> If I am writing to the NAND by FatFS, no error occur, everything looks OK, but then in Mass Storage mode I can not find the file that was created by FatFS.
It's natural. OS (Windows, Linux, MacOSX, etc) doesn't suppose that local storage is modified without OS intervention. If such an accident would occur, OS takes it as fault of the storage. Unmount the media from the OS, before modifying it. And then, mount it again. Tsuneo
2011-05-17 04:49 AM
> It's natural.
> OS (Windows, Linux, MacOSX, etc) doesn't suppose that local storage is modified without OS intervention. If such an accident would occur, OS takes it as fault of the storage. >Unmount the media from the OS, before modifying it. And then, mount it again. Of course, I firstly unmonted the NAND from OS, then I mounted it in FatFs, created any file, unmounted from FatFs and mount to the OS. I can not see the created file even withouth unmonting (or with), when I want to read the file with FatFs.2011-05-17 04:49 AM
> you must check that the address insertion in the read_block/write_block functions of your Nand Flash software driver comply with the address insertion format in the table above.
The same read_block/write_block functions are used by Mass_Storage Mode, when it is used with Computer. And the Mass_Storage mode can write to the NAND.2011-05-17 04:49 AM
> Of course, I firstly unmonted the NAND from OS
> If I use writing in FatFS several times, the another files on NAND start to be corrupted and at the end the whole FAT will fail
It suggests that OS doesn't recognize unmount of the drive.
How did you unmount the media from OS?
To do it on the device side,
Set RMB (removable) bit on the INQUIRY response.
To notify media unmount to OS, the MSC device fails SCSI command from OS, except for INQUIRY. Usually OS puts TEST UNIT READY repeatedly. Fail on this command.
OS may put many other SCSI commands while in unmount. Of course, device fails on these commands, too, while in unmount.
- READ FORMAT CAPACITY
- READ CAPACITY(10)
- READ(10)
- MODE SENSE(6)
- PREVENT ALLOW MEDIUM REMOVAL
etc.
After the device fails in above commands, OS may put REQUEST SENSE. Return ''NOT READY - MEDIUM NOT PRESENT'' response, successfully.
The point is that you have to wait for SCSI command (usually TEST UNIT READY) to fail, so that OS should know unmount certainly.
There is another way which uses soft detach/attach of the device. But I don't recommend it, because Windows often fails on re-mount.
Tsuneo