Author Topic: bulk data transfer using WinUSB  (Read 17362 times)

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
bulk data transfer using WinUSB
« on: April 18, 2012, 02:33:47 am »
Hi,

I programmed the microcontroller with the codes pic_usb_device_winusb_jan_axelson_10.zip.

Then I used WinUSB VB to send data to the uController.
(a) If I send data <= 64 bytes, the read back is the same.
(b) If I send data = 128 bytes, the read back got errors.

Send data: Save data as # 0................................................Save data as # 1................................................
1st Read data: Save data as # 1................................................
2nd Read data: Save data as # 1................................................

I thought I should receive these data?
1st Read data: Save data as # 0................................................
2nd Read data: Save data as # 1................................................

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: bulk data transfer using WinUSB
« Reply #1 on: April 18, 2012, 10:18:29 am »
If I recall correctly, the test application loops back data from a single transaction (max endpoint size).

Jan

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
Re: bulk data transfer using WinUSB
« Reply #2 on: April 18, 2012, 10:24:24 am »
If I send 256 bytes of data, error occured.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: bulk data transfer using WinUSB
« Reply #3 on: April 18, 2012, 10:47:03 am »
What is the maximum endpoint size in the endpoint descriptor?

Jan

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
Re: bulk data transfer using WinUSB
« Reply #4 on: April 18, 2012, 10:50:12 am »
unsigned char winusb_bulk_in_buffer[WINUSB_BULK_IN_EP_SIZE];
unsigned char winusb_bulk_out_buffer[WINUSB_BULK_OUT_EP_SIZE];
where WINUSB_BULK_IN_EP_SIZE = WINUSB_BULK_OUT_EP_SIZE = 64

    0x07,                       /*sizeof(USB_EP_DSC)*/
    USB_DESCRIPTOR_ENDPOINT,    //Endpoint Descriptor
    _EP01_OUT,                  //EndpointAddress
    _BULK,                      //Attributes
    0x40, 0x00,                //WINUSB_BULK_OUT_BYTES
    0x00,                       //Interval (unused)
   
    0x07,                       /*sizeof(USB_EP_DSC)*/
    USB_DESCRIPTOR_ENDPOINT,    //Endpoint Descriptor
    _EP01_IN,                   //EndpointAddress
    _BULK,                      //Attributes
    0x40, 0x00,                 //WINUSB_BULK_IN_BYTES
    0x00,                       //Interval (unused)

    /* Endpoint Descriptor */
    0x07,                       /*sizeof(USB_EP_DSC)*/
    USB_DESCRIPTOR_ENDPOINT,    //Endpoint Descriptor
    _EP02_OUT,                  //EndpointAddress
    _INT,                       //Attributes
    0x08, 0x00,              //WINUSB_INTERRUPT_OUT_BYTES
    0x0A,                       //Interval
   
    0x07,                       /*sizeof(USB_EP_DSC)*/
    USB_DESCRIPTOR_ENDPOINT,    //Endpoint Descriptor
    _EP02_IN,                   //EndpointAddress
    _INT,                       //Attributes
    0x08, 0x00,                 //WINUSB_INTERRUPT_IN_BYTES
    0x0A                        //Interval

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: bulk data transfer using WinUSB
« Reply #5 on: April 18, 2012, 11:12:26 am »
Then the test application will loop back up to 64 bytes in bulk transfers.

Jan