USB HID Mouse Driver using LPC2148

Hi all,

Thanks for your contineous support from this site.

I want to detect my board as HID mouse when plugged to USB port of PC. For that I guess I need to write HID mouse driver.

I am using LPC2148 controller. Can i gett some reference code for it?

Thanks & Regards,
Kamal

Parents
  • > Can i gett some reference code for it?

    Implementation of keyboard and mouse is a good exercise for USB starters to learn Class implementation, because HID spec documents on keyboard and mouse well.

    HID spec v1.11
    www.usb.org/.../HID1_11.pdf
    - Appendix E: Example USB Descriptors for HID Class Devices (p66)
    - Appendix B.2 Protocol 2 (Mouse) (p61)

    Starting with a HID example which fits to your compiler,

    - LPC2148 USB HID (Human Interface Device) Example - MDK-ARM
    http://www.keil.com/download/docs/306.asp

    - LPCUSB - GNU ARM (YAGARTO, etc)
    sourceforge.net/.../

    Modification of 40-50 lines of its source code (including 26 lines of report descriptor) makes your board a mouse.

    If you want to learn on USB, I'll guide you.

    Tsuneo

  • Dear Tsuneo,

    I have an example code (made from this link:sourceforge.net/.../) which makes LPC2148 to be a USB joystick device, it's working good. Now I want to make LPC2148 to become a USB keyboard device, running on Keil MCB2140 board, I changed the report desciptor following HID 1.1 pdf, but the host PC still detects it as a HID-compliant game controller??

    Here is my report descriptor:
    static UNS_8 abReportDesc[] = { HID_UsagePage(HID_USAGE_PAGE_GENERIC), HID_Usage(HID_USAGE_GENERIC_KEYBOARD), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), HID_UsageMin(224), HID_UsageMax(231), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportSize(1), HID_ReportCount(8), HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(1), HID_ReportSize(8), HID_Input(HID_Constant), HID_ReportCount(8), HID_ReportSize(1), HID_UsagePage(HID_USAGE_PAGE_LED), HID_UsageMin(1), HID_UsageMax(8), HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), HID_UsageMin(0), HID_UsageMax(101), HID_LogicalMin(0), HID_LogicalMax(101), HID_ReportSize(8), HID_ReportCount(6), HID_Input(HID_Data | HID_Array), HID_EndCollection,
    };

    Please take a look and give me some advices!
    Thanks for your time!
    Tuong Nguyen

Reply
  • Dear Tsuneo,

    I have an example code (made from this link:sourceforge.net/.../) which makes LPC2148 to be a USB joystick device, it's working good. Now I want to make LPC2148 to become a USB keyboard device, running on Keil MCB2140 board, I changed the report desciptor following HID 1.1 pdf, but the host PC still detects it as a HID-compliant game controller??

    Here is my report descriptor:
    static UNS_8 abReportDesc[] = { HID_UsagePage(HID_USAGE_PAGE_GENERIC), HID_Usage(HID_USAGE_GENERIC_KEYBOARD), HID_Collection(HID_Application), HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), HID_UsageMin(224), HID_UsageMax(231), HID_LogicalMin(0), HID_LogicalMax(1), HID_ReportSize(1), HID_ReportCount(8), HID_Input(HID_Data | HID_Variable | HID_Absolute), HID_ReportCount(1), HID_ReportSize(8), HID_Input(HID_Constant), HID_ReportCount(8), HID_ReportSize(1), HID_UsagePage(HID_USAGE_PAGE_LED), HID_UsageMin(1), HID_UsageMax(8), HID_Output(HID_Data | HID_Variable | HID_Absolute), HID_UsagePage(HID_USAGE_PAGE_KEYBOARD), HID_UsageMin(0), HID_UsageMax(101), HID_LogicalMin(0), HID_LogicalMax(101), HID_ReportSize(8), HID_ReportCount(6), HID_Input(HID_Data | HID_Array), HID_EndCollection,
    };

    Please take a look and give me some advices!
    Thanks for your time!
    Tuong Nguyen

Children
More questions in this forum