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

LPC1756 HID mouse, no IN report interrupt

Hi, I'm trying to implement the generic USB mouse functionality on NXP LPC1756. Basing on Keil LED HID example, I modified the USB descriptor as following:

/* HID Report Descriptor */
const uint8_t HID_ReportDescriptor[] = {
  HID_UsagePage(0x01),
  HID_Usage(0x02),
  HID_Collection(HID_Application),
    HID_Usage(0x01),
        HID_Collection(HID_Physical),
        HID_UsagePage(HID_USAGE_PAGE_BUTTON),
    HID_UsageMin(1),
    HID_UsageMax(3),
    HID_LogicalMin(0),
    HID_LogicalMax(1),
        HID_ReportCount(3),
        HID_ReportSize(1),
    HID_Input(HID_Data | HID_Variable | HID_Absolute),
    HID_ReportCount(1),
        HID_ReportSize(5),
    HID_Input(HID_Constant),
    HID_UsagePage(HID_USAGE_PAGE_GENERIC),
    HID_Usage(HID_USAGE_GENERIC_X),
        HID_Usage(HID_USAGE_GENERIC_Y),
        //HID_Usage(HID_USAGE_GENERIC_WHEEL),
    HID_LogicalMin(-127),
    HID_LogicalMax(127),
    HID_ReportSize(8),
        HID_ReportCount(2),
    HID_Input(HID_Data | HID_Variable | HID_Relative),
  HID_EndCollection,
  HID_EndCollection
};

const uint16_t HID_ReportDescSize = sizeof(HID_ReportDescriptor);


/* USB Standard Device Descriptor */
const uint8_t USB_DeviceDescriptor[] = {
  USB_DEVICE_DESC_SIZE,              /* bLength */
  USB_DEVICE_DESCRIPTOR_TYPE,        /* bDescriptorType */
  WBVAL(0x0200), /* 2.00 */          /* bcdUSB */
  0x00,                              /* bDeviceClass */
  0x00,                              /* bDeviceSubClass */
  0x00,                              /* bDeviceProtocol */
  USB_MAX_PACKET0,                   /* bMaxPacketSize0 */
  WBVAL(0xc251),                     /* idVendor */
  WBVAL(0x0116),                     /* idProduct */
  WBVAL(0x0100), /* 1.00 */          /* bcdDevice */
  0x04,                              /* iManufacturer */
  0x20,                              /* iProduct */
  0x42,                              /* iSerialNumber */
  0x01                               /* bNumConfigurations */
};

/* USB Configuration Descriptor */
/*   All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
const uint8_t USB_ConfigDescriptor[] = {
/* Configuration 1 */
  USB_CONFIGUARTION_DESC_SIZE,       /* bDescriptorType */
  USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
  WBVAL(                             /* wTotalLength */
    USB_CONFIGUARTION_DESC_SIZE +
    USB_INTERFACE_DESC_SIZE     +
    HID_DESC_SIZE               +
    USB_ENDPOINT_DESC_SIZE
  ),
  0x01,                              /* bNumInterfaces */
  0x01,                              /* bConfigurationValue */
  0x00,                              /* iConfiguration */
  USB_CONFIG_BUS_POWERED /*|*/       /* bmAttributes */
  USB_CONFIG_POWER_MA(100),          /* bMaxPower */
/* Interface 0, Alternate Setting 0, HID Class */
  USB_INTERFACE_DESC_SIZE,           /* bLength */
  USB_INTERFACE_DESCRIPTOR_TYPE,     /* bDescriptorType */
  0x00,                              /* bInterfaceNumber */
  0x00,                              /* bAlternateSetting */
  0x01,                              /* bNumEndpoints */
  USB_DEVICE_CLASS_HUMAN_INTERFACE,  /* bInterfaceClass */
  HID_SUBCLASS_BOOT,                 /* bInterfaceSubClass */
  HID_PROTOCOL_MOUSE,                 /* bInterfaceProtocol */
  0x00,                               /* iInterface */
/* HID Class Descriptor */
  HID_DESC_SIZE,                     /* bLength */
  HID_HID_DESCRIPTOR_TYPE,           /* bDescriptorType */
  WBVAL(0x0101), /* 1.01 */          /* bcdHID */
  0x00,                              /* bCountryCode */
  0x01,                              /* bNumDescriptors */
  HID_REPORT_DESCRIPTOR_TYPE,        /* bDescriptorType */
  WBVAL(HID_REPORT_DESC_SIZE),       /* wDescriptorLength */
/* Endpoint, HID Interrupt In */
  USB_ENDPOINT_DESC_SIZE,            /* bLength */
  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType */
  USB_ENDPOINT_IN(1),                /* bEndpointAddress */
  USB_ENDPOINT_TYPE_INTERRUPT,       /* bmAttributes */
  WBVAL(8),                          /* wMaxPacketSize */
  0x0A,          /* 10ms */          /* bInterval */
/* Terminator */
  0                                  /* bLength */
};

Now, when connected to the PC, the Keil MCB1700 board appears as HID-Compliant mouse in Device Manager under Win7, so, I imagine, the descriptor is correct. On USBlyzer the device goes through the GET_DESCRIPTOR and SELECT_CONFIGURATION phases, putting a breakpoint in USB_Configure_Event() function confirms that. Unfortunately nothing happens after, the firmware is supposed to refresh IN report data when GetInReport() function is called at USB Endpoint 1 event. The problem is that this event never happens. In fact, it looks like the host never generates the interrupt condition. I'm missing something but I don't see where exactly to dig. Thanks to all for any eventual advise.

Dimitri

Parents
  • About the wheel, technically I don't need it, for the moment there is no support on the firmware side but with or without does not change anything, I'm getting the same communication problem.
    There is no reason to not use the latest MDK with build-in USB support except the fact that we're using an old 4.x MDK purchased many years ago. For the moment I cannot justify the spending of thousands $ just for this particular project.

Reply
  • About the wheel, technically I don't need it, for the moment there is no support on the firmware side but with or without does not change anything, I'm getting the same communication problem.
    There is no reason to not use the latest MDK with build-in USB support except the fact that we're using an old 4.x MDK purchased many years ago. For the moment I cannot justify the spending of thousands $ just for this particular project.

Children