USB MSD class with external FLASH

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

USB MSD class with external FLASH

Jump to solution
5,348 Views
brentwilliams
Contributor II

Hello, I am using a K20 on a custom board with an external FLASH.  I would like to have this external FLASH be a MSD. 

I have gotten the RAM DISK example working.  I have also separately gotten MFS working with the external FLASH.

From other threads it appears you cannot use a MSD directly with MFS.  Is this correct?

Has anyone found a work around or a solution for having a external FLASH act as a MSD?

Thanks,

Brent

0 Kudos
1 Solution
3,190 Views
Martin_
NXP Employee
NXP Employee

Yes, that is right. In response to a USB attach event, perhaps you can uninstall MFS, so the PC gains full control of the data storage. Then in response to a USB detach, MFS can be installed back.

-Martin

View solution in original post

0 Kudos
28 Replies
588 Views
brentwilliams
Contributor II

I was having some issues pulling the appropriate code (KHCI) out.  I have been meaning to follow up with Michael to get some more details, but got pulled off onto something else for the time being.  I will probably be revisiting it soon.

Brent

0 Kudos
588 Views
danielchai
Senior Contributor I

Hi Brent,

I am also trying it. If you get some result, could you share here?

Thank you.

-Daniel

0 Kudos
588 Views
brentwilliams
Contributor II

Sure and if you get it working please share.

Michael, not sure if you could share a portion of your code demonstrating how to do this?

Thanks,

Brent W

0 Kudos
586 Views
danielchai
Senior Contributor I

Hi Brent,

After some testing, I found without editing the USB Stack it is hard to use the higher priority task instead of the USB callback function. Because that callback function is required by the USB Stack.

I am keeping on working on it and try to see if can make it work.

-Daniel

0 Kudos
588 Views
danielchai
Senior Contributor I

Hi Brent,

Thank you for your reply.

Carlos who is one of the Freescale engineer shared me a project which use the SD card as a MSD storage USB mass storage device from SD card with TWR-K60  . He said it should work, but when I copy the disk.c to the MQX demo project msd_disk_twrkf120m, it does not work. I am wondering if I did something wrong. I know the read/write on the SD card also use the the interrupt but how does it work? Here is a document shows it use the SD card as a USB MSD storage http://cache.freescale.com/files/microcontrollers/doc/user_guide/USBUG.pdf

There is still a part of the code in that project I don't understand.

if(3 == u8gvIndex++)

{
     sdcard_handle->LOCATION = (lba_data_ptr->offset >> 9);
      write(sdcard_handle,u8gvlba_data_buff,1);
      u8gvIndex = 0;
}

Why it use 3 here? If it is used to convert the 64 bytes buffer to 512 bytes, it should use 7. I am confused about this.

Thank you again.

-Daniel

0 Kudos
588 Views
brentwilliams
Contributor II

Hi Daniel,

The SDCard example I have is from the non-MQX USB stack:  C:\Program Files (x86)\Freescale USB Stack v3.1.3\Source\Device\app\msd.  It contains the usb_descriptor files, SDCard and SPI source.

The SPI driver code, for the SDCard MSD example is all poll driven. 

Brent

0 Kudos
588 Views
danielchai
Senior Contributor I

Hi Brent,

Did you look at this thread USB mass storage device from SD card with TWR-K60. Carlos shared a project which is based on MQX. It use the esdhc channel.

-Daniel

0 Kudos
588 Views
brentwilliams
Contributor II

I did not, I am using a custom board which does not have a SD Card.

0 Kudos