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 Host HID Class Example for LPC2468

Hello,

I am hoping to setup my LPC2468 to act as a USB Host and to work with the HID Class. I am wondering if anyone has suggestions on example code or reading material?

I have gotten Keil's USB HID Client working on my hardware, and have been looking through the Host Lite Mass Storage example provided by Keil/Nxp/OnChip.

Any suggestions would be greatly appreciated.

Thank you,
Eric

Parents Reply Children
  • Tsuneo,

    Your advice has been great. I have things up and running with Interrupt transfers.

    However, I am noticing a strange problem that occasionally occurs. My interrupt IN endpoint stops working, but my interrupt OUT endpoint continues to operate. What I mean by not working, is that the host controller stops servicing the endpoint. The IN endpoint HALT bit and SKIP bit are both not set. TailTd != HeadTd, and yet the transfer descriptor is not serviced. Meanwhile, every time I attached a TD onto the OUT endpoint, it is immediately serviced. Is there a control register or bit somewhere that could cause this problem?

    Here are the register values for my IN endpoint (taken in debug mode when the IN endpoint stopped being serviced):

    Control = 0x00401081
    TailTd = 0x7fd00160
    HeadTd = 0x7fd00150
    Next = 0
    

    Register values for the TD being pointed to by HeadTd (taken in debug mode when the IN endpoint stopped being serviced):

    Control = 0x00100000
    CurrBufPtr = 0x7fd00400
    Next = 0x7fd00160
    BufEnd = 0x7fd0043f
    

    Also, I have verified that the Interrupt Table in the Hcca is correct:

    IntTable[0] = &ED_IN
    IntTable[1] = &ED_OUT
    IntTable[8] = &ED_IN
    IntTable[9] = &ED_OUT
    IntTable[16] = &ED_IN
    IntTable[17] = &ED_OUT
    IntTable[24] = &ED_IN
    IntTable[25] = &ED_OUT
    

    This problem seems to happen when I disconnect the USB cable during when a transfer is in progress. When I reconnect the cable, if the problem is going to happen, the IN endpoint will work for a few TDs and then stop. Once the problem has happened, it doesn't matter if I disconnect and reconnect the cable -- the problem will occur again. Furthermore, if I power-cycle the USB host, the problem does not go away. HOWEVER, if I power-cycle the client, the problem does go away.

    Both the client and the host are running on an LPC2468.

    Any thoughts would be greatly appreciated!

    Thanks,
    Eric

  • Ah, okay, so I determined the problem: my client wasn't sending data (oops!). But this raises an interesting question:

    My understanding of the USB OHCI spec is that regardless of if a periodic (interrupt) IN endpoint receives data, it's TD will be processed, declared completed and placed on the done head. (ie, my understanding was that as soon as the Host Controller gets to servicing the periodic IN endpoint, it attempts a read from the USB client, and then regardless of whether or not the client had data to send, it would retire the TD to the Hcca->Done list).

    However, what appears to be happening is that the Host Controller does not decide retire the TD to the Hcca->Done list until some data actually comes in. So, since my USB client had no data to send, it appears that the IN TD was not being placed on the Hcca->Done list.

    Is this the way the OCHI USB HC is supposed to behave?

    Thank you,
    Eric