This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB CDC Host

Hi !

I have to implement an USB CDC Host driver for STM32F4 controller.
Has anyone an idea/example how to do that. I only found examples for CDC Device.

Thanks

Marc

Parents
  • When I attach the CDC device to my CDC host and I put a breakpoint at the following function the value of
    pphost->device_prop.Itf_Desc[0].bInterfaceClass is 0xFF but it should be 0x02 for CDC_CLASS

    static USBH_Status USBH_ClassDrv_InterfaceInit( USB_OTG_CORE_HANDLE *pdev, void *phost )
    {
      USBH_HOST *pphost = phost;
    
    
      // check interface/endpoint descriptors, if the target interface is supported or not
        pphost->device_prop.Itf_Desc[0].bInterfaceClass
        pphost->device_prop.Itf_Desc[0].bInterfaceProtocol
        pphost->device_prop.Ep_Desc[0][0].bEndpointAddress
    
    

    When I attach the CDC device to PC I get two virtual COM-Ports which I can use with Terminal.

Reply
  • When I attach the CDC device to my CDC host and I put a breakpoint at the following function the value of
    pphost->device_prop.Itf_Desc[0].bInterfaceClass is 0xFF but it should be 0x02 for CDC_CLASS

    static USBH_Status USBH_ClassDrv_InterfaceInit( USB_OTG_CORE_HANDLE *pdev, void *phost )
    {
      USBH_HOST *pphost = phost;
    
    
      // check interface/endpoint descriptors, if the target interface is supported or not
        pphost->device_prop.Itf_Desc[0].bInterfaceClass
        pphost->device_prop.Itf_Desc[0].bInterfaceProtocol
        pphost->device_prop.Ep_Desc[0][0].bEndpointAddress
    
    

    When I attach the CDC device to PC I get two virtual COM-Ports which I can use with Terminal.

Children
  • > When I attach the CDC device to PC I get two virtual COM-Ports which I can use with Terminal.

    For confirmation, did you read out the descriptors of the target device on a PC?
    Virtual COM ports may derive from a vendor specific device using a custom PC driver. For example, FTDI and SiLabs apply vendor specific devices for their USB-UART chips.

    UVCView is a handy utility to see USB descriptors on PC.
    (Maybe, USBView can't display such a complicated descriptor set by its bug)
    I attached UVCView to this post.
    " href= "http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=11800"> www.microsoft.com/.../details.aspx

    Please post the descriptors of the target device, to make our discussion forward ;-)

    Tsuneo

  • The output of UVCView shows:

    [Port3]  :  USB-Verbundgerät
    
              ---===>Device Information<===---
    English product name: "Motorola Tetra Radio"
    
    ConnectionStatus:
    Current Config Value:              0x01  -> Device Bus Speed: High
    Device Address:                    0x01
    Open Pipes:                           4
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x81  -> Direction: IN - EndpointID: 1
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x01  -> Direction: OUT - EndpointID: 1
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x82  -> Direction: IN - EndpointID: 2
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x02  -> Direction: OUT - EndpointID: 2
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Device Descriptor<===
    bLength:                           0x12
    bDescriptorType:                   0x01
    bcdUSB:                          0x0200
    bDeviceClass:                      0x00  -> This is an Interface Class Defined Device
    bDeviceSubClass:                   0x00
    bDeviceProtocol:                   0x00
    bMaxPacketSize0:                   0x40 = (64) Bytes
    idVendor:                        0x0CAD = Motorola GEMS
    idProduct:                       0x9011
    bcdDevice:                       0x2416
    iManufacturer:                     0x01
         English (United States)  "Motorola"
    iProduct:                          0x02
         English (United States)  "Motorola Tetra Radio"
    iSerialNumber:                     0x00
    bNumConfigurations:                0x01
    
              ===>Configuration Descriptor<===
    bLength:                           0x09
    bDescriptorType:                   0x02
    wTotalLength:                    0x0037  -> Validated
    bNumInterfaces:                    0x02
    bConfigurationValue:               0x01
    iConfiguration:                    0x03
         English (United States)  "Generic Serial config"
    bmAttributes:                      0xC0  -> Bus Powered
    MaxPower:                          0x00 =   0 mA
    
              ===>Interface Descriptor<===
    bLength:                           0x09
    bDescriptorType:                   0x04
    bInterfaceNumber:                  0x00
    bAlternateSetting:                 0x00
    bNumEndpoints:                     0x02
    bInterfaceClass:                   0xFF  -> Vendor Specific Device
    bInterfaceSubClass:                0x00
    *!*CAUTION:    This appears to be an invalid bInterfaceSubClass
    bInterfaceProtocol:                0x00
    iInterface:                        0x00
    *!*CAUTION:  0xFF is a prerelease Class ID
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x81  -> Direction: IN - EndpointID: 1
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x01  -> Direction: OUT - EndpointID: 1
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Interface Descriptor<===
    bLength:                           0x09
    bDescriptorType:                   0x04
    bInterfaceNumber:                  0x01
    bAlternateSetting:                 0x00
    bNumEndpoints:                     0x02
    bInterfaceClass:                   0xFF  -> Vendor Specific Device
    bInterfaceSubClass:                0x00
    *!*CAUTION:    This appears to be an invalid bInterfaceSubClass
    bInterfaceProtocol:                0x00
    iInterface:                        0x00
    *!*CAUTION:  0xFF is a prerelease Class ID
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x82  -> Direction: IN - EndpointID: 2
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
              ===>Endpoint Descriptor<===
    bLength:                           0x07
    bDescriptorType:                   0x05
    bEndpointAddress:                  0x02  -> Direction: OUT - EndpointID: 2
    bmAttributes:                      0x02  -> Bulk Transfer Type
    wMaxPacketSize:                  0x0200 = 0x200 max bytes
    bInterval:                         0x00
    
    

    The device actually sends 0xFF for InterfaceClass. I would expect 0x02 for CDC.

    Marc

  • Surely, the device has two interfaces (composite device). Both of interfaces belong to vendor specific class (bInterfaceClass: 0xFF).

    The Vendor ID (VID: idVendor) shows it's a Motorola device.
    Is it an Android phone or pad?

    Android phone swaps its USB interface, when USB tethering is enabled on Setting.
    RNDIS (derivative of CDC) interface appears.

    Tsuneo

  • Hi, Marc!

    I wolud like to know if you have figured out some way to develop your CDC USB host driver;

    What did you do? Have you edited the USB MSD's files to adapt to a CDC like Tsuneo did recommend?

    Thank you in advance;

    Marcel.