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.

MSP-EXP430F5529LP: multiple HID interfaces gamepad

Part Number: MSP-EXP430F5529LP

I'm trying to create a USB gamepad interface in windows using the MSP430dev package resources.

At this point I'm able to have a single HID gamepad interface working correctly. Unfortunately I'm stuck trying to use the same implementation to get 2 HID interfaces for dual gamepad.

I've looked up the "HH1_hidDemo2hidDemo" example as well as re-generated the decriptors files using the decriptor tool, defining 2 HID devices.

I've added the Report ID and numerated as "0x85, 0x01" and  0x85, 0x02,                    //     REPORT_ID (Vendor defined) respectively. I am sending the ID over the USBreport accordingly. 

typedef struct {
    uint8_t id;
    uint8_t btn;
    int8_t dx;
    int8_t dy;
    int8_t dz;
    int8_t drx;
} GAMEPAD_REPORT;

uint16_t const report_desc_size[HID_NUM_INTERFACES] =
{
    48,
    48
};
uint8_t const report_len_input[HID_NUM_INTERFACES] =
{
    6,
    6
};

int8_t const report_desc_HID0[]=
{
 0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
 0x09, 0x05,                    // USAGE (Game Pad)
 0xa1, 0x01,                    // COLLECTION (Application)
 0xa1, 0x00,                    //   COLLECTION (Physical)
 0x85, 0x01,                    //     REPORT_ID (Vendor defined)
 0x05, 0x09,                    //     USAGE_PAGE (Button)
 0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
 0x29, 0x08,                    //     USAGE_MAXIMUM (Button 8)
 0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
 0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
 0x95, 0x08,                    //     REPORT_COUNT (8)
 0x75, 0x01,                    //     REPORT_SIZE (1)
 0x81, 0x02,                    //     INPUT (Data,Var,Abs)
 0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
 0x09, 0x30,                    //     USAGE (X)
 0x09, 0x31,                    //     USAGE (Y)
 0x09, 0x32,                    //     USAGE (Z)
 0x09, 0x33,                    //     USAGE (Rx)
 0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
 0x25, 0x7f,                    //     LOGICAL_MAXIMUM (127)
 0x75, 0x08,                    //     REPORT_SIZE (8)
 0x95, 0x04,                    //     REPORT_COUNT (4)
 0x81, 0x02,                    //     INPUT (Data,Var,Abs)
 0xc0,                          //   END_COLLECTION
 0xc0                           // END_COLLECTION
};

The result is that the host (win PC) still recognizes only ONE gamepad device. It seems that the host is not enumarating correctly the second device for some reason. 

Has anyone got a clue, facing the same problem or maybe succesfully implemented something similar?

Any help is appreciated.

Thanks

Shaun

  • Hi Shaun,

    If you want to have two different devices each having a HID interface and you want Windows to see it as two different HID devices then you will have to change the PID for one of them.    So right now all the single HID examples like H1... have a VID/PID of 0x2047/0x315.  You can change the 0x315 to another number.  The Programmer's guide lists the range of PIDs that you can use.  If you do change it to another PID, then please know that that VID/PID will not be certified and the certificate that comes with all our examples is void. 

    There might be other ways of doing what you want to do without changing the VID/PID but I have not looked into them.  If I find some other way, I will post it.


    Regards,

    Arthi

  • Hi Arthi,

    Thanks for the reply.

    So if I understand this correctly I should have two pairs of VID/PID; one for each device? In that case I'm not sure how to accomplish this since the descriptor code only points  to one instance of the PID.

    uint8_t const abromDeviceDescriptor[SIZEOF_DEVICE_DESCRIPTOR] = {
        SIZEOF_DEVICE_DESCRIPTOR,               // Length of this descriptor
        DESC_TYPE_DEVICE,                       // Type code of this descriptor
        0x00, 0x02,                             // Release of USB spec
        0x00,                                   // Device's base class code
        0x00,                                   // Device's sub class code
        0x00,                                   // Device's protocol type code
        EP0_PACKET_SIZE,                        // End point 0's packet size
        USB_VID&0xFF, USB_VID>>8,               // Vendor ID for device, TI=0x0451
                                                // You can order your own VID at www.usb.org"
        USB_PID&0xFF, USB_PID>>8,               // Product ID for device,
                                                // this ID is to only with this example
        VER_FW_L, VER_FW_H,                     // Revision level of device
        1,                                      // Index of manufacturer name string desc
        2,                                      // Index of product name string desc
        USB_STR_INDEX_SERNUM,                   // Index of serial number string desc
        1                                       //  Number of configurations supported
    };

     Is that what you're suggesting? Notice that I've already tried different PIDs from the examples guide MSP430 USB API, even the experimentation PID 0x3df, always getting the same result.

    I guess I'm still missing something.

    Thanks,

    Shaun

  • In the descriptors.h file there are two #defines that are listed for VID and PID.  You change the PID there. 

    #define USB_VID 0x2047 // Vendor ID (VID)

    #define USB_PID 0x0315 // Product ID (PID)

     

    Regards,

    Arthi

  • Yes, I was referring to those defines. Still not working. Can it be a driver's problem?
  • Hi Shaun,

    Let me get an understanding of your hardware because I am not sure I see it clearly.  Are you trying to implement one HID interface on a seperate gamepad or is it one gamepad with two HID interfaces?  

    If you are implementing two HID interfaces as a composite device on one gamepad, the Windows OS will see it has one device since they are each defined with the same VID/PID.  You cannot seperate out the two HID interfaces independently.    If you need independency, then having two seperate gamepads each with its won HID interface and VID/PID will work.

    I would like to understand the reason why you want Windows to recognize the gamepad as two seperate devices when they are meant to be a composite device.    Even though the HH1 example is a composite, Windows does recognize it to the point that it knows which interface and endpoint data is either being transmitted on or received from.

    Regards,

    Arthi 

  • So here's the complete picture.

    I'm trying to get one  MSP-EXP430F5529LP hardware platform to serve as an interface for  two gamepads, obviously as usb hid devices.  So, with only one HID device everything works fine. Although when I try defining two HID's with two identical report descriptors identified by the report IDs 1 and 2, the host still recognizes the first one but has troubles with number 2, throwing a code 10 error. 

    I used the HH1 example as a reference, since I think the mechanism should be the same. Using report IDs windows should be able to enumarate both devices and commucate accordingly. I'm attaching the report generated with a usb analyzer, showing that the pc seems to see part of the information of the second endpoint but for some reason is not fetching the report decriptor number 2.

    Shaun

  • Shaun,

    In the HH1 example, both the report IDs for both HID reports are the same.  Maybe you can try using the same report ID in both HID reports.   If that does not work, then the report descriptors for 2nd device needs to be re-verified.

    Regards,

    Arthi

  • Hi,

    Just an update to this post. I was able to get my configuration working with a slightly different approach. It is based on the 1) multi-TLCs (Top-Level Collection) solution  suggested in this post Basically setting everything up as one HID and USB device and using the report description to define both devices throught report ID's, 1 and 2 in my case.

    That's all for now.

    thanks a lot for your help.

    Shuan

**Attention** This is a public forum