We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello.
First of all, I want to say that I don't know if this is the right forum to do the question, but after days searching in the web, reading papers and changing the code, I'll try to explain my dude here.
I'm programming a device, with a USB communication in order to communicate with PC. I use an ATmega1281 with MAX3420 as USB controller. I get the windows recognize the device as COM Port...but I can only send or only receive data. If I try to set number of endpoints to 2 in the Data Class Interface descriptor, windows return an error (code 10), and can't initialize the device. Here I show the configuration descriptors I use. Thank you for your time in advance! and regards.
const unsigned char CD[]= // CONFIGURATION Descriptor { 0x09,// bLength 0x02,// bDescriptorType = Config 67,0x00,// wTotalLength(L/H) 0x02,// bNumInterfaces = 2 0x01,// bConfigValue 0x00,// iConfiguration 0xC0,// bmAttributes. b7=1 0x32,// MaxPower is 100 ma
// INTERFACE Descriptor 0x09,// length = 9 0x04,// type = IF 0x00,// InterFace Number = 0 0x00,// bAlternate Setting 0x01,// bNum Endpoints = 1 IN 0x02,// bInterfaceClass = 2 Communication 0x02,// bInterfaceSubClass = 2 0x01,// bInterfaceProtocol =1 (SubClass ACM,V.25ter) 0x00,// iInterface // Header Functional Descriptor (marks beginning of the concatenated set of Functional Descriptors) 0x05,// bFunctionLength, Descriptor size in bytes 0x24,// bDescriptorType, CS_INTERFACE 0x00,// bDescriptorSubtype, Header Functional Descriptor 0x10,0x01,// bcdCDC
// Abstract Control Management Functional Descriptor 0x04,// bDescriptorLength, Descriptor size in bytes 0x24,// bDescriptorType, CS_INTERFACE 0x02,// bDescriptorSubtype, ACM Functional Descriptor 0x06,// bmCapabilities
// Union Functional Descriptor 0x05,// bFunctionLength, Descriptor size in bytes 0x24,// bDescriptorType, CS_INTERFACE 0x06,// bDescriptorSubtype, Union Functional Descriptor 0x00,// bMasterInterface 0x01,// bSlaveInterface0
// Call Management Functional Descriptor 0x05,// bFunctionLength, Descriptor size in bytes 0x24,// bDescriptorType, CS_INTERFACE 0x01,// bDescriptorSubtype, Call Management Funct.Desc. 0x03,// bmCapabilities 0x01,// bDataInterface
// Endpoint Descriptor EP3-IN 0x07,// bLength 0x05,// bDescriptorType (Endpoint) 0x83,// bEndpointAddress (EP3 IN) 0x03,// bmAttributes (interrupt = 3) 0x40,0x00,// wMaxPacketSize 0x02,// bInterval, Maximum latency
// INTERFACE Descriptor 0x09,// length = 9 0x04,// type = IF 0x01,// InterFace Number = 1 0x00,// bAlternate Setting 0x01,// bNum Endpoints = 2 (IN&OUT) 0x0A,// bInterfaceClass = A (Data) 0x00,0x00,// bInterfaceSubClass, bInterfaceProtocol 0x00,// iInterface
// Endpoint Descriptor EP2-IN 0x07,// bLength 0x05,// bDescriptorType (Endpoint) 0x82,// bEndpointAddress (EP2-IN) 0x02,// bmAttributes (bulk = 2) 0x40,0x00,// wMaxPacketSize (64[0x40]) 0x00,// bInterval
// Endpoint Descriptor EP1-OUT 0x07,// bLength 0x05,// bDescriptorType (Endpoint) 0x01,// bEndpointAddress (EP1-OUT) 0x02,// bmAttributes (bulk = 2) 0x40,0x00, // wMaxPacketSize (64[0x40]) 0x00,// bInterval };
I've seen two types of buffer naming on CDC implementations on device side.
a) Named after the connection bulk OUT EP ---> TX buffer ---> UART TX bulk IN EP <--- RX buffer <--- UART RX
b) Named after the function on the device bulk OUT EP ---> RX buffer (receive data) bulk IN EP <--- TX buffer (send data)
Then, until you specify the example you are working on, our discussion will go out of focus.
Tsuneo