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

usb hostlite fat32 impplementation

i am currently using lpc2468 usbhostlite code and getting the required results.
can anyone please help me make the necessary changes in the code to use it with fat32 formatted pendrives also

  • Is the buffer passed to FILE_Write() / FILE_Read() placed on the USB RAM (HOST_BASE_ADDR)?

    This buffer is directly put into the Transfer Descriptor for DMA by the host controller.
    It means the buffer should be placed on the USB RAM.
    LPC23xx/24xx families have this restriction on DMA by USB controller.

    In the USB host lite example, it manages buffer assignment as follows.

    usbhost_lpc2468.c
    
    volatile  HCED        *EDCtrl;        /* Control endpoint descriptor structure                  */
    volatile  HCED        *EDBulkIn;      /* BulkIn endpoint descriptor  structure                  */
    volatile  HCED        *EDBulkOut;     /* BulkOut endpoint descriptor structure                  */
    volatile  HCTD        *TDHead;        /* Head transfer descriptor structure                     */
    volatile  HCTD        *TDTail;        /* Tail transfer descriptor structure                     */
    volatile  HCCA        *Hcca;          /* Host Controller Communications Area structure          */
              USB_INT16U  *TDBufNonVol;   /* Identical to TDBuffer just to reduce compiler warnings */
    volatile  USB_INT08U  *TDBuffer;      /* Current Buffer Pointer of transfer descriptor          */
    volatile  USB_INT08U  *FATBuffer;     /* Buffer used by FAT file system                         */
    volatile  USB_INT08U  *UserBuffer;    /* Buffer used by application                             */
    
    void  Host_Init (void)
    {
        ...
        Hcca       = (volatile  HCCA       *)(HOST_BASE_ADDR+0x000);
        TDHead     = (volatile  HCTD       *)(HOST_BASE_ADDR+0x100);
        TDTail     = (volatile  HCTD       *)(HOST_BASE_ADDR+0x110);
        EDCtrl     = (volatile  HCED       *)(HOST_BASE_ADDR+0x120);
        EDBulkIn   = (volatile  HCED       *)(HOST_BASE_ADDR+0x130);
        EDBulkOut  = (volatile  HCED       *)(HOST_BASE_ADDR+0x140);
        TDBuffer   = (volatile  USB_INT08U *)(HOST_BASE_ADDR+0x150);
        FATBuffer  = (volatile  USB_INT08U *)(HOST_BASE_ADDR+0x1D0);
        UserBuffer = (volatile  USB_INT08U *)(HOST_BASE_ADDR+0x1000);
    

    If the buffer would be placed on the USB RAM, you don't need abuve repeated FILE_Write(). Single FILE_Write() call with whole buffer will do.

    Tsuneo

  • Thanks Sir

    No, Sir buffer was not placed on USB RAM.

  • Thank You so much Sir you solved my problem

    you are genuinely a master.

  • Hello Tsuneo,

    Could you tell me why the file name must be capital letters?
    How can we make it support small letters?
    Thanks a lot.

    Ran

  • You're posting against an ancient thread, the world/internet has moved on