Unable to install file system on an USB

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

Unable to install file system on an USB

939 Views
arnogir
Senior Contributor II

Hello

I'm working with a K70 and MQX 4.1.

I'm using USB and work correctly on my side.

A persone who use the board are unable to use the USB.

Problem come from this part of code (Same as MQX USB sample)

/* Install MFS over partition */ ErrorCode = (int32_t)_io_mfs_install(usb_fs_ptr->PM_FD_PTR, file_system_name, 0); if (ErrorCode != MFS_NO_ERROR) { printf("Error initializing MFS over partition: %s\n", MFS_Error_text((uint32_t)ErrorCode)); }

Return Error is -1.

For information, this USB key work correctly with the Freescale Bootlader for K70.

After debug, (you can see a screenshot) the function _io_usb_mfs_read_sector_internal is called.

In this function there are a loop, but return value is -1.

Can tou know why this function return -1. What can be the root cause?

Labels (1)
0 Kudos
Reply
4 Replies

708 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

In your case, you get an error from MFS, not from USB stack.

It seems the USB is attached and communication is established properly, just mounting of MFS file system on it has problems. Are you sure the usb stick is formatted with a FAT file system? If you are unsure, you can try to format the USB device by the MQX  USB stack. and allocation unit size of 8 kb or less.


Have a nice day,
Daniel

0 Kudos
Reply

708 Views
arnogir
Senior Contributor II

Hi,

The USB key was formated with windows 7 in FAT32.

I tried with many key from small size to bigger.

I can try to format with MQX but How do?

Because the shell command "format" need a drive label and supposed file system is already installed?

Currently,  the code make like following:


ErrorCode = (int32_t)_io_usb_mfs_install(block_device_name, 0, (void *)usb_handle);

usb_fs_ptr->DEV_NAME = block_device_name;

usb_fs_ptr->DEV_FD_PTR = fopen(block_device_name, 0);

io_ioctl(usb_fs_ptr->DEV_FD_PTR, IO_IOCTL_SET_BLOCK_MODE, NULL);

...

ErrorCode = _io_part_mgr_install(usb_fs_ptr->DEV_FD_PTR, partition_manager_name, 0);

usb_fs_ptr->PM_NAME = partition_manager_name;

usb_fs_ptr->PM_FD_PTR = fopen(partition_manager_name, NULL);

partition_number = 1; ErrorCode = _io_ioctl(usb_fs_ptr->PM_FD_PTR, IO_IOCTL_SEL_PART, &partition_number); if (ErrorCode == MFS_NO_ERROR) {

//: don't pass here, but in the "else"     printf("Installing MFS over partition...\n");

    ....

}

else {   printf("Installing MFS over USB device...\n");   /* Install MFS over USB device driver */   ErrorCode = (int32_t)_io_mfs_install(usb_fs_ptr->DEV_FD_PTR, file_system_name, 0);

  usb_fs_ptr->FS_NAME = file_system_name;   usb_fs_ptr->FS_FD_PTR = fopen(file_system_name, NULL);     ErrorCode = ferror(usb_fs_ptr->FS_FD_PTR);

//>>>>>Then here ErrorCode return -1 like indicated in my previous post






Then where and what code added to format USB?

0 Kudos
Reply

708 Views
danielchen
NXP TechSupport
NXP TechSupport

It seems MQX 4.1 not support your USB stick,  what is your USB stick model, and it's capacity?

0 Kudos
Reply

708 Views
arnogir
Senior Contributor II

I try with some model without problem.

But with other some 4 or 5 model (with equivalent capacity of running model) this not work.

But the number of key which not work is so many I think!

What could be the reason MQX not support an USB Key? which characteristic of the key could be lead to the problem?

0 Kudos
Reply