cancel
Showing results for 
Search instead for 
Did you mean: 

FAT file system on NAND flash

afinko
Associate II
Posted on April 28, 2010 at 22:10

FAT file system on NAND flash

16 REPLIES 16
jdolera
Associate II
Posted on May 17, 2011 at 13:49

Hi Afinko. Did you resolve your problem?

rodolphe
Associate II
Posted on May 17, 2011 at 13:49

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.

afinko
Associate II
Posted on May 17, 2011 at 13:49

NO, I did not :(

jdolera
Associate II
Posted on May 17, 2011 at 13:49

I am using STM3210E-EVAL . Nand memory is NAND512W3A2CN6 from ST.

Regards.

 

rodolphe
Associate II
Posted on May 17, 2011 at 13:49

0690X00000602hkQAA.jpg

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.

tsuneo
Senior
Posted on May 17, 2011 at 13:49

> 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

afinko
Associate II
Posted on May 17, 2011 at 13:49

> 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.

afinko
Associate II
Posted on May 17, 2011 at 13:49

> 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.

tsuneo
Senior
Posted on May 17, 2011 at 13:49

> 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