Hello!
I'm currently trying to implement a simple USB CDC Host. I used the following thread as reference: http://www.keil.com/forum/20569/ by Tsuneo Chinzei! It works well so far, I could enumerate my device and successfully used USBH_BulkSendData() to communicate with the OUT-Endpoint. But when I use the USBH_BulkReceiveData() function the STM32 always goes into an USB-interrupt loop. Do I have to poll (HCD_GetURB_State(pdev , MSC_Machine.hc_num_in) == URB_DONE) first or maybe send an IN-Token first (if yes, which function is that?)?
I found a nice code example for CDC Host here: code.google.com/.../usb_host_cdc.c
Is it possible that I have to use the requests for Set_Line_Coding and Set_Control_Line_State before sending/receiving my bulk packets? If yes, can I send them with USBH_CtlReq() to EP0, right?
What is the Set_Control_Line_State request good for? I found it in the usbcdc11.pdf from usb.org but still don't really know what its purpose is.
I forgot to mention that my device is a CDC ACM (Abstract Control Model) class USB-sensor.
----------------------------------------------------------------------------------------- [Port4] : URG Series USB Device Driver
---===>Device Information<===--- English product name: "URG-Series USB Driver"
ConnectionStatus: Current Config Value: 0x01 -> Device Bus Speed: Full Device Address: 0x01 Open Pipes: 3
===>Endpoint Descriptor<=== bLength: 0x07 bDescriptorType: 0x05 bEndpointAddress: 0x83 -> Direction: IN - EndpointID: 3 bmAttributes: 0x03 -> Interrupt Transfer Type wMaxPacketSize: 0x0010 = 0x10 bytes bInterval: 0x10
===>Endpoint Descriptor<=== bLength: 0x07 bDescriptorType: 0x05 bEndpointAddress: 0x02 -> Direction: OUT - EndpointID: 2 bmAttributes: 0x02 -> Bulk Transfer Type wMaxPacketSize: 0x0040 = 0x40 bytes bInterval: 0x00
===>Endpoint Descriptor<=== bLength: 0x07 bDescriptorType: 0x05 bEndpointAddress: 0x81 -> Direction: IN - EndpointID: 1 bmAttributes: 0x02 -> Bulk Transfer Type wMaxPacketSize: 0x0040 = 0x40 bytes bInterval: 0x00
===>Device Descriptor<=== bLength: 0x12 bDescriptorType: 0x01 bcdUSB: 0x0200 bDeviceClass: 0x02 -> This is a Communication Device bDeviceSubClass: 0x00 bDeviceProtocol: 0x00 bMaxPacketSize0: 0x40 = (64) Bytes idVendor: 0x15D1 = Vendor ID not listed with USB.org as of 03-19-2008 idProduct: 0x0000 bcdDevice: 0x0100 iManufacturer: 0x01 English (United States) "Hokuyo Data Flex for USB" iProduct: 0x02 English (United States) "URG-Series USB Driver" iSerialNumber: 0x00 bNumConfigurations: 0x01
===>Configuration Descriptor<=== bLength: 0x09 bDescriptorType: 0x02 wTotalLength: 0x0043 -> Validated bNumInterfaces: 0x02 bConfigurationValue: 0x01 iConfiguration: 0x00 bmAttributes: 0xA0 -> Bus Powered MaxPower: 0xFA = 500 mA
===>Interface Descriptor<=== bLength: 0x09 bDescriptorType: 0x04 bInterfaceNumber: 0x00 bAlternateSetting: 0x00 bNumEndpoints: 0x01 bInterfaceClass: 0x02 -> This is Communications (CDC Control) USB Device Interface Class bInterfaceSubClass: 0x02 bInterfaceProtocol: 0x01 CAUTION: This may be an invalid bInterfaceProtocol iInterface: 0x00 -> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<=== bLength: 0x05 bDescriptorType: 0x24 05 24 00 10 01 -> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<=== bLength: 0x04 bDescriptorType: 0x24 04 24 02 06 -> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<=== bLength: 0x05 bDescriptorType: 0x24 05 24 06 00 01 -> This is a Communications (CDC Control) USB Device Interface Class
===>Descriptor Hex Dump<=== bLength: 0x05 bDescriptorType: 0x24 05 24 01 03 01
===>Interface Descriptor<=== bLength: 0x09 bDescriptorType: 0x04 bInterfaceNumber: 0x01 bAlternateSetting: 0x00 bNumEndpoints: 0x02 bInterfaceClass: 0x0A -> This is a CDC Data USB Device Interface Class bInterfaceSubClass: 0x00 bInterfaceProtocol: 0x00 CAUTION: This may be an invalid bInterfaceProtocol iInterface: 0x00