This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB Host HID

Hello,

I create a project "usb_host_mouse" based on example "usb_host_msc" and "Example Application (Mouse)" in "USB_UserGuide_02_00_01_01.pdf" from AM335x_Starterware_02_00_01_01"

It appears to me I have to change

static tUSBHostClassDriver const * const g_ppHostClassDrivers[] =
{
    &g_g_USBHostMSCClassDriver,
    &g_sUSBEventDriver
};

to

static tUSBHostClassDriver const * const g_ppHostClassDrivers[] =
{
    &g_USBHIDClassDriver,
    &g_sUSBEventDriver
};

for HID_Mouse

It runs up to "case HCD_DEV_ADDRESSED" in usbhostenum.c and gets hang at USBHCDOpenDriver() !

Am I missing something ?

Thanks,

~Duy-Ky

  • I've found out a conflict between USB Guide PDF document and the code.

    In the PDF

    g_ulMouseInstance = USBHMouseOpen(MouseCallback, g_pucBuffer, 128)

    In the C function USBHMouseOpen(), it also calls out "MouseCallback". So where to find proper code for Usb Host HID Mouse

    unsigned int USBHMouseOpen(unsigned int ulIndex, tUSBCallback pfnCallback,

                           unsigned char *pucBuffer, unsigned int ulSize)

    {

       //

       // Save the callback and data pointers.

       //

       g_sUSBHMouse.pfnCallback = pfnCallback;

       //

       // Save the instance pointer for the HID device that was opened.

       //

       g_sUSBHMouse.ulMouseInstance = USBHHIDOpen(ulIndex, USBH_HID_DEV_MOUSE,

                                                      USBHMouseCallback,

                                                          (unsigned int)&g_sUSBHMouse);

       //

       // Save the heap buffer and size.

       //

       g_sUSBHMouse.pucHeap = pucBuffer;

       g_sUSBHMouse.ulHeapSize = ulSize;

       return(g_sUSBHMouse.ulMouseInstance);

    }

  • user4327245,

    Please follow/use the example under ti\AM335X_StarterWare_02_00_01_01\build\armv7a\cgt_ccs\am335x\evmAM335x\usb_host_mouse. This example works fine on the AM335x GP EVM..

    Lali