Content originally posted in LPCWare by ehughes on Wed May 21 08:31:14 MST 2014
Just as a warning to others..... Do not rely on the USB MSC drivers.
I have been spending time trying to get the MSC ROM drivers to work with the SD card interface. It is apparent that there are some fundamental architectural bugs in the ROM drivers.
Exhibit A
UM10503 Rev 1.8 - 28 January 2014
Table 596
The are descriptions of the MSC_Write, etc call backs. The MSC_RAM example in V2.xx all show an extra argument called hi_offset THAT IS NOT DOCUMENTED IN THE MANUAL.
What is the true function prototype? Stack corruption can/will occur
Exhibit B
In the Write Callback, (translate_wr()) I can get Length and Offsets that make no sense
For example, when I try to plumb in my disk_io layer (which I have verified working with FatFs), I can get lengths that are not increments of a 512 byte block (this violates the SCSI rules for USB MSC).
Furthermore, when I get these odd lengths, the offset is not aligned to a 512 byte boundary. even if add/subtract the "length" parameter, it DOES NOT exist on a block boundary. In fact, the Length + Offset can span 2 blocks
These is no sane way of interfacing to a block based device (SD) card if this is the way thing work. the USB MSC spec never requires this kind of access.
Exhibit C
There are many cases where the length field is set to zero. This behavior is useless.
Exhibit D
During USB write transaction, the rom driver tends to hang around this address:
0x10402b80