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
afinko
Associate II
Posted on May 17, 2011 at 13:49

> 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

I tried to remove SD card to from the CORTEX board and put in the PC through SD card reader. I wrote some files on SD, and CORRETLY unmount the SD card by ''Safely Remove Hardware'' in Windows.

Then I put the SD card to the CORTEX board, mount it with FatFs file system. I was able to read the files. Then I wrote some files with FatFs, unmount CORRECTLY the SD card with FatFs (according to the FatFs documentation).

Then I removed the SD card from CORTEX board, connect to the PC through SD card readers, but the files that I wrote with CORTEX wasn't there.

Do you really think that the problem is in unmounting the device?

Afi

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

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

Good news, I have done it.

We are missing something (still don't know what), but in your project, if you call your NAND_FAT function after Power off()  in MassStorageStart function instead of Demo_Init function , it will probably work.

There is something that MassStorage inits that is necessary to Write in the NANDFLASH

Regards.

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

> Good news, I have done it.

> We are missing something (still don't know what), but in your project, if you call your NAND_FAT function after Power off()  in MassStorageStart function instead of Demo_Init function , it will probably work.

> There is something that MassStorage inits that is necessary to Write in the NANDFLASH

Hi Juan,

YES, It works in this case, You are the one 😉

Thanks.

I am going to find out what from Mass_Storage_Start is required in order to be able to write to the NAND.

Afi

dsolier
Associate
Posted on May 17, 2011 at 13:49

> Good news, I have done it.

> We are missing something (still don't know what), but in your project, if you call your NAND_FAT function after Power off()  in MassStorageStart function instead of Demo_Init function , it will probably work.

> There is something that MassStorage inits that is necessary to Write in the NANDFLASH

Hi Afinko and Juan,

YES, it works, but only if you plug USB cable. I did the same, but without the usb cable, and d

I am finding out what from Mass_Storage_Start is required in order to be able to write to the NAND, and I think the problem is on the format of the file system.

I'm using windows, and it format on FAT 32, but when I format with FatFS using f_mkfs, the format is on FAT16.

Have you found what it's necessary to write in the Nand Flash correctly?

Thanks

David

dsolier
Associate
Posted on May 17, 2011 at 13:49

Sorry, I forgot to write all the post.

>YES, it works, but only if you plug USB cable. I did the same, but without the usb cable, and doesn't work.
afinko
Associate II
Posted on May 17, 2011 at 13:49

> I am finding out what from Mass_Storage_Start is required in order to be able to write to the NAND, and I think the problem is on the format of the file system.

> I'm using windows, and it format on FAT 32, but when I format with FatFS using f_mkfs, the format is on FAT16.

> Have you found what it's necessary to write in the Nand Flash correctly?

I spent several ours with this, unfortunately I didn't found what we are missing.

It seems unstable even when the NAND_FAT function is called after Power off()  in MassStorageStart function.

I do not have more time for resolving this issue. I do not need the NAND anymore.

But I am very angry, that none from ST, who wrote the MASS_STORAGE functions, wont help us with this issue. I am pretty sure, that we are missing some stupid triviality.

Afi