From: zz <z.z...@gm...> - 2012-05-21 12:46:08
|
Dear sir/madam When I am transmitting data by PyUSB ctrl_transfer () to EZ-USB FX2LP microprocessor, it shows the error "Equipment connected to the system is not functioning". Please help me to solve the problem. The purpose of the program is: to read data form a binary file, then transmit the data to EZ-USB byte by byte, by ctrl_transfer () function. and the code is as following. When running it, it can transmit several bytes of data, but the number of times is random, and than it will shows the error message: usb.core.USBError: [Errno None] libusb0-dll:err [control_msg] sending control message failed, win error: Equipment connected to the system is not functioning *import usb.core* *import binascii* *import usb.util* *import struct* *import os* *from os.path import getsize* * * *#file read* *binfile=open('d:/digitalTest/display.bit', 'rb')* *x=0* *y=os.path.getsize('d:/digitalTest/display.bit')* * * *#device find* *dev = usb.core.find(idVendor=0x04B4, idProduct=0x1004)* *dev.set_configuration()* * * *#write* *while x<=y:* *# binfile.seek(x) * * a=binfile.read(1)* * print 'a',type(a)* * hexstr = binascii.b2a_hex(a)* * print hexstr, type(hexstr),x* * hexnum = int(hexstr,16)* * print hexnum, type(hexnum),x* * dev.ctrl_transfer(0x40, 0xaa, hexnum, 0,"",500)* * x += 1* * * Expecting your response zz * * |