Content originally posted in LPCWare by michele sponchiado on Thu Jan 07 10:47:24 MST 2016
Dear sirs,
I am using your LPC4357 and actually I am very happy of it!
Unfortunately, I am facing a weird error while using the lpcusb API MS_Host_ReadDeviceBlocks.
The routine seems to fail when the number of sector passed as parameter is 9:
I am not sure this happens every time we need 9 sectors, but surely in one occasion the routine was failing in this exact condition.
Here some other info :
- if I read 8 sectors, then 1 sector, it succeeds
- the sectors I am reading are "good", no borderline or bad sectors or so
- the error happens when reading a file: the file is read using chunk of 16*512 bytes maximum, so toward the end of the file I have a spare number of blocks and the problem happens
- when the error happens, it seems that the data are read out OK, but the status part is missing: when trying to read the status from the pipe, it returns uninitialized data
- so I patched the calling routine, the FSUSB_DiskReadSectors, to loop reading always a "power-of-two" number of sectors from the MS_Host_ReadDeviceBlocks
i.e. to read 9 sectors, I will read first 8 blocks, then 1 block
to read 12 sectors, I will read first 8, then 4
- this way, at this moment, it seems I have no more errors while reading sectors from USB
- but I am not happy with such a patch
So I would ask you:
- have you any hints about this strange condition?
Many many thanks for your support!