Stefano Garolini

USB HOST for MSD on MCF51JM128 - Problems while reading sectors with some pendrives

Discussion created by Stefano Garolini on Jul 15, 2011
Latest reply on Sep 9, 2011 by David Veerman

Hi, my target is a a simple USB HOST application: plug in a MSD and manage it by a set of commands received from SCI or SPI bus. 

My project is MCF51JM128 based, I'm using CW MCU 10.1 Compiler, and developing it on a DEMOJM board.


I started from "Freescale USB Stack with PHDC v3.0" and "Freescale USB FATFS v1.0", specifically from the demo project "msd_mfs_generic": this simple demo project execute a complete test (drive info, read/write directory, read/write files, ecc.) of the pendrive plugged in, and print all results on SCI bus.


I have the following problem:almost 50% of the pendrive doesn't work fine, the test always fail with the message "NO FILE SYSTEM". This is caused from a failed reading of the sectors.After plug in, demo test execute check_fs(...) to read information from MBR (sector 0) and initialize fat table structures. But with some pendrives there was problems while low level reading sector (function disk_read(), the buffer out it's never written and the software scan a wrong buffer).


Anyone experienced with this problem? or any hint to debug? I try almost all but it doesn't work yet...

Outcomes