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

Programming USB functionality

Hello everybody.

I am new to USB programming, and I am having some trouble with it. I am working with a MCBSTR750 board, and have to program it to communicate with the PC via USB bulk transfers.

In order to do that, I've started editing the USBHID example project. I have changed the descriptors (changed the HID for a custom class, added 2 bulk endpoints, etc), and a little bit of the main code, but it doesn't seem to work at all.

My question is: do I have to change anything of the usbcore.c file? I don't know how much functionality that file provides, but I guess it should be enough to do just transfers over a bulk pipe.

Thank you very much, I hope somebody can help me.

Best regards,

Inigo

  • don't touch usbcore.c
    post your descriptors here so people can analyze what you did. use the proper tags...

  • Hello, and thank you for your reply. The descriptors are as follows (the string descriptor is unchanged so I won't post it)

    /* USB Standard Device Descriptor */
    const BYTE USB_DeviceDescriptor[] = {
    USB_DEVICE_DESC_SIZE, /* bLength */
    USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
    WBVAL(0x0200), /* 2.00 */ /* bcdUSB */
    0x00, /* bDeviceClass */
    0x00, /* DeviceSubClass */
    0x00, /* DeviceProtocol */
    USB_MAX_PACKET0, /* bMaxPacketSize0 */
    WBVAL(0x3333), /* idVendor */
    WBVAL(0x4444), /* idProduct */
    WBVAL(0x0100), /* 1.00 */ /* bcdDevice */
    0x04, /* iManufacturer */
    0x20, /* iProduct */
    0x46, /* iSerialNumber */
    0x01 /* bNumConfigurations */
    };

    /* USB Configuration Descriptor */
    /* All Descriptors (Configuration, Interface, Endpoint, Class, Vendor */
    const BYTE USB_ConfigDescriptor[] = {

    /* Configuration 1 */
    USB_CONFIGUARTION_DESC_SIZE, /* bLength */
    USB_CONFIGURATION_DESCRIPTOR_TYPE, /* DescriptorType */
    WBVAL( /* wTotalLength */
    USB_CONFIGUARTION_DESC_SIZE + USB_INTERFACE_DESC_SIZE + 2*USB_ENDPOINT_DESC_SIZE ),
    0x01, /* bNumInterfaces */
    0x01, /* bConfigurationValue */
    0x00, /* iConfiguration */
    USB_CONFIG_BUS_POWERED, /* bmAttributes */
    USB_CONFIG_POWER_MA(100), /* bMaxPower */

    /* Interface 0, Alternate Setting 0 */
    USB_INTERFACE_DESC_SIZE, /* bLength */
    USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */
    0x00, /* bInterfaceNumber */
    0x00, /* bAlternateSetting */
    0x02, /* bNumEndpoints */
    0xFF, /* bInterfaceClass */
    0x00, /* bInterfaceSubClass */
    0x00, /* bInterfaceProtocol */
    0x60, /* iInterface */

    /* Endpoint, Bulk In */
    USB_ENDPOINT_DESC_SIZE, /* bLength */
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
    USB_ENDPOINT_IN(1), /* bEndpointAddress */
    USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
    WBVAL(0x0010), /* wMaxPacketSize */
    0x00, /* bInterval */

    /* Endpoint, Bulk Out */
    USB_ENDPOINT_DESC_SIZE, /* bLength */
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */
    USB_ENDPOINT_OUT(1), /* bEndpointAddress */
    USB_ENDPOINT_TYPE_BULK, /* bmAttributes */
    WBVAL(0x0010), /* wMaxPacketSize */
    0x00, /* bInterval */

    /* Terminator */
    0 /* bLength */

    };

  • Tamir used three sentences. The third one was "use the proper tags..."