Author Topic: Multiple packet transfer  (Read 7938 times)

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Multiple packet transfer
« on: October 06, 2014, 01:56:50 am »
Hi all,
I've been working on xmc4500 board to implement vcom port using usb cdc class.my question is how many bytes are trasmitted between two start of frame packets.Regarding xmc datasheet there is a facility of multiple packet transfer.so i tested by sending morethan 500 bytes for every 10ms.
but i'm not sure how to figure out  how many bytes are transmitting between 2 SOF's. Do anyone have experience regarding this.
Thanks,
Maheshkar

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Multiple packet transfer
« Reply #1 on: October 06, 2014, 02:29:50 am »
That depends on the bus speed (full, low, high, super), transfer type (bulk, interrupt, control, isochronous), the host controller and the host driver.

As you're using CDC, I'll assume bulk. Then it depends on how loaded the bus is, bulk bandwidth is shared and the lowest priority of all transfer types. If the bus is lightly loaded (no other high bandwidth devices), then it depends on the host controller. The theoretical maximum is 19 (64 byte) packets for full speed, and 13 (512 byte) packets for high speed. Some host controllers can only manage 13 full speed, or 7 high speed packets.

The host driver used can also make things slower than that. A CDC driver may not be expecting to move that many bytes, 240kb/s is only 30 bytes a frame, that's well within USB capabilities. CDC drivers usually don't stretch the bus' capabilities, your 500bytes in 10ms is only 1 50 byte packet per frame, which should not cause USB any problems.

The time between two start of frames is called a "frame". Its more usual to refer to transfers per frame for this question.

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Re: Multiple packet transfer
« Reply #2 on: October 06, 2014, 02:51:53 am »
Hi sir,
Thanks for ur response.
I'm using bulk endpoint with full speed device.So,Max packet size is 64bytes which means at any time we can transmit 64bytes. so,i taken a bulk endpoint size of 1024bytes. my intention is to write/read lessthan 1024bytes within 1millisecond SOF in the form of multiple 64byte packets.SOF is generated automatically for every 1ms.Is it possible to transmit those many bytes in single frame and how to know it.plz help me.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Multiple packet transfer
« Reply #3 on: October 06, 2014, 02:47:38 pm »
What do you mean by a "bulk endpoint size of 1024bytes"?

You already said your packet size is 64 bytes, so I assume you don't mean a 1024 byte packet size, which would be wrong.

Also why are you worrying about frames? As a device (as opposed to a host), frames are irrelevant to bulk, the host will schedule them when it schedules them. The device just has to have the data ready.

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Re: Multiple packet transfer
« Reply #4 on: October 07, 2014, 01:33:31 am »
Hi sir,
Sorry for little clumsyness.
Actually i want to achieve data transfer rate around 4 to 6Mbps(my requirement).So, in multi packet mechanism i read that if to transmit an amount of data let's say 500 to 600 bytes (this mechanism happens by transmitiing multiple 64bytes at a time without any software intervention or any interrupt).In multipacket,after transmission of last packet only we'll get the interrupt (transaction complete interrupt on specific endpoint).
how to check how much data transfer is achieved.i'm sending data using docklight.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Multiple packet transfer
« Reply #5 on: October 07, 2014, 02:00:11 am »
I usually use my bus analyzer. You can see the packets go by and work out the data rate, mine will even do the calculation for you. You can also do it from the host, time a transfer of a known size. Similarly you can do it from the device's firmware, by logging the transfers by whatever mechanism you have.

When you're setting the endpoint size, make sure its a multiple of the packet size, its more efficient that way.

6Mb/s would need 13 transfers per frame. To achieve that you'll need a decent host controller and a decent host driver, as well as being careful to be efficient in the firmware. Any other device on the bus could also prevent you from getting to those speeds. Its easy to make USB slow down to slower than that. Its not terrifically difficult to achieve those speeds, but you have to be careful.

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Re: Multiple packet transfer
« Reply #6 on: October 07, 2014, 07:54:17 am »
we are not having bus analyser tool.without this tool can i test the how many packets are transferred (just tell me any test cases).its very important to me to find out this solution.

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Re: Multiple packet transfer
« Reply #7 on: October 08, 2014, 05:33:52 am »
Hi Barry,
could u give any suggestion to find out data transfer rate.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Multiple packet transfer
« Reply #8 on: October 08, 2014, 10:53:01 am »
Even if you measure the transfer rate on your system, all of the factors Barry mentioned will come into play if you try it on another system. Even if it's the same system, a busy bus will slow the rate.

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Multiple packet transfer
« Reply #9 on: October 08, 2014, 02:02:10 pm »
I also already mentioned the obvious methods. Bus analyzers are pretty handy tools, I wouldn't want to develop USB without one. They start at $400. (Though I'd suggest spending $1200 on a Teledyne/LeCroy/CATC Mercury T-2.)

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Re: Multiple packet transfer
« Reply #10 on: October 09, 2014, 01:05:21 am »
Atleast i want to know how many data packets are transmitted(suggest me any testing case) with in a frame or from one transfer complete interrupt to another interrupt on a particular endpoint.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Multiple packet transfer
« Reply #11 on: October 09, 2014, 02:38:37 pm »
If you're writing the device firmware, add debugging code that records timestamps.

maheshkarrajmanda

  • Member
  • ***
  • Posts: 13
Re: Multiple packet transfer
« Reply #12 on: October 09, 2014, 11:53:29 pm »
i dont know about debugging code.