FR_NO_FILESYSTEM error on FAFTS working SD card FAT32 with MCI interface on LPC1788

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FR_NO_FILESYSTEM error on FAFTS working SD card FAT32 with MCI interface on LPC1788

10,739 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sipel_tp on Thu Aug 22 08:54:00 MST 2013

Hello everybody,

I've tried to inicialize a SD card using the elm-chan.org FATFS library with a LPC1788 and the MCI interface.

I manage to recognize the card but I can't make the library work.

I've tried to inicialize a SD card like I show you right here but f_open keeps me throwing FR_NO_FILESYSTEM:

---------------------------------------------------------------------------------------
en_Mci_CardType cardType;
uint32_t i,j;
BYTE buffer[64];
FRESULT result;
static FATFS fs;      
FIL objectFIL;

memset(buffer, 0, 64);

disk_initialize(0);

result = f_mount(0, &fs);

cardType = MCI_GetCardType();

result = f_open(&objectFIL, "0:SDCARD/archive1.txt", FA_OPEN_EXISTING |FA_READ);
-----------------------------------------------------------------------------------------

Here is the part of the code inside f_open where it makes that:


----------------------------------------------------------------------------------------
fmt = check_fs(fs, bsect = 0);/* Check sector 0 as an SFD format */
if (fmt == 1) {/* Not an FAT boot record, it may be patitioned */
/* Check a partition listed in top of the partition table */
tbl = &fs->win[MBR_Table + LD2PT(vol) * 16];/* Partition table */
if (tbl[4]) {/* Is the partition existing? */
bsect = LD_DWORD(&tbl[8]);/* Partition offset in LBA */
[color=#f00]fmt = check_fs(fs, bsect);/* Check the partition */[/color]
}
}
if (fmt == 3) return FR_DISK_ERR;
[color=#00c]if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs))/* No valid FAT patition is found */
return FR_NO_FILESYSTEM;[/color]
----------------------------------------------------------------------------------------------------------------------------

The line in red returns me fmt=2 so later in the blue line it finds that the partition is not valid.

checl_fs is in here:


--------------------------------------------------------------------------------------------------------------------
static
BYTE check_fs (/* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
FATFS *fs,/* File system object */
DWORD sect/* Sector# (lba) to check if it is an FAT boot record or not */
)
{
if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK)/* Load boot record */
return 3;
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)/* Check record signature (always placed at offset 510 even if the sector size is >512) */
return 2;

if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146)/* Check "FAT" string */
return 0;
if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
return 0;

return 1;
}
--------------------------------------------------------------------------------------------------------------------------------------------------


I would extremely apreciate any kind of help,

Thank you very much !

Labels (1)
0 Kudos
Reply
7 Replies

6,615 Views
lonlypan
Contributor I

I'm having this issue too.My solution is:

formatted my sdcard ,File system set as FAT32,Allocation unit size set as default,and it is well。

f_mount error.png

0 Kudos
Reply

6,615 Views
mspenard603
Contributor IV

I'm having this issue too. What was the solution?!

0 Kudos
Reply

6,615 Views
puddletowntom
Contributor III

Hi,

Was this problem resolved? I am facing the same issue.

0 Kudos
Reply

6,615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Tue Mar 10 10:46:14 MST 2015
To all of you.

Can your windoze or linucks boxes read the card (via a card reader adapter)?

Maybe the card really is not formatted properly.

Apart from that, I know sod all about SD cards.

Mike
0 Kudos
Reply

6,615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by siangming on Mon Mar 09 23:03:28 MST 2015
Hi all,

i am also using this FATFs library on my LPC11u37H via the SPI interface.

the disk_initialize() function is ok also... able to detect SD card ver 2.. Communicating with the sdcard also seems ok, with the commands (reset, read etc) all going to the card and the card responding correctly (R1 responses and able to read data from card..)..

When i try to f_mount and f_open the card, i get a FR_NO_FILESYSTEM return.. and it is exactly the same problem with threadstart above where:

........................
Here is the part of the code inside f_open where it makes that:

----------------------------------------------------------------------------------------
fmt = check_fs(fs, bsect = 0);/* Check sector 0 as an SFD format */
if (fmt == 1) {/* Not an FAT boot record, it may be patitioned */
/* Check a partition listed in top of the partition table */
tbl = &fs->win[MBR_Table + LD2PT(vol) * 16];/* Partition table */
if (tbl[4]) {/* Is the partition existing? */
bsect = LD_DWORD(&tbl[8]);/* Partition offset in LBA */
[color=#f03]fmt = check_fs(fs, bsect);/* Check the partition */[/color]
}
}
if (fmt == 3) return FR_DISK_ERR;
[color=#03f]if (fmt || LD_WORD(fs->win+BPB_BytsPerSec) != SS(fs))/* No valid FAT patition is found */
return FR_NO_FILESYSTEM;[/color]
----------------------------------------------------------------------------------------------------------------------------

The line in red returns me fmt=2 so later in the blue line it finds that the partition is not valid.

checl_fs is in here:

--------------------------------------------------------------------------------------------------------------------
static
BYTE check_fs (/* 0:The FAT boot record, 1:Valid boot record but not an FAT, 2:Not a boot record, 3:Error */
FATFS *fs,/* File system object */
DWORD sect/* Sector# (lba) to check if it is an FAT boot record or not */
)
{
if (disk_read(fs->drive, fs->win, sect, 1) != RES_OK)/* Load boot record */
return 3;
if (LD_WORD(&fs->win[BS_55AA]) != 0xAA55)/* Check record signature (always placed at offset 510 even if the sector size is >512) */
return 2;


if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146)/* Check "FAT" string */
return 0;
if ((LD_DWORD(&fs->win[BS_FilSysType32]) & 0xFFFFFF) == 0x544146)
return 0;

return 1;
}
--------------------------------------------------------------------------------------------------------------------------------------------------

.......................
the return of 2 is the result of above BOLD statement where the record signature (0xAA55) is not found...

i formatted my sdcard but i got the same result...

Anyone can help? i do not have a second card to try out...

thank you.
0 Kudos
Reply

6,615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nigude on Sun Aug 31 12:12:31 MST 2014
I am facing exactly same issue while working on LPC2478. Any help ? The Disk initialize function works well.
0 Kudos
Reply

6,615 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by f_roozdar on Fri Jan 24 10:52:52 MST 2014
Hi
What is the output of disk_initialize() function?
0 Kudos
Reply