ATMega32u2 isochronous transfers (solved)

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm building off of the project here: http://www.pjrc.com/teensy/usb_k...

I can create new interrupt endpoints, at least IN endpoints, and talk to them (After updating the descriptor, and all). But, I can't seem to set their type to isochronous and continue to talk to them.

When I use libusb-1.0, I get error -84's on all of the isochronous packets.

I've configured my endpoints as follows:

#define ENDPOINT0_SIZE		32

#define HARDWARE_INTERFACE	0
#define HARDWARE_EP_SIZE	8
#define KEYBOARD_BUFFER		EP_DOUBLE_BUFFER

static const uint8_t PROGMEM endpoint_config_table[] = {
	1, EP_TYPE_ISOCHRONOUS_IN,   EP_SIZE(HARDWARE_EP_SIZE) | EP_DOUBLE_BUFFER,
	1, EP_TYPE_ISOCHRONOUS_OUT,  EP_SIZE(HARDWARE_EP_SIZE) | EP_DOUBLE_BUFFER,
	1, EP_TYPE_INTERRUPT_IN,     EP_SIZE(HARDWARE_EP_SIZE) | EP_DOUBLE_BUFFER,
	1, EP_TYPE_INTERRUPT_OUT,    EP_SIZE(HARDWARE_EP_SIZE) | EP_DOUBLE_BUFFER,
};

Just checking, my lsusb -vv looks like this:

Bus 005 Device 046: ID 16c0:047c VOTI 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        32
  idVendor           0x16c0 VOTI
  idProduct          0x047c 
  bcdDevice            1.00
  iManufacturer           1 [Manufacturer here]
  iProduct                2 [Product here]
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      1 
      bInterfaceProtocol      1 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
Device Status:     0x0000
  (Bus Powered)

And, I'm attempting to push data back using the following:

ISR(USB_GEN_vect)
{
       [Various handling code]

       [epts cycles 1, 2, 3, 4]

    if ((intbits & (1<<SOFI)) && usb_configuration  ) {
        UENUM = epts;
        if (UEINTX & (1<<RWAL)) 
        {
            UEDATX = 0x10 + epts;
            UEDATX = 0x20 + epts;
            UEDATX = 0x30 + epts;
            UEDATX = 0x40 + epts;
            UEDATX = 0x50 + epts;
            UEDATX = 0x60 + epts;
            UEDATX = 0x70 + epts;
            UEDATX = 0x80 + epts;
            UEINTX = 0x2A;
       }
    }
}

How do you populate the buffer with an isochronous transfer? Can you use double-buffered transfers? Does anyone have an example of an isochronous transfer on the megaXXuX series?

Thanks
Charles

Last Edited: Mon. Feb 27, 2012 - 02:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Turns out it was relatively simple.

Needed to configure the endpoint table differently..

static const uint8_t PROGMEM endpoint_config_table[] = {
	1, EP_TYPE_ISOCHRONOUS_IN,   EP_SIZE(HARDWARE_EP_SIZE) | EP_SINGLE_BUFFER,
	1, EP_TYPE_ISOCHRONOUS_OUT,  EP_SIZE(HARDWARE_EP_SIZE) | EP_SINGLE_BUFFER,
	1, EP_TYPE_INTERRUPT_IN,     EP_SIZE(HARDWARE_EP_SIZE) | EP_DOUBLE_BUFFER,
	1, EP_TYPE_INTERRUPT_OUT,    EP_SIZE(HARDWARE_EP_SIZE) | EP_DOUBLE_BUFFER,
};