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

usbmem example with LPC3131

Hi. I'm using LPC3131 demo board from embedded artists as a USB device (Full Speed or HS)

I have problem running the usbmem example

Kernel messages from linux (2.6.18) are:

"new high speed USB device using ehci_hcd and address 14
device descriptor read/64, error -110"

I have tried with modprobe -r ehci_hcd but with same result

Has anyone succeeded in running this example with same environment ?

Any other help would be appreciated. thks

  • Is that usbmem example working fine when it is connected to a Windows Desktop? If it works fine, then maybe you should update your Linux kernel?

    I don't know much about Linux; though there are many/several Linux experts in this forum, but this is a forum for KEIL/MCU.

  • Hi,

    No it doesn't work neither with windows.

    It is not a matter of host-side but rather the LPC3131 device-side, and in particular the usbmem example provided by Keil.

    This application provided in the LPC3131 dev kit seems to not have been tested at all : the target MCU saved in the options of µVision project is even not LPC3131.

    Does anyone succeeded in making working the USB with that board ?

  • Hi,

    I succeed to make it work with windows and also with linux but there is some troubles with linux.

    For old kernels (<2.6.20) it doesn't work because of a USB High speed problem. To make it work you need to remove the kernel module ehci_hcd (so you are in USB Full Speed).
    For newer kernels the example just works well.

    Currently I can't make it work under MAC OS

    Does someone understand what is the issue with this example ?
    If I found a solution I will post it here.

    Best regards

  • finally found the solution for make it work in USB2.0 configuration. fyi, my host side is a linux kernel 2.6.18.

    For the archive and/or whom interested, here are the changes to apply to usbmem project:

    1. Don't forget to change the target CPU in uVision project and modifying the floating point option

    2. changes to code

    the last modification, the most important, shall be mandatory to even make it work in usb1.1.

    ------------------------------------------------------
    usbdesc.c
    
    /* USB Standard Device Descriptor */
    const UNS_8 USB_DeviceDescriptor[] =
    {
      USB_DEVICE_DESC_SIZE,              /* bLength */
      USB_DEVICE_DESCRIPTOR_TYPE,        /* bDescriptorType */
    WAS=>  WBVAL(0x0110), /* 1.10 */          /* bcdUSB */
    SHOULDBE=>  WBVAL(0x0200), /* 2.00 */
    [snip]
      WBVAL(0x1FC9),                     /* idVendor */
      WBVAL(0x0004),                     /* idProduct */
    WAS=>  WBVAL(0x0100), /* 1.00 */          /* bcdDevice */
    SHOULDBE=>  WBVAL(0x0200), /* 2.00 */
    
    [snip]
    
    /* USB Configuration Descriptor */
    /*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
    const UNS_8 USB_ConfigDescriptor[] =
    {
    
    [snip]
    
    WAS=>  WBVAL(0x0040),                     /* wMaxPacketSize */
    SHOULDBE=>  WBVAL(0x0200),
    
    [snip]
    
    USB_ENDPOINT_TYPE_BULK,            /* bmAttributes */
    WAS =>  WBVAL(0x0040),                     /* wMaxPacketSize */
    SHOULDBE=>  WBVAL(0x0200),
    
    ------------------------------------------------------
    mscuser.h
    
    /* Max In/Out Packet Size */
    WAS =>     #define MSC_MAX_PACKET  64
    SHOULDBE=> #define MSC_MAX_PACKET  512
    
    ------------------------------------------------------
    lpc313x_usbdcd.c
    
    #if 0
    #define DQH_BASE    (EXT_SDRAM_BASE)
    #define DTD_BASE    (DQH_BASE + EP_NUM_MAX * sizeof(DQH_T))
    DQH_T* const ep_QH = (DQH_T*)DQH_BASE;
    DTD_T* const ep_TD = (DTD_T*)DTD_BASE;
    #else
    WAS      => DQH_T ALIGNED(1024) ep_QH[EP_NUM_MAX];
    SHOULDBE => DQH_T ALIGNED(2048) ep_QH[EP_NUM_MAX];
    DTD_T ep_TD[EP_NUM_MAX];
    #endif