On my custom board based on K66F180 cpu I have to handle both SD cards through the SPI interface and a memory stick on USB Host.
I am developing my application with KDS 3.0.0 and KSDK 1.3.0 + PEx. My application is based on MQX RTOS Standard and I created my project following the tutorial How To: Create an MQX RTOS for KSDK project with Processor Expert in Kinetis Design Studio IDE .How To: Create an MQX RTOS for KSDK project with Processor Expert in Kinetis Design Studio IDE
Following the tutorial FRDM K64F Data Logger using FatFs with KSDK 1.2.0 | Centaurian and the host_msd_fatfs_mqx_twrk65f180m demo project provided with KSDK 1.3.0, I chose FatFs file system for both the mass storage devices.
I imported FatFs source files in my project and now I can properly read/write files on SD cards.
In my project I loaded the fsl_usb_framework PE component and configured it in Host mode to generate the driver information table for USB_CLASS_MASS_STORAGE with USB_SUBCLASS_MASS_UFI and USB_SUBCLASS_MASS_SCSI sub-classes and USB_PROTOCOL_MASS_BULK protocol. I use the same usb_host_mass_device_event() MSD event call-back function and my USB task has the same architecture of APP_Task() function in the demo.
On a USB_DEVICE_INTERFACE_OPENED mass device state event I call f_mount() to mount the FatFs file system on the attached USB memory stick.
But FatFs mounting always fails on USB, I always get the FR_NO_FILESYSTEM error.
Debugging my code I verified all the calls to msd_disk_initialize(), msd_disk_ioctl() and msd_disk_read() functions return with no errors (USB_OK).
Also, the USB code should work, because upon disk initialization the Vendor Information, Product Identification and Product Revision Level strings are properly received from the attached USB memory stick.
But no data are received when f_mount() tries to read the first disk sector to check if a valid FAT is present: the received buffer remains with all its byte at 0x00 and the check for a 0xAA55 valid boot record signature at offset 510 always fails.
And I get the same issue even if I change the USB memory stick (formatted as FAT or FAT32).
I verified both the usbhdltask and the KHCI Task are running, but I am not able to debug inside the USB code to see what happens.
And I confirm: I can read/write files on SD cards in the same time with the same FatFs file system
I am attaching my PE project, the FatFs config file, the msd_diskio.c source file and my USB task source file.
Is there anyone who can help me on that issue?
Original Attachment has been moved to: USB_Host_MSD.zip