Hello everyone.
This year my project will be to program an 8051 compatible micro-controller, the DS89C450.
I have already built the circuit and I think it's working properly.
Now I need to communicate with it. I'm using a 5V FTDI to convert an RS232+MAX232 into an USB plug.
I know I need a set of instructions to configure the connection and I found a python script to do that job. It's here:
When I connect FTDI to PC, my udevamd monitor says:
But when I try to run the script with the file .ihx (Intel hex format for the C code I'm trying to load) to the uC, it says me that it cannot be done because the port is already open, therefore cannot be used!
Note: I've installed a package named [TT]pyserial[/TT] so that the python script would run!
Anyone can help me???
This year my project will be to program an 8051 compatible micro-controller, the DS89C450.
I have already built the circuit and I think it's working properly.
Now I need to communicate with it. I'm using a 5V FTDI to convert an RS232+MAX232 into an USB plug.
I know I need a set of instructions to configure the connection and I found a python script to do that job. It's here:
C:
################################
#DS89C430/DS89C450 ROMLOADER #
#by Vinod.S #
################################
import serial,time,sys,os
os.system("clear")
if not sys.argv[1:]:
print "hex file not specified in command line argument\n\n"print "usage:\npython romloader.py filename.ihx\n\n"print "example:\n python romloader.py ledblink.ihx\n\n"sys.exit(0)
ser = serial.Serial("/dev/ttyUSB0",57600)
ser.timeout = 0.3
try:
ser.open()ser.setDTR(1)
except Exception,e:
print "error open serial port: " + str(e)exit()
if ser.isOpen():
try:ser.flushInput()ser.flushOutput()ser.write("\x0D")time.sleep(0.1)recbuffer = ser.read(80)list = recbuffer.split(" ")if 'LOADER' in recbuffer:
print "CONNECTED TO LOADER SUCCESSFULLY"
print recbuffer
else:
print "CONNECTION ERROR"
ser.setDTR(0)
ser.close()
sys.exit(0)
ser.write("K\x0D")
time.sleep(0.1)
ser.write("L\x0D")
f=open(sys.argv[1],"rU")
hexcontent = f.read()
f.close()
ser.write(hexcontent+"\x0D")
k = ser.read(200)
print k
ser.setDTR(0)
ser.close()
except Exception, e1:
print "error communicating...: " + str(e1)
else:
print "cannot open serial port "
When I connect FTDI to PC, my udevamd monitor says:
KERNEL[77368.473064] add /devices/pci0000:00/0000:00:14.0/usb3/3-1 (usb)
KERNEL[77368.473166] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0 (usb)
KERNEL[77368.473760] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0 (usb-serial)
KERNEL[77368.473888] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
UDEV [77368.513321] add /devices/pci0000:00/0000:00:14.0/usb3/3-1 (usb)
UDEV [77369.520437] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0 (usb)
UDEV [77369.520883] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0 (usb-serial)
UDEV [77369.522687] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
KERNEL[77368.473166] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0 (usb)
KERNEL[77368.473760] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0 (usb-serial)
KERNEL[77368.473888] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
UDEV [77368.513321] add /devices/pci0000:00/0000:00:14.0/usb3/3-1 (usb)
UDEV [77369.520437] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0 (usb)
UDEV [77369.520883] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0 (usb-serial)
UDEV [77369.522687] add /devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0 (tty)
But when I try to run the script with the file .ihx (Intel hex format for the C code I'm trying to load) to the uC, it says me that it cannot be done because the port is already open, therefore cannot be used!
Note: I've installed a package named [TT]pyserial[/TT] so that the python script would run!
Anyone can help me???