This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

sending data to TIVA C (TM4C123GH6PM) usb stick using the python library PyUSB.

Other Parts Discussed in Thread: TM4C123GH6PM

I am trying to send data to TIVA C (TM4C123GH6PM) usb stick using the python library PyUSB. The code I am using is the following:

import usb.core
import usb.util
import sys
import time
import os

# Check for the proper input format
if len(sys.argv) != 3 :
print "Error : The correct format is ./scan.py <input file> <output file>"
sys.exit(1)
else:
input_file = open(sys.argv[1],"r")
output_file = open(sys.argv[2],"w")
output_file.write("Expected Output Received Output Remarks\n")
output_file.write("============================================\n")

#----------------- Connecting to device -------------------------------
print "Initiating connection with the device.."

# find our device

dev = usb.core.find(idVendor=0x1cbe, idProduct = 0x00fd)
# was it found?
if dev is None:
raise ValueError('Error : Device not found')

print "Device found.."
# set the active configuration. With no arguments, the first configuration will be the active one
print "Please wait, Setting it's configuration... "
print "Done !"
print "Claiming interface.."
# Note: The code below is for interface 0, check what interface is used

dev.set_configuration(1)
usb.util.claim_interface(dev, 0)
print "Connection established.\n"

line_num = 0
#----------------- Read the input file and send it -------------------------------
for comm in input_file.readlines():
line_num += 1
comm = comm.replace('\n','')

#Display the command on screen
print "\n#------ Command - ",line_num,":",comm,"------#\n"
command = comm.split(' ')

#Check for the command
if command[0] == "SDR":
print"Sending ","in_pins","bit input data ","data_in"

for single in list(command):
dev.write(0x02,single,0x02)
time.sleep(1)

print "Successfully entered the input.."
inn = dev.read(0x83,0x0040,15)

input_file.close()

output_file.close(

)

input.txt file is in the format : SDR 2 TDI(2) 8 TDO(00) MASK(FF)

dev.write is working but dev.read is not working.End point address in dev.write I am taking is 0x02 which should not work ar it is out epaddress and dev.read is giving above error whatever epaddress I use. Also why there is no bEndpoint address of out of interrupt type ep (there exists only in epaddress 0x81 ).