Page 1 of 1

Interupt Out Heeelp :)

Posted: Tue Dec 04, 2007 3:41 am
by Rukus
I have 2 endpoints other than 0. I have interupt in 1 and interupt 1 out.

I can get either the interupt in or the interupt out working, but never both together.

Code: Select all

PROGMEM char usbDescriptorConfiguration[] = {    /* USB configuration descriptor */
    9,          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */
    USBDESCR_CONFIG,    /* descriptor type */
    18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + (USB_CFG_DESCR_PROPS_HID & 0xff), 0,
                /* total length of data returned (including inlined descriptors) */
    1,          /* number of interfaces in this configuration */
    1,          /* index of this configuration */
    0,          /* configuration name string index */
#if USB_CFG_IS_SELF_POWERED
    USBATTR_SELFPOWER,  /* attributes */
#else
    USBATTR_BUSPOWER,   /* attributes */
#endif
    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units */
/* interface descriptor follows inline: */
    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */
    USBDESCR_INTERFACE, /* descriptor type */
    0,          /* index of this interface */
    0,          /* alternate setting for this interface */
    2,   /* endpoints excl 0: number of endpoint descriptors to follow */
    USB_CFG_INTERFACE_CLASS,
    USB_CFG_INTERFACE_SUBCLASS,
    USB_CFG_INTERFACE_PROTOCOL,
    0,          /* string index for interface */
#if (USB_CFG_DESCR_PROPS_HID & 0xff)    /* HID descriptor */
    9,          /* sizeof(usbDescrHID): length of descriptor in bytes */
    USBDESCR_HID,   /* descriptor type: HID */
    0x01, 0x01, /* BCD representation of HID version */
    0x00,       /* target country code */
    0x01,       /* number of HID Report (or other HID class) Descriptor infos to follow */
    0x22,       /* descriptor type: report */
    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0,  /* total length of report descriptor */
#endif
#if USB_CFG_HAVE_INTRIN_ENDPOINT    /* endpoint descriptor for endpoint 1 */
    7,          /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */
    0x81,       /* IN endpoint number 1 */
    0x03,       /* attrib: Interrupt endpoint */
    8, 0,       /* maximum packet size */
    USB_CFG_INTR_POLL_INTERVAL, /* in ms */
#endif
#if USB_CFG_IMPLEMENT_FN_WRITEOUT  /* endpoint descriptor for endpoint 1 out */
    7,          /* sizeof(usbDescrEndpoint) */
    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */
    0x01,       /* Out endpoint number 1 */
    0x03,       /* attrib: Interrupt endpoint */
    8, 0,       /* maximum packet size */
    USB_CFG_INTR_POLL_INTERVAL+25 /* in ms */
#endif
};


When i place the endpoint descriptors as shown above, I only get the interupt in 1 to work....When I swap them, then only the interupt out 1 will work.

Can anyone see a problem with the above discriptor? The logic I have written must be ok because one or the other will work, but never both.

Also, I've been able to get a Hid report with both 16bit inputs and 16bit outputs. All seems well there, so you can ignor my other post.

Update:

Code: Select all

18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + (USB_CFG_DESCR_PROPS_HID & 0xff), 


It appears that I needed to update this sum of this value. I just added the size of the extra endpoint to this line and it all works :)

Code: Select all

18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + 7 * USB_CFG_IMPLEMENT_FN_WRITEOUT + (USB_CFG_DESCR_PROPS_HID & 0xff)

Posted: Tue Dec 04, 2007 10:11 am
by christian
Please see my reply in the other thread: http://forums.obdev.at/viewtopic.php?t=1002 . When you move the descriptor to your own code, you can remove all the #ifs and many definitions because the values are known. That makes it MUCH easier to see the structure and find potential bugs.