This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Mass Storage Device reads only first sector of memory

Good Morning,

currently I am working on a mass-storage-solution based on LPC2468 with external flash. I modified the USBMEM-Examples function MSC_MemoryRead, MSC_MemoryWrite, MSC_MemoryVerify and MSC_MemorySize, MSC_Blockcount.
The MSD is supposed to be used with a FAT16 filesystem (no MBR, just PBR).

After connecting the device to a PC, the PBR in sector 0 is read, but the following sectors aren't. Using WinHEX i could verify, that even modifying sector 1 (which is hidden, FAT1 begins at sector 32) isn't recognized by the MSD.

Here are the modifications to MSC_ReadMemory function.

[...]
NANDFLASHPageRead((Offset &(~(0x1FF)))+FAT_offset_pages<<9 , &Buffer[0], 512);             // read corresponding page

        if ((Offset + n) > MSC_MemorySize)
        {
                n = MSC_MemorySize - Offset;
                BulkStage = MSC_BS_DATA_IN_LAST_STALL;
        }

        USB_WriteEP(MSC_EP_IN, &Buffer[Offset%512], n);
[...]

I can't figure out, whats wrong. The USBMEM-Example works just fine and I haven't changed anything regarding the MSC except for the functions I've mentioned.

Thank you for reading and hopefully trying to help me.

Regards
Frank

Parents
  • Hello Tsuneo

    finally I made it working. I forgot brackets in the makro FAT_offset_pages. This totally screwed up the addressing.

    For now I can read the device using Disk Probe and WinHex, what doesn't work is opening a testfile via windows explorer. I guess, that windows needs correct working write-functions for opening a file.

    Thanks a lot!
    Frank

Reply
  • Hello Tsuneo

    finally I made it working. I forgot brackets in the makro FAT_offset_pages. This totally screwed up the addressing.

    For now I can read the device using Disk Probe and WinHex, what doesn't work is opening a testfile via windows explorer. I guess, that windows needs correct working write-functions for opening a file.

    Thanks a lot!
    Frank

Children
No data