• AVR Freaks

Max USB Bulk transfer speed.

Page: < 123 Showing page 3 of 3
Author
tarek_attia
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2010/01/05 06:39:23
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/01/11 03:00:17 (permalink)
0
Hi ,

I'm really frustrated ,, I'm using the CDC_demo_serial as my application requires only the rate I'm achieving in it .

When I send a buffer of only a 64 in a while 1 outside any state machine I'm achieving a rate reaches to 800 KB/S ,however when sending the same buffer inside the state machine I can't send any multiple of 2 packets ,,neither 64 nor 128 ,256,,Only I can send anything but not these numbers of bytes .


What's going wrong with me?,,Or Do I make any mistakes or something like ??


Appreciate your cooperation :) .

Best Regards,

Who he says he can and who he says he can't usually both are right
#41
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/01/14 01:36:25 (permalink)
0
original: tarek_attia

I'm using the CDC_demo_serial as my application requires only the rate I'm achieving in it .

When I send a buffer of only a 64 in a while 1 outside any state machine I'm achieving a rate reaches to 800 KB/S ,however when sending the same buffer inside the state machine I can't send any multiple of 2 packets ,,neither 64 nor 128 ,256,,Only I can send anything but not these numbers of bytes .

Maybe your state machine code doesn't give enough chance for the stack to handle USB communication.

For host --> device communication,
getsUSBUSART() polls the bulk OUT endpoint. When the endpoint receives data, getsUSBUSART() returns the data to the specified buffer. Therefore, your code has to call getsUSBUSART() often to make the process faster.

For device --> host communication,
putUSBUSART(), putsUSBUSART() and putrsUSBUSART() register a buffer or a string for transmission. CDCTxService() does the actual job for the transmission over the bulk IN endpoint. Your code has to call CDCTxService() often.

These stack functions support transfer up to 255 bytes. Then, with these functions, the transfer speed is limited to 255 bytes / ms.

Tsuneo
post edited by chinzei - 2010/01/14 02:53:03
#42
chinzei
Super Member
  • Total Posts : 2250
  • Reward points : 0
  • Joined: 2003/11/07 12:39:02
  • Location: Tokyo, Japan
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/01/14 02:51:45 (permalink)
0
original: stefanopod

But the next call of USBTransferOnePacket on the other buffer doesn't make any use of this preparation and acts as a non pingpong call. So I don't see where this sparing is performed.

At the entry of USBTransferOnePacket(), next BD which is held on the array, pBDTEntryIn[ep] or pBDTEntryOut[ep], is applied. This BD is returned as the current BD by USBTransferOnePacket(). And then, USBTransferOnePacket() switches next BD on the array before it returns.

For usual ping-pong buffer handling, the process order seems to be wrong. USBTransferOnePacket() should return the pointer to the next BD. But for this stack, this order is fine for its primary purpose.

It may sound like weird,
The primary stack support of ping-pong buffer works to cancel the effect of ping-pong buffer for fail safe, when ping-pong is enabled by USB_PING_PONG_MODE on usb_config.h (accidentally).
Even when ping-pong is enabled, just one of two buffer descriptor works at a time. In this way, most of Microchip Device examples work with single buffer without any problem. That is, for the example likes HID, CDC and MSC and others, enabling ping-pong gains no speed performance. Rather, it causes slight performance loss with greater code size.

A customized USBTransferOnePacket_pingpong(), which returns the next BD instead of the current BD, makes your ping-pong code simpler. With this customization, you don't need to trace EVEN and ODD BDs explicitly on your code. This modification is effective for bulk EPs on block transfer with large buffer and for audio isoc EP. In these applications, you don't need to know the transaction completion of the current BD.

Tsuneo
post edited by chinzei - 2010/01/14 04:03:58
#43
tarek_attia
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2010/01/05 06:39:23
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/01/14 05:02:20 (permalink)
0
Hi,

Now I modified the USB stack to transmit more than 255Bytes,however on the host side the rate is still 255kB/S on various frame sizes(512,1024) ,So I think now the host has a limitation ,how can I solve this problem ,I'm using a java program that connects to the target as a serial port .

Is there any Library that eliminates this issue .

I'm still using the CDC-Basic demo application .


Best Regards,


Who he says he can and who he says he can't usually both are right
#44
Sink0
Starting Member
  • Total Posts : 47
  • Reward points : 0
  • Joined: 2010/01/20 18:51:06
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/01/20 19:06:04 (permalink)
0
Hi i have read the whole thread and im kind impressed with the speed you guys achieved. I am working on a project that will use PIC32 as the final MCU but right now i just got PIC18F2550 on hands to run some tests. I have to read 12 8-bits adc channels (maybe 12-bits i don’t know yet) at 10Ksps each whant bring me to something like a USB connection of 180kB/s if i use the 12-bits adc. Right know i just could make HID connection using a CCS compiler and microchip dll at a Vc++ host achieving 12kB/s. I think i got change to bulk but im kind confused. At HID my real limitation is that i dont know why windows just allow me to write to the device every 3ms and not less (it should be 1ms as i settled the polling time). So at bulk transfer how do i request from the device? Or i just dont request i call some function that listen to the USB port and just receive information? And can some one give me any host example of bulk transfer and how to keep filling the buffer at the device? Im just kind confused with bulk transfer and how should i implement it.

Thanks
#45
tarek_attia
New Member
  • Total Posts : 30
  • Reward points : 0
  • Joined: 2010/01/05 06:39:23
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/01/21 02:07:00 (permalink)
0
Hi ,

If you want to look at bulk transfer ,you may start with Microchip examples,like the CDC demo,it uses the bulk transfer ,and this may introduce new concepts to you .


Who he says he can and who he says he can't usually both are right
#46
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/24 07:53:03 (permalink)
0

ORIGINAL: mimemike
Just broke that record!!!
Test 1: 1032.853K Bytes/sec
Test 2: 1024.725K Bytes/sec
Test 3: 1024.187K Bytes/sec
Test 4: 1033.399K Bytes/sec
Test 5: 1024.725K Bytes/sec
I would not want to do more than 1024 bytes per ms (16 Packets) as this leaves room for error corrections.
Also to get this performance it is critical to make sure it is the ONLY device connected to that USB Host controller.


Just another data point for PIC18F87J50 USB PIM, loop back test, using Travis Robinson's libusbdotnet benchmark firmware and host software, a USB hub between the USB PIM (with two other device on the same hub), under Linux Ubuntu 9.10 32bit.

With async and loop back test. The result is also very good. One packet is 64Bytes.
[BENCHMARK RESULTS]
Vid / Pid : 0x04D8 / 0x00xx
Test Mode : Loop
Transfer Type : Async
Priority : AboveNormal
Transfer Size : 4096
Total Packets : 157177
Elapsed Time : 00:19:02.7868640
Bytes per second: 563357.01

Read timeouts : 0
Write timeouts: 0
Short write packets (with bytes < 4096): 0


  USB_Links and libusb
#47
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/24 08:01:57 (permalink)
0
Short test on read only.

[BENCHMARK RESULTS]
Vid / Pid : 0x04D8 / 0x00xx
Test Mode : ReadFromDevice
Transfer Type : Async
Priority : AboveNormal
Transfer Size : 4096
Total Packets : 79308
Elapsed Time : 00:05:18.3706560
Bytes per second: 1020337.65


  USB_Links and libusb
#48
stefanopod
Super Member
  • Total Posts : 1285
  • Reward points : 0
  • Joined: 2007/06/25 02:33:59
  • Location: Bologna,Italy
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/24 10:43:40 (permalink)
0
And how do you know you aren't receiving garbage? It happens (to me) very often.

provando e riprovando
#49
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/24 15:52:59 (permalink)
0
At least the loopback program verifies the data on the host side (write and read back). So the loopback test is accurate.

  USB_Links and libusb
#50
stefanopod
Super Member
  • Total Posts : 1285
  • Reward points : 0
  • Joined: 2007/06/25 02:33:59
  • Location: Bologna,Italy
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/24 22:45:47 (permalink)
0
But you read the data on the fly (a sniffer or something alike) or you store them somewhere? At that speed it couldn't be so easy.

provando e riprovando
#51
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/25 00:00:31 (permalink)
0

  USB_Links and libusb
#52
stefanopod
Super Member
  • Total Posts : 1285
  • Reward points : 0
  • Joined: 2007/06/25 02:33:59
  • Location: Bologna,Italy
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/25 00:10:37 (permalink)
0
Thanks, good idea.
Anyway the question wasn't so smart. A huge array would do the job for storing plenty of data.

provando e riprovando
#53
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/26 07:05:45 (permalink)
0
Short write performance under Ubuntu Linux 9.10 32bit (with a USB hub in between the PC and the PIC18F87J50 USB PIM)

Benchmark Results:

Vid / Pid : 0x04D8 / 0x0053
Test Mode : WriteToDevice
Priority : AboveNormal
Transfer Size : 4096
Driver Mode : MonoLibUsb
Retry Count : 1
Display Refresh : 1000 (ms)
Transfer Timeout: 5000 (ms)
Total Packets : 50093
Elapsed Time : 00:03:22.4211850
Bytes per second: 1,013,633.67

Read timeouts : 0
Write timeouts: 0
Short write packets (with bytes < 4096): 0

  USB_Links and libusb
#54
Kiwi Mike AZ
Super Member
  • Total Posts : 2056
  • Reward points : 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/26 07:18:46 (permalink)
0
That is a very good result from a PIC18!!!!
Not quite, but very close to 1MByte/sec (~989KBytes/sec)
#55
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/03/27 19:59:49 (permalink)
0
Ok, under Arch 32bit Linux (normally a bit faster than Ubuntu, updated to the latest): this time it is a bit faster than 1MiBytes/sec (1048576 Bytes/sec).
http://en.wikipedia.org/wiki/Kibibyte (KiB and MiB)

Benchmark Results:

Vid / Pid : 0x04D8 / 0x0053
Test Mode : WriteToDevice
Priority : AboveNormal
Transfer Size : 4096
Driver Mode : MonoLibUsb
Retry Count : 1
Display Refresh : 1000 (ms)
Transfer Timeout: 5000 (ms)
Total Packets : 570213
Elapsed Time : 00:36:59.6202760
Bytes per second: 1,052,248.65

Read timeouts : 0
Write timeouts: 0
Short write packets (with bytes < 4096): 0

  USB_Links and libusb
#56
brbmart
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2010/02/23 03:55:28
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/05/03 09:37:30 (permalink)
0
Hello

If you use the define

#define ALLOW_MULTIPLE_BULK_TRANSACTIONS_PER_FRAME

in module usb_host.c of USB´microchip stack


will not increase speed of transaction?



i,m testing this funcion to transfer data betwen a pic32 and a usb 3G dongle

In modules that use USB 1.1 (ex: HUAWEI E220 this works very well and transfer a lot of data )

IN Modules USB 2.0 (like ZTE mf620 -- when big data transfer is used the module hangs)


Note : i have to change some definitions in CDC defines because these modules are not 100% CDC specification

















#57
xiaofan
Super Member
  • Total Posts : 6247
  • Reward points : 0
  • Joined: 2005/04/14 07:05:25
  • Location: Singapore
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/05/03 16:18:09 (permalink)
0
Ah, the embedded USB host stack may not be as mature as the PC USB host driver. So its behavior may not be totally the same. But I have limited exposure to the embedded host stack.

  USB_Links and libusb
#58
EricM
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2010/08/03 23:48:21
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/09/14 05:46:34 (permalink)
0
chinzei

jmag99:

Do you think it's possible to extract data at this speed when the PIC is a host? I want to get data off a USB thumbdrive at these speeds.


I didn't check it on PIC, but I believe PIC32 will achieve this speed, which other full-speed host devices do for MSC (Mass Storage Class).

Read: ~800 KBytes/sec
Write: 300 - 400 KBytes/sec

The point to speed up MSC transfer is reading / writing in the FAT cluster size.
Microchip's host MSC implementation reads/ writes in sector (block) size - 512 bytes, to apply the same File System library to PIC18F MSC device. When it is optimized to cluster access for the USB host implementation, the overhead is reduced significantly (in the trade off of RAM requirement Smile ).

"The Default Cluster Size for the NTFS and FAT File Systems"
http://support.microsoft.com/kb/314878/

Tsuneo


I'm trying to modify the default Microchip USB stack to read data off a thumb drive by cluster, instead of sector to increase the overall read speed.  If I try to read data back at any data size other than the sector size (512 bytes), i.e. sector size + 2 (514 bytes), or  sector size * 2 (1024 bytes), I'm getting an MSD_COMMAND_FAILED error. 


Should the thumb drive be able to support a read size other than the sector size? 


Thanks,

Eric


#59
EricM
New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2010/08/03 23:48:21
  • Location: 0
  • Status: offline
RE: Max USB Bulk transfer speed. 2010/09/15 06:38:27 (permalink)
0
EricM

chinzei

jmag99:

Do you think it's possible to extract data at this speed when the PIC is a host? I want to get data off a USB thumbdrive at these speeds.


I didn't check it on PIC, but I believe PIC32 will achieve this speed, which other full-speed host devices do for MSC (Mass Storage Class).

Read: ~800 KBytes/sec
Write: 300 - 400 KBytes/sec

The point to speed up MSC transfer is reading / writing in the FAT cluster size.
Microchip's host MSC implementation reads/ writes in sector (block) size - 512 bytes, to apply the same File System library to PIC18F MSC device. When it is optimized to cluster access for the USB host implementation, the overhead is reduced significantly (in the trade off of RAM requirement Smile ).

"The Default Cluster Size for the NTFS and FAT File Systems"
http://support.microsoft.com/kb/314878/

Tsuneo


I'm trying to modify the default Microchip USB stack to read data off a thumb drive by cluster, instead of sector to increase the overall read speed.  If I try to read data back at any data size other than the sector size (512 bytes), i.e. sector size + 2 (514 bytes), or  sector size * 2 (1024 bytes), I'm getting an MSD_COMMAND_FAILED error. 


Should the thumb drive be able to support a read size other than the sector size? 


Thanks,

Eric
 


User error on my part.  I was not updating the block size in the scsi read command.


Eric



#60
Page: < 123 Showing page 3 of 3
Jump to:
© 2020 APG vNext Commercial Version 4.5