Author Topic: bulk transfers  (Read 120 times)

ADB

  • Member
  • ***
  • Posts: 5
bulk transfers
« on: June 15, 2018, 08:41:40 am »
Hi Jan,

I'm trying to implement a bulk transfer of 16 MB of data between a microcontroller and a PC. HID cannot do bulk transfers, so I have to use CDC. I've been able to put together a CDC program on my microcontroller which enumerates as CDC, HID and VCOM.

I've been able to do interrupt transfers with your winusb_cs_31 program but not bulk transfers. For this my microcontroller was writing to the HID endpoint. To get a bulk transfer up and going, I take it that my microcontroller needs to write to the CDC endpoint?

Thanks in advance for your advice,

Regards,

Alan

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2703
    • Lakeview Research
Re: bulk transfers
« Reply #1 on: June 15, 2018, 09:21:30 pm »
If the device enumerates as a virtual COM Port, access it using the SerialPort class (assuming .NET).

If you want to use WinUSB,  don't use descriptors that define the device (or interface) as a member of a defined USB device class.

The WinUSB and Serial Port pages on my website, janaxelson.com, have more information and example code.

Feel free to post again if you have further questions.
Hi Jan,

I'm trying to implement a bulk transfer of 16 MB of data between a microcontroller and a PC. HID cannot do bulk transfers, so I have to use CDC. I've been able to put together a CDC program on my microcontroller which enumerates as CDC, HID and VCOM.

I've been able to do interrupt transfers with your winusb_cs_31 program but not bulk transfers. For this my microcontroller was writing to the HID endpoint. To get a bulk transfer up and going, I take it that my microcontroller needs to write to the CDC endpoint?

Thanks in advance for your advice,

Regards,

Alan

ADB

  • Member
  • ***
  • Posts: 5
Re: bulk transfers
« Reply #2 on: June 18, 2018, 03:55:28 am »
Hi Jan,

Thank you for getting back to me. What are the advantages of bulk over interrupt transfers? I read somewhere that there is the same amount of error checking in both.

What is the best VCOM of WINUSB for the bulk transfer?

I've attached my USB descriptor C file. If I understand your last post correctly, if I want to use WINUSB for bulk transfer, I need to remove the CIC, DIC and IAD descriptors?

Thanks again,

Alan

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2703
    • Lakeview Research
Re: bulk transfers
« Reply #3 on: June 18, 2018, 08:52:21 am »
Bulk transfers are the fastest on an otherwise idle bus but have no guaranteed timing.

Interrupt transfers have guaranteed maximum latency, or time between transaction attempts.

To access a virtual serial port device, you use the SerialPort class (assuming .NET). To access a WinUSB device, you use the WinUSB API.

The host system uses the descriptors to decide what driver to assign to a device. If the descriptors define the device (or interface) as HID, the host will assign the HID driver. For WinUSB, use Microsoft OS descriptors.

See my Serial Port and WinUSB pages at janaxelson.com for more information.

ADB

  • Member
  • ***
  • Posts: 5
Re: bulk transfers
« Reply #4 on: June 18, 2018, 04:01:11 pm »
Thanks Jan. I will read up on Microsoft OS descriptors.

Regards,

Alan

ADB

  • Member
  • ***
  • Posts: 5
Re: bulk transfers
« Reply #5 on: June 22, 2018, 08:11:42 am »
Hi Jan,

I've been able to enumerate my microcontroller as a WCID device with Microsoft 1.0 descriptors and have been able to do bulk transfers with a PC application running a libusb driver.

Since the device descriptor side of things has now been stripped down, I'm not doing HID or CDC. What is the name of what I'm doing?

With my test program, I have sent 16MB of data in 512 byte packets (High Speed). According to my protocol analyser I'm doing about 60 Mb/s (7.5 MB/s). This seems quite far off the 480 Mb/s of the standard. Why is this the case?

Thanks again,

Alan

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 2703
    • Lakeview Research
Re: bulk transfers
« Reply #6 on: June 24, 2018, 09:00:43 pm »
The name of what you are doing is "vendor-defined class."

From USB Complete, 5th Ed:

"In theory, at high speed on an otherwise idle bus, up to thirteen 512-byte bulk transfers can transfer
up to 6,656 data bytes per microframe, for a data rate of 53.248 MB/s. Real-world performance varies with the host-controller hardware and driver and the host architecture, including latencies when accessing system memory. Some high-speed hosts can transfer bulk data at around 50 MB/s."

A single, large transfer with multiple transactions (data packets) will transmit a block of data faster than multiple transfers, each transmitting a single data packet. Other traffic on the bus will also slow the transfer rate.

ADB

  • Member
  • ***
  • Posts: 5
Re: bulk transfers
« Reply #7 on: June 25, 2018, 05:10:36 am »
Hi Jan,

Thanks for your comments on this.

Regards,

Alan