cancel
Showing results for 
Search instead for 
Did you mean: 

The USB-MSC Example read incorrect content of boot sector. Why?

JHYBN.2056
Associate II

My goal is to rework the SD-card code with FatFS in non-blocking mode. When I start to read the SD card with the help of DMA, I have been surprised that the boot sector (sector #0) has somehow 'damaged' content (0x55AA signature at the end, but many zeroes at the start), but the SDMMC module signals correct operations (no CRC errors, etc.)

So I started to look into 'USB-MSC Example' and the results of reading sector #0 is exactly the same as in my code. But because the 'USB-MSC Example' seems working from the PC side point of view I have digged deeper into this official example. After some moment I have recognized, that the 'USB-MSC Example' reads sector #0 many times (8 retries) until it gets the correct content.

And there is my question. Why this sector is not read correctly on the first try? Is it really necessary to retry reading? And if yes, how can I recognize, that this time I get the correct content?

I am sorry for such a long question, but any idea/help is really welcome.

Regards,

Jarda

1 REPLY 1
JHYBN.2056
Associate II

If somebody is interested in ...

My question was not completely correct and I am sorry for that.

Repeated readings of sector #0 is not because of 'USB-MSC Example' itself, but because of OS (Win7 in my case). If I run the example under Linux, the sector is read only once and the OS immediately follows its content. Why the Win7 behaves in such a way is something what I do not want to study at all...

Jarda