From: Prince A. RAMAHEFA-A. <pri...@gm...> - 2012-05-29 15:02:20
|
> That is not true for bulk mode. You should be able to ac> hieve > 2Mbit/s using bulk transfer. In fact, my project consist in sending digital value of a sampled analog signal (sample rate = 160kHz, 16bits ADC) to a PC via USB. Can I reach a 3Mbits/s data rate (useful data) with bulk transfert ? if no, How can I do as a transfert with PyUSB ? And if I can do this, can you give a sample code in Python (PyUSB) if I want to read a data without interruption. Otherwise, I've tested this code to determine the time that 1000*64 bytes to be transmitted: import time import usb.util import usb.backend import os import sys from usb import * import ctypes from ctypes import c_ubyte import time alternate_setting = c_ubyte(0) ep_write=0x01 ep_read = 0x81 buffer_size = 64 #buffer_size = 512 # find our device dev = usb.core.find(idVendor=0x04D8, idProduct=0x0204) # was it found? if dev is None: raise ValueError('Device not found') # set the active configuration. With no arguments, the first # configuration will be the active one dev.set_configuration() # get an endpoint instance cfg = dev.get_active_configuration() i = 0 d1 = time.time() N = 1000 while i<N: data = dev.read(ep_read, buffer_size, 0, timeout = None) i = i+1 d2 = time.time() print 'time ',d2-d1, 'for', N*buffer_size, 'so', (N*buffer_size)/(d2-d1) And I have this before execution : ************* time 1.04299998283 for 64000 so 61361.4583445 so the maximum data rate is around 64kByte/s for Bulk So, I can't reach 3Mbits/s. isn't it ? Thank you very much. ---------------------- Arnaud |