DSPRelated.com
Forums

File System Library Problem

Started by B S May 16, 2013
Hi,

I have been trying to use Fat16/32 File System Library by third party given at the following website.

http://ultra-embedded.com/?fat_filelib
I added read and write function from the bsl, enabled GCC extension in CCS v 5.2 and packed one of the structure attributes in fat_filelib.

Project compiles fine but got this error.

[C674X_0] FAT_FS: Error could not load FAT details (-3)!
[C674X_0] ERROR: Media attach failed
I am unable to solve this issue.

I would really appreciate if any one can help.

Thanks.

BAS
Hi,

My guess is the FAT has not been stored on the disk; that's
why the software is unable to read FAT details. The disk
has to be formatted and the file system created and stored
before any other file manipulations.

There must a routine in the library that performs this task,
I am not sure which exactly one.

NB: I might be completely off, please look up further explanations
about error code -3.

Perhaps FAT fields have been stored off place, as you have mentioned
structure packing in your post. You might want to read raw sector
data and look what was written there.

Rgds,

Andrew

> Subject: File System Library Problem
> Posted by: "B S" matlab_fft
> Date: Thu May 16, 2013 9:21 am ((PDT))
>
> Hi,
>
> I have been trying to use Fat16/32 File System Library by third party given
> at the following website.
>
> http://ultra-embedded.com/?fat_filelib
>
> I added read and write function from the bsl, enabled GCC extension in CCS v
> 5.2 and packed one of the structure attributes in fat_filelib.
> Project compiles fine but got this error.
>
> [C674X_0] FAT_FS: Error could not load FAT details (-3)!
> [C674X_0] ERROR: Media attach failed
> I am unable to solve this issue.
>
> I would really appreciate if any one can help.
>
> Thanks.
>
> BAS

_____________________________________
Hi B S,

The FAT file system got a number of sectors located at the beginning
of the disk, allocated to MBR (master boot record), boot sector and FAT
(file allocation table) - you might want to find the formal description
of the bit fields in these sectors somewhere on the net.

I suppose that the FAT standard assume that the MBR and boot sectors
should ends with the 0x55, 0xAA bitmask in the last two bytes of the
sector. I suppose that these records are filled in in the FAT initialization
phase - sometime during the "format" command and corresponding to it
function call.

So you might want to check how is your file system gets initialized.

Rgds,

Andrew

On Thu, 23 May 2013, B S wrote:

> Andrew,
>
> Thanks for your reply.
>
> I am getting error over the line given below which can be found in fat_access.c file.
> // Make Sure 0x55 and 0xAA are at end of sector
> // (this should be the case regardless of the MBR or boot sector)
> if (fs->currentsector.sector[SIGNATURE_POSITION] != 0x55 ||
> fs->currentsector.sector[SIGNATURE_POSITION+1] != 0xAA)
> return FAT_INIT_INVALID_SIGNATURE;
> I couldn't figure out how to make sure that these values are at the of
> sector. Any help would be appreciated.
> Thanks.
>
> ________________________________
> From: Andrew Nesterov > To: c...
> Cc: B S > Sent: Sunday, May 19, 2013 3:08 AM
> Subject: [c6x] Re: File System Library Problem
>
> Hi,
>
> My guess is the FAT has not been stored on the disk; that's
> why the software is unable to read FAT details. The disk
> has to be formatted and the file system created and stored
> before any other file manipulations.
>
> There must a routine in the library that performs this task,
> I am not sure which exactly one.
>
> NB: I might be completely off, please look up further explanations
> about error code -3.
>
> Perhaps FAT fields have been stored off place, as you have mentioned
> structure packing in your post. You might want to read raw sector
> data and look what was written there.
>
> Rgds,
>
> Andrew
>
>> Subject: File System Library Problem
>> Posted by: "B S" matlab_fft
>> Date: Thu May 16, 2013 9:21 am ((PDT))
>>
>> Hi,
>>
>> I have been trying to use Fat16/32 File System Library by third party given
>> at the following website.
>>
>> http://ultra-embedded.com/?fat_filelib
>>
>> I added read and write function from the bsl, enabled GCC extension in CCS v
>> 5.2 and packed one of the structure attributes in fat_filelib.
>> Project compiles fine but got this error.
>>
>> [C674X_0] FAT_FS: Error could not load FAT details (-3)!
>> [C674X_0] ERROR: Media attach failed
>> I am unable to solve this issue.
>>
>> I would really appreciate if any one can help.
>>
>> Thanks.
>>
>> BAS
>>
>

_____________________________________
Andrew,

Thanks for your reply.

I am getting error over the line given below which can be found in fat_access.c file. 
// Make Sure 0x55 and 0xAA are at end of sector
// (this should be the case regardless of the MBR or boot sector)
if (fs->currentsector.sector[SIGNATURE_POSITION] != 0x55 || fs->currentsector.sector[SIGNATURE_POSITION+1] != 0xAA)
return FAT_INIT_INVALID_SIGNATURE;
I couldn't figure out how to make sure that these values are at the of sector. Any help would be appreciated.
Thanks.

________________________________
From: Andrew Nesterov
To: c...
Cc: B S
Sent: Sunday, May 19, 2013 3:08 AM
Subject: [c6x] Re: File System Library Problem

 

Hi,

My guess is the FAT has not been stored on the disk; that's
why the software is unable to read FAT details. The disk
has to be formatted and the file system created and stored
before any other file manipulations.

There must a routine in the library that performs this task,
I am not sure which exactly one.

NB: I might be completely off, please look up further explanations
about error code -3.

Perhaps FAT fields have been stored off place, as you have mentioned
structure packing in your post. You might want to read raw sector
data and look what was written there.

Rgds,

Andrew

> Subject: File System Library Problem
> Posted by: "B S" matlab_fft
> Date: Thu May 16, 2013 9:21 am ((PDT))
>
> Hi,
>
> I have been trying to use Fat16/32 File System Library by third party given
> at the following website.
>
> http://ultra-embedded.com/?fat_filelib
>
> I added read and write function from the bsl, enabled GCC extension in CCS v
> 5.2 and packed one of the structure attributes in fat_filelib.
> Project compiles fine but got this error.
>
> [C674X_0] FAT_FS: Error could not load FAT details (-3)!
> [C674X_0] ERROR: Media attach failed
> I am unable to solve this issue.
>
> I would really appreciate if any one can help.
>
> Thanks.
>
> BAS
B.S.

Per the source in fat_access.c, (you did download the source code?) the file
sector currently being read is not formatted.

If you enabled the fat format functionality
then you can call one of the functions in the fat_format.c source file to format
all the sectors.

If it were me, I would work with the source files until the application works
correctly,
then, after the application works correctly,
I would incorporate the library into the linker and remove the source files from
the compiler steps.
A reading of the fat_access.c then a reading of the fat_format.c was all it took
to determine the sector read from the media was not formatted and how to invoke
the necessary function(s) to perform the format.

R. Williams

---------- Original Message -----------
From: B S
To: Andrew Nesterov , "c..."

Sent: Thu, 23 May 2013 06:37:02 -0700 (PDT)
Subject: Re: [c6x] Re: File System Library Problem

> Andrew,
>
> Thanks for your reply.
>
> I am getting error over the line given below which can be found in
> fat_access.c file. 
>
> // Make Sure 0x55 and 0xAA are at end of sector
> // (this should be the case regardless of the MBR or boot sector)
> if (fs->currentsector.sector[SIGNATURE_POSITION] != 0x55 || fs-
> >currentsector.sector[SIGNATURE_POSITION+1] != 0xAA) return
FAT_INIT_INVALID_SIGNATURE;
>
> I couldn't figure out how to make sure that these values are at the of
> sector. Any help would be appreciated.
>
> Thanks.
>
> ________________________________
> From: Andrew Nesterov
> To: c...
> Cc: B S
> Sent: Sunday, May 19, 2013 3:08 AM
> Subject: [c6x] Re: File System Library Problem
>
>  
>
> Hi,
>
> My guess is the FAT has not been stored on the disk; that's
> why the software is unable to read FAT details. The disk
> has to be formatted and the file system created and stored
> before any other file manipulations.
>
> There must a routine in the library that performs this task,
> I am not sure which exactly one.
>
> NB: I might be completely off, please look up further explanations
> about error code -3.
>
> Perhaps FAT fields have been stored off place, as you have mentioned
> structure packing in your post. You might want to read raw sector
> data and look what was written there.
>
> Rgds,
>
> Andrew
>
> > Subject: File System Library Problem
> > Posted by: "B S" matlab_fft
> > Date: Thu May 16, 2013 9:21 am ((PDT))
> >
> > Hi,
> >
> > I have been trying to use Fat16/32 File System Library by third party given
> > at the following website.
> >
> > http://ultra-embedded.com/?fat_filelib
> >
> > I added read and write function from the bsl, enabled GCC extension in CCS v
> > 5.2 and packed one of the structure attributes in fat_filelib.
> > Project compiles fine but got this error.
> >
> > [C674X_0] FAT_FS: Error could not load FAT details (-3)!
> > [C674X_0] ERROR: Media attach failed
> >
> >
> > I am unable to solve this issue.
> >
> > I would really appreciate if any one can help.
> >
> > Thanks.
> >
> > BAS
> >
> >
------- End of Original Message -------

_____________________________________
Hi,

I worked around this problem now it does verification and every thing seems Ok. But while executing list directory functionfl_listdirectory("/"),it keeps printing the message given below

[C674X_0] No. Filename

[C674X_0] 1 - ?msdos.5.0 [32 bytes] (0xfff8000000)
[C674X_0] 2 - ?msdos.5.0 [32 bytes] (0xfff8000000)
[C674X_0] 3 - ?msdos.5.0 [32 bytes] (0xfff8000000)
.
.
.
[C674X_0] 26005 - ?msdos.5.0 [32 bytes] (0xfff8000000)
[C674X_0] 26006 - ?msdos.5.0 [32 bytes] (0xfff8000000)
[C674X_0] 26007 - ?msdos.5.0 [32 bytes] (0xfff8000000)
[C674X_0] 26008 - ?msdos.5.0 [32 bytes] (0xfff8000000)

I let the processor run for a long time but it just kept printing. Any idea what is that and how to fix it ?

Thanks.

________________________________
From: Richard Williams
To: B S ; Andrew Nesterov ; "c..."
Sent: Sunday, June 2, 2013 4:52 PM
Subject: Re: [c6x] Re: File System Library Problem

B.S.

Per the source in fat_access.c, (you did download the source code?) the file
sector currently being read is not formatted.

If you enabled the fat format functionality
then you can call one of the functions in the fat_format.c source file to format
all the sectors.

If it were me, I would work with the source files until the application works
correctly,
then, after the application works correctly,
I would incorporate the library into the linker and remove the source files from
the compiler steps.
A reading of the fat_access.c then a reading of the fat_format.c was all it took
to determine the sector read from the media was not formatted and how to invoke
the necessary function(s) to perform the format.

R. Williams

---------- Original Message -----------
From: B S
To: Andrew Nesterov , "c..."

Sent: Thu, 23 May 2013 06:37:02 -0700 (PDT)
Subject: Re: [c6x] Re: File System Library Problem

> Andrew,
>
> Thanks for your reply.
>
> I am getting error over the line given below which can be found in
> fat_access.c file.
>
> // Make Sure 0x55 and 0xAA are at end of sector
> // (this should be the case regardless of the MBR or boot sector)
> if (fs->currentsector.sector[SIGNATURE_POSITION] != 0x55 || fs-
> >currentsector.sector[SIGNATURE_POSITION+1] != 0xAA) return
FAT_INIT_INVALID_SIGNATURE;
>
> I couldn't figure out how to make sure that these values are at the of
> sector. Any help would be appreciated.
>
> Thanks.
>
> ________________________________
> From: Andrew Nesterov
> To: c...
> Cc: B S
> Sent: Sunday, May 19, 2013 3:08 AM
> Subject: [c6x] Re: File System Library Problem
>
>
>
> Hi,
>
> My guess is the FAT has not been stored on the disk; that's
> why the software is unable to read FAT details. The disk
> has to be formatted and the file system created and stored
> before any other file manipulations.
>
> There must a routine in the library that performs this task,
> I am not sure which exactly one.
>
> NB: I might be completely off, please look up further explanations
> about error code -3.
>
> Perhaps FAT fields have been stored off place, as you have mentioned
> structure packing in your post. You might want to read raw sector
> data and look what was written there.
>
> Rgds,
>
> Andrew
>
> > Subject: File System Library Problem
> > Posted by: "B S" matlab_fft
> > Date: Thu May 16, 2013 9:21 am ((PDT))
> >
> > Hi,
> >
> > I have been trying to use Fat16/32 File System Library by third party given
> > at the following website.
> >
> > http://ultra-embedded.com/?fat_filelib
> >
> > I added read and write function from the bsl, enabled GCC extension in CCS v
> > 5.2 and packed one of the structure attributes in fat_filelib.
> > Project compiles fine but got this error.
> >
> > [C674X_0] FAT_FS: Error could not load FAT details (-3)!
> > [C674X_0] ERROR: Media attach failed
> >
> >
> > I am unable to solve this issue.
> >
> > I would really appreciate if any one can help.
> >
> > Thanks.
> >
> > BAS
> >
> >
------- End of Original Message -------
B.S.

Offhand, I think you are wanting us to fix all your coding problems, so you
don't have to do any analysis.

My first suggestion....
perform an analysis of the source code (again: you did download the source code
didn't you?)

The analysis of the source code is exactly what we would be doing to determine
the cause of the message.

What did you do to 'work around' the problem you were having with the FAT 16
partition not being initialized/formatted?

R. Williams

---------- Original Message -----------
From: B S
To: Richard Williams , Andrew Nesterov
, "c..."
Sent: Thu, 6 Jun 2013 05:20:24 -0700 (PDT)
Subject: Re: [c6x] Re: File System Library Problem

> Hi,
>
> I worked around this problem now it does verification and every thing
> seems Ok. But while executing list directory
> function fl_listdirectory("/"), it keeps printing the message given below 
>
> [C674X_0] No.             Filename
>
> [C674X_0] 1 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 2 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 3 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
> .
> .
> .
> [C674X_0] 26005 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 26006 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 26007 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 26008 - ë<?msdos.5.0 [32 bytes] (0xfff8000000)
>
> I let the processor run for a long time but it just kept printing. Any
> idea what is that and how to fix it ?
>
> Thanks.
>
> ________________________________
> From: Richard Williams
> To: B S ; Andrew Nesterov
> ; "c..."
> Sent: Sunday, June 2, 2013 4:52 PM Subject: Re:
> [c6x] Re: File System Library Problem
>
> B.S.
>
> Per the source in fat_access.c, (you did download the source code?)
> the file sector currently being read is not formatted.
>
> If you enabled the fat format functionality
> then you can call one of the functions in the fat_format.c source file
> to format all the sectors.
>
> If it were me, I would work with the source files until the
> application works correctly, then, after the application works
> correctly, I would incorporate the library into the linker and remove
> the source files from the compiler steps.
>
> A reading of the fat_access.c then a reading of the fat_format.c was
> all it took to determine the sector read from the media was not
> formatted and how to invoke the necessary function(s) to perform the format.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: Andrew Nesterov , "c..."
>
> Sent: Thu, 23 May 2013 06:37:02 -0700 (PDT)
> Subject: Re: [c6x] Re: File System Library Problem
>
> > Andrew,
> >
> > Thanks for your reply.
> >
> > I am getting error over the line given below which can be found in
> > fat_access.c file. 
> >
> > // Make Sure 0x55 and 0xAA are at end of sector
> > // (this should be the case regardless of the MBR or boot sector)
> > if (fs->currentsector.sector[SIGNATURE_POSITION] != 0x55 || fs-
> > >currentsector.sector[SIGNATURE_POSITION+1] != 0xAA) return
> FAT_INIT_INVALID_SIGNATURE;
> >
> > I couldn't figure out how to make sure that these values are at the of
> > sector. Any help would be appreciated.
> >
> > Thanks.
> >
> > ________________________________
> >  From: Andrew Nesterov
> > To: c...
> > Cc: B S
> > Sent: Sunday, May 19, 2013 3:08 AM
> > Subject: [c6x] Re: File System Library Problem
> >
> >  
> >
> > Hi,
> >
> > My guess is the FAT has not been stored on the disk; that's
> > why the software is unable to read FAT details. The disk
> > has to be formatted and the file system created and stored
> > before any other file manipulations.
> >
> > There must a routine in the library that performs this task,
> > I am not sure which exactly one.
> >
> > NB: I might be completely off, please look up further explanations
> > about error code -3.
> >
> > Perhaps FAT fields have been stored off place, as you have mentioned
> > structure packing in your post. You might want to read raw sector
> > data and look what was written there.
> >
> > Rgds,
> >
> > Andrew
> >
> > > Subject: File System Library Problem
> > > Posted by: "B S" matlab_fft
> > > Date: Thu May 16, 2013 9:21 am ((PDT))
> > >
> > > Hi,
> > >
> > > I have been trying to use Fat16/32 File System Library by third party given
> > > at the following website.
> > >
> > > http://ultra-embedded.com/?fat_filelib
> > >
> > > I added read and write function from the bsl, enabled GCC extension in CCS v
> > > 5.2 and packed one of the structure attributes in fat_filelib.
> > > Project compiles fine but got this error.
> > >
> > > [C674X_0] FAT_FS: Error could not load FAT details (-3)!
> > > [C674X_0] ERROR: Media attach failed
> > >
> > >
> > > I am unable to solve this issue.
> > >
> > > I would really appreciate if any one can help.
> > >
> > > Thanks.
> > >
> > > BAS
> > >
> > >
> ------- End of Original Message -------
------- End of Original Message -------

_____________________________________
R. Williams,

How did you presume that I am writing here without doing any analysis ? I suppose the idea of the group is to seek help where you can't help yourself.

I know something about the error but not enough to solve this issue. I asked here if someone is familiar with this kind of problem.

On the how, creating boot sector fixed the previous error.

Thanks.

________________________________
From: Richard Williams
To: B S ; Andrew Nesterov ; "c..."
Sent: Friday, June 7, 2013 4:10 AM
Subject: Re: [c6x] Re: File System Library Problem

B.S.

Offhand, I think you are wanting us to fix all your coding problems, so you
don't have to do any analysis.

My first suggestion....
perform an analysis of the source code (again: you did download the source code
didn't you?)

The analysis of the source code is exactly what we would be doing to determine
the cause of the message.

What did you do to 'work around' the problem you were having with the FAT 16
partition not being initialized/formatted?

R. Williams

---------- Original Message -----------
From: B S
To: Richard Williams , Andrew Nesterov
, "c..."
Sent: Thu, 6 Jun 2013 05:20:24 -0700 (PDT)
Subject: Re: [c6x] Re: File System Library Problem

> Hi,
>
> I worked around this problem now it does verification and every thing
> seems Ok. But while executing list directory
> functionfl_listdirectory("/"),it keeps printing the message given below
>
> [C674X_0] No. Filename
>
> [C674X_0] 1 - ?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 2 - ?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 3 - ?msdos.5.0 [32 bytes] (0xfff8000000)
> .
> .
> .
> [C674X_0] 26005 - ?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 26006 - ?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 26007 - ?msdos.5.0 [32 bytes] (0xfff8000000)
> [C674X_0] 26008 - ?msdos.5.0 [32 bytes] (0xfff8000000)
>
> I let the processor run for a long time but it just kept printing. Any
> idea what is that and how to fix it ?
>
> Thanks.
>
> ________________________________
> From: Richard Williams
> To: B S ; Andrew Nesterov
> ; "c..."
> Sent: Sunday, June 2, 2013 4:52 PM Subject: Re:
> [c6x] Re: File System Library Problem
>
> B.S.
>
> Per the source in fat_access.c, (you did download the source code?)
> the file sector currently being read is not formatted.
>
> If you enabled the fat format functionality
> then you can call one of the functions in the fat_format.c source file
> to format all the sectors.
>
> If it were me, I would work with the source files until the
> application works correctly, then, after the application works
> correctly, I would incorporate the library into the linker and remove
> the source files from the compiler steps.
>
> A reading of the fat_access.c then a reading of the fat_format.c was
> all it took to determine the sector read from the media was not
> formatted and how to invoke the necessary function(s) to perform the format.
>
> R. Williams
>
> ---------- Original Message -----------
> From: B S
> To: Andrew Nesterov , "c..."
>
> Sent: Thu, 23 May 2013 06:37:02 -0700 (PDT)
> Subject: Re: [c6x] Re: File System Library Problem
>
> > Andrew,
> >
> > Thanks for your reply.
> >
> > I am getting error over the line given below which can be found in
> > fat_access.c file.
> >
> > // Make Sure 0x55 and 0xAA are at end of sector
> > // (this should be the case regardless of the MBR or boot sector)
> > if (fs->currentsector.sector[SIGNATURE_POSITION] != 0x55 || fs-
> > >currentsector.sector[SIGNATURE_POSITION+1] != 0xAA) return
> FAT_INIT_INVALID_SIGNATURE;
> >
> > I couldn't figure out how to make sure that these values are at the of
> > sector. Any help would be appreciated.
> >
> > Thanks.
> >
> > ________________________________
> > From: Andrew Nesterov
> > To: c...
> > Cc: B S
> > Sent: Sunday, May 19, 2013 3:08 AM
> > Subject: [c6x] Re: File System Library Problem
> >
> >
> >
> > Hi,
> >
> > My guess is the FAT has not been stored on the disk; that's
> > why the software is unable to read FAT details. The disk
> > has to be formatted and the file system created and stored
> > before any other file manipulations.
> >
> > There must a routine in the library that performs this task,
> > I am not sure which exactly one.
> >
> > NB: I might be completely off, please look up further explanations
> > about error code -3.
> >
> > Perhaps FAT fields have been stored off place, as you have mentioned
> > structure packing in your post. You might want to read raw sector
> > data and look what was written there.
> >
> > Rgds,
> >
> > Andrew
> >
> > > Subject: File System Library Problem
> > > Posted by: "B S" matlab_fft
> > > Date: Thu May 16, 2013 9:21 am ((PDT))
> > >
> > > Hi,
> > >
> > > I have been trying to use Fat16/32 File System Library by third party given
> > > at the following website.
> > >
> > > http://ultra-embedded.com/?fat_filelib
> > >
> > > I added read and write function from the bsl, enabled GCC extension in CCS v
> > > 5.2 and packed one of the structure attributes in fat_filelib.
> > > Project compiles fine but got this error.
> > >
> > > [C674X_0] FAT_FS: Error could not load FAT details (-3)!
> > > [C674X_0] ERROR: Media attach failed
> > >
> > >
> > > I am unable to solve this issue.
> > >
> > > I would really appreciate if any one can help.
> > >
> > > Thanks.
> > >
> > > BAS
> > >
> > >
> ------- End of Original Message -------
------- End of Original Message -------