I use python3.7 pyusb1.0.2 and libusb-win32-devel-filter-1.2.6.0 in windows 10.
My FPGA send data to my computer in 10MB/s through USB interface after it received 0x1111. It lasts ten seconds. I found my python program just can receive part of data, about 4MB.
Here is the code:
import usb.core
import usb.util
filename = r'E:\FlowFluorescence\1.mywork\experiment\data\201901290000.txt'
file = open(filename,'wb')
dev = usb.core.find(idVendor=0x04b4, idProduct=0x00f1)
if dev is None:
raise ValueError('Device not found')
dev.set_configuration()
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]
data = b''
dev.write(0x02, b'\x11\x11')
while True:
try:
data = data + dev.read(0x86,512,100)
except usb.core.USBError:
break
file.write(data)
file.close()
How can I improve the pyusb reading speed? I need 10MB/s at least. Hoping for your answer.