cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f207vc usb bulk tramission , only 64bytes can be sent?

easylwl
Associate II
Posted on April 10, 2013 at 09:55

I use stm32f207  USB device examples  VCP deom .I change the USB CDC device Configuration Descriptor like this

/*Configuration Descriptor*/

  0x09,   /* bLength: Configuration Descriptor size */

  USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */

  USB_CDC_CONFIG_DESC_SIZ,                /* wTotalLength:no of returned bytes */

  0x00,

  0x01,   /* bNumInterfaces: 1 interface */

  0x01,   /* bConfigurationValue: Configuration value */

  0x00,   /* iConfiguration: Index of string descriptor describing the configuration */

  0xC0,   /* bmAttributes: self powered */

  250,   /* MaxPower 2 mA */

  

  /*Data class interface descriptor*/

  0x09,   /* bLength: Endpoint Descriptor size */

  USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */

  0x00,   /* bInterfaceNumber: Number of Interface */

  0x00,   /* bAlternateSetting: Alternate setting */

  0x02,   /* bNumEndpoints: Two endpoints used */

  0xff,   /* bInterfaceClass: USER */

  0x00,   /* bInterfaceSubClass: */

  0x00,   /* bInterfaceProtocol: */

  0x00,   /* iInterface: */

 

  //18

 

  /*Endpoint OUT Descriptor*/

  0x07,   /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */

  0x03,                        /* bEndpointAddress */

  0x02,                              /* bmAttributes: Bulk */

  0x40,  /* wMaxPacketSize: */

  0,

  0,                              /* bInterval: ignore for Bulk transfer */

  //25

  /*Endpoint IN Descriptor*/

  0x07,   /* bLength: Endpoint Descriptor size */

  USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */

  0x82,                         /* bEndpointAddress */

  0x02,                              /* bmAttributes: Bulk */

  0x40,  /* wMaxPacketSize: */

  0,

  0                               /* bInterval: ignore for Bulk transfer */

  //32

and I send function :

uint16_t VCP_DataTx (uint8_t* Buf, uint32_t Len)

{

uint8_t i;

for (i=0;i<64;i++)      //this number must be

multiple 

of  64 ,anyother number wil not be send out.

        {

        APP_Rx_Buffer[APP_Rx_ptr_in] = g_ucaHeartbeat;

        APP_Rx_ptr_in++;

         

          /* To avoid buffer overflow */

          if(APP_Rx_ptr_in == APP_RX_DATA_SIZE)

          {

            APP_Rx_ptr_in = 0;

          }  

        }

return USBD_OK;

}

#stm32f207-cdc-virtualcom-usb
2 REPLIES 2
dthedens23
Associate II
Posted on April 10, 2013 at 19:11

Full speed bulk endpoint limit is 64 bytes.  For performance, you want to send full packets.

if you need more granularity, consider another type of end point.

easylwl
Associate II
Posted on April 15, 2013 at 11:13

But when I send 8 bytes ,by calling DCD_EP_Tx(len=8) ,it can not be sent successful?

what wrong with me?