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
Solved! Go to Solution.
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
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
Hi Brent,
I am also trying it. If you get some result, could you share here?
Thank you.
-Daniel
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
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
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
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
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
I did not, I am using a custom board which does not have a SD Card.