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 usbDeviceError

Hi
I have made a simple program for LPC4337 Device, this is my code for initiating the HID mouse that I have connected to my board. The problem is that I got this error usbDeviceError

and my USB function initialize Ok

int main(void)
{
   osKernelInitialize (); // initialize RTOS kernel
   osKernelStart ();                              // start kernel with job2 execution

   usbStatus  usbst;

   usbst=USBH_Initialize(0);               // USB Host 0 Initialize

   while(1)
   {
       usbst=USBH_HID_GetDeviceStatus (0U); // Get HID device status
   }
}

Parents
  • I have tested the keil sample program, But I still got the same error

    I have made a simple program for my LPC1768 using keil V5.22 the LPC should act like a USB host to a mice that I have attached to it. the problem is that I will always got the usbDeviceError from the USBH_HID_GetDeviceStatus function.

    Here is my USB thread code

    void USB_Thread (void const *arg)
    {
         static usbStatus myst;
         static      usbHID_MouseState mymouse;
         myst=USBH_Initialize (0);                       /* Initialize USB Host 0         */
    
      while (1)
         {
                osDelay(10);
             myst=USBH_HID_GetDeviceStatus(0);
         }
    
    }
    

    and this is my main function

    osThreadDef(USB_Thread,  osPriorityNormal, 1, 2048);
    osThreadId tsk_USB;
    
    int main (void) {
            osKernelInitialize ();                    // initialize CMSIS-RTOS
            osKernelStart ();                         // start thread execution
            tsk_USB = osThreadCreate(osThread(USB_Thread),  NULL);  //it's used for USB mouse
         while(1)
         {
         }
    }
    

    Here are some pictures of my RTX and USB configuration boxes

    http://uploads.im/Um93L.jpg
    http://uploads.im/rv1co.jpg
    http://uploads.im/dHwgi.jpg
    http://uploads.im/5fKWi.jpg

Reply
  • I have tested the keil sample program, But I still got the same error

    I have made a simple program for my LPC1768 using keil V5.22 the LPC should act like a USB host to a mice that I have attached to it. the problem is that I will always got the usbDeviceError from the USBH_HID_GetDeviceStatus function.

    Here is my USB thread code

    void USB_Thread (void const *arg)
    {
         static usbStatus myst;
         static      usbHID_MouseState mymouse;
         myst=USBH_Initialize (0);                       /* Initialize USB Host 0         */
    
      while (1)
         {
                osDelay(10);
             myst=USBH_HID_GetDeviceStatus(0);
         }
    
    }
    

    and this is my main function

    osThreadDef(USB_Thread,  osPriorityNormal, 1, 2048);
    osThreadId tsk_USB;
    
    int main (void) {
            osKernelInitialize ();                    // initialize CMSIS-RTOS
            osKernelStart ();                         // start thread execution
            tsk_USB = osThreadCreate(osThread(USB_Thread),  NULL);  //it's used for USB mouse
         while(1)
         {
         }
    }
    

    Here are some pictures of my RTX and USB configuration boxes

    http://uploads.im/Um93L.jpg
    http://uploads.im/rv1co.jpg
    http://uploads.im/dHwgi.jpg
    http://uploads.im/5fKWi.jpg

Children