USBH Demo code from Segger not working for EA LPC2478 board. Help needed

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • USBH Demo code from Segger not working for EA LPC2478 board. Help needed

    We are facing some trouble while evaluating the USB host application for emUSB. When we connect the USB we get following error

    void FS_X_Panic(int ErrorCode) {
    FS_USE_PARA(ErrorCode);
    while (1);
    }
    With Errorcode "1".



    We are trying to use the following application "USB_MSD_FS_WriteOnDisconnect.c"



    This error come once it executes the following piece of code

    =================================================================================


    /*********************************************************************
    *
    * _AddMSD
    *
    * Function description
    * Add mass storage device to USB stack
    *
    * Notes:
    * (1) - This examples uses the internal driver of the file system.
    * The module intializes the low-level part of the file system if necessary.
    * If FS_Init() was not previously called, none of the high level functions
    * such as FS_FOpen, FS_Write etc will work.
    * Only functions that are driver related will be called.
    * Initialization, sector read/write, retrieve device information.
    * The members of the DriverData are used as follows:
    * DriverData.pStart = VOLUME_NAME such as "nand:", "mmc:1:".
    * DriverData.NumSectors = Number of sectors to be used - 0 means auto-detect.
    * DriverData.StartSector = The first sector that shall be used.
    * DriverData.SectorSize will not be used.
    */
    static void _AddMSD(void) {
    static U8 _abOutBuffer[USB_MAX_PACKET_SIZE];
    USB_MSD_INIT_DATA InitData;
    USB_MSD_INST_DATA InstData;

    InitData.EPIn = USB_AddEP(1, USB_TRANSFER_TYPE_BULK, USB_MAX_PACKET_SIZE, NULL, 0);
    InitData.EPOut = USB_AddEP(0, USB_TRANSFER_TYPE_BULK, USB_MAX_PACKET_SIZE, _abOutBuffer, USB_MAX_PACKET_SIZE);
    USB_MSD_Add(&InitData);
    //
    // Add logical unit 0: Use default device.
    //
    memset(&InstData, 0, sizeof(InstData));
    InstData.pAPI = &USB_MSD_StorageByName;
    InstData.DriverData.pStart = "";
    USB_MSD_AddUnit(&InstData);
    }

    ==================================================================================



    the panic occurs as last line of the above piece of code i.e.



    USB_MSD_AddUnit(&InstData);




    Though the same USB works for other FAT demo code from EA LPC 2478 board vendor but the Segger doesn't work.

    Can you explain what might be going wrong



    Regards,

    Satyajit
  • Dear Satyajit,

    you are using the wrong sample. The correct one to use is OS_USBH_MSD.c.
    Additionally you may need to change your current FS_Config_*.c config file with FS_USBH_MSDConfig.c.
    With these changes emUSB Host + emFile should work fine.

    Some background info:
    All sample files that begin with USB_* are emUSB Device samples.
    All files with the Prefix OS_USBH_ are intended to be used emUSB Host.
    The reason why this samples are called OS_USBH_* is that for emUSB Host an RTOS (embOS) is needed
    otherwise the stack won't run.

    Please let us know whether you need further help.

    Regards,

    Souhail
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.