Problem creating a new file in USB key, error: FS_SECTOR_NOT_FOUND

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

Problem creating a new file in USB key, error: FS_SECTOR_NOT_FOUND

601 Views
kappa74
Contributor IV

Good morning,

I tried to write a file in a USB key but the MQX libraries give me an error which is FS_SECTOR_NOT_FOUND: which is the meaning of this error? The USB key is empty and it is a 4GB key. I wrote in the file a page of 257 bytes for 4096 pages. Why do I get this type of error?

The USB key is a Trascend of 4GB.

Following an extract of the code:

// +++++++++++

#define  DIM_BUF_HWK         257

memset(BufferPage[0], 0xFF, DIM_BUF_HWK);

for (k=0; k< 4098; k++)

{

    err_w= write(pFile, BufferPage[0], DIM_BUF_HWK);           

}

// +++++++++++

In the table of USB I defined the USB key as following:

//++++++++++++

static const USB_HOST_DRIVER_INFO ClassDriverInfoTable[] =

   /* Vendor ID Product ID Class Sub-Class Protocol Reserved

   /* USB 2.0 hard drive */

   {{0x00,0x00}, {0x00,0x00}, USB_CLASS_MASS_STORAGE, USB_SUBCLASS_MASS_SCSI, USB_PROTOCOL_MASS_BULK, 0, usb_host_mass_device_event},

   /* End of list */

   {{0x00,0x00}, {0x00,0x00}, 0,0,0,0, NULL}

};

//++++++++++++

Do anyone have any idea?

Thank you

Mirko


Labels (1)
Tags (1)
0 Kudos
2 Replies

333 Views
kappa74
Contributor IV

Good morning,

I started from the Freescale example and then I wrote my application.

The USB key, which I used, is a Trascend 4GB formatted by Windows XP as you see in attached picture.

With the USB key Titanedi 4GB I had another problem: often after some seconds the software give me the signal of detached key even if the electrical contact, that supply voltage, and the electric signals are all good.

I got these problems, when I wrote a new file of 4096 pages  of 257 bytes writing a page at time.

It seems that I not have these problems, if I write the same files but writing 1024 pages of 257 bytes at time.

Do you know the why? Is it more sure a less number of accesses of USB key?

Thank you.

Best Regards Format.JPG


0 Kudos

333 Views
CarlosCasillas
NXP Employee
NXP Employee

Hi Mirko,

 

Are you using your custom board and/or custom project/application? Have you testes using the MSD_USB example
located on the following path of the MQX installation directory:

    C:\Freescale\Freescale_MQX_4_0\mfs\examples\mfs_usb\

 

I just tested this example using CodeWarrior v10.4 and TWR-MCF5225X + TWR-SER using many USB sticks formatted on FAT and FAT32 formats, and I didn’t get that error.

According with “Freescale MQX MFS User’s Guide” document, the FS_SECTOR_NOT_FOUND error is returned from the device, over which MFS is installed, when an error occurred while writing to the disk, maybe because the drive was formatted with incorrect parameters, or the partition table specified incorrect values. Additionally, have you also tried with a different USB stick?

Hope this will be useful for you.

Best regards!

/Carlos

0 Kudos