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 for HID on LPC2388

Hello, I am currently trying to modify the USB Host Stack Light for the LPC2388 in order to communicate with a keyboard. I am having difficulties in requesting interrupt transfers from the keyboard device. I have registered the Interrupt Endpoint structure with HCCA and am trying to receive reports using the following code :

SDWRD Hid_ReportRecvInt( UBYTE * buf )
{
        /* do we need toggle bit ? */
        /* where can we set report number ? */

        TDHead->Control = 0 |
                        TD_ROUNDING |     /* last packet from endpoint must fill exactly input buffer buf */
                        TD_IN |           /* token */
                        TD_DELAY_INT(0);  /* no delay interrupt */
        TDTail->Control = 0;
        TDHead->CurrBufPtr = (UDWRD) buf;
        TDTail->CurrBufPtr = 0;
        TDHead->Next = (UDWRD) TDTail;
        TDTail->Next = 0;
        TDHead->BufEnd = (UDWRD) (buf + 7);
        TDTail->BufEnd = 0;

        EDIntIn->HeadTd = (UDWRD) TDHead | ((EDIntIn->HeadTd) & 0x00000002);
        EDIntIn->TailTd = (UDWRD) TDTail;
        EDIntIn->Next = 0;

        /* PeriodicListEnable */
        HcControl = HcControl | OR_CONTROL_PLE;
        Host_WDHWait();
        /* Periodic list disable */
        HcControl = HcControl & (~OR_CONTROL_PLE);

        if ( !( TDHead->Control & 0xF0000000 ) )
        {
                return (OK);
        }
        else
        {
                return (ERR_TD_FAIL);
        }
}

This routine gets polled every 8 ms from a main loop.
The Host_WDHWait() is just an infinite loop waiting for the Write Head Done event set in an ISR.
The Interrupt End Point is registered in the interrupt table in another peace of code. All interrupts are enabled...
The problem I am facing is that no interrupt ED gets serviced.
Could someone at least tell me wether the code above is the correct way to request an IN USB report from a keyboard or some other USB transaction must be done before calling Hid_ReportRecvInt ?
Thanks a lot in advance, Todor