From d79cc6cef65b0c92d1a9f2afd249080b33a43ad3 Mon Sep 17 00:00:00 2001 From: Travis Goodspeed Date: Sat, 2 Dec 2017 22:20:56 -0500 Subject: [PATCH] Setting the baud rate now works. There will be trouble above 38400 baud. --- bin/cc430-bsl.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/cc430-bsl.py b/bin/cc430-bsl.py index 525edb0..54287ed 100755 --- a/bin/cc430-bsl.py +++ b/bin/cc430-bsl.py @@ -85,6 +85,9 @@ class BSL: if len(reply)!=1: print "Error, missing reply."; sys.exit(1); + elif msg[0]=='\x52': + #Change baud rate command has a briefer reply. + pass; elif ord(reply[0])==0x00: #Success eighty=ord(self.serial.read(1)); @@ -200,10 +203,15 @@ class BSL: ratebyte='\x05'; elif rate==115200: ratebyte='\x06'; - resp=self.transact("\x17"+ratebyte); + + + resp=self.transact("\x52"+ratebyte); + #self.serial.write("\x80\x52\x06"); + #print self.serial.read().encode('hex'); #Then we jump the port to the new rate. - self.serial.setBaudrate(rate); + #self.serial.setBaudrate(rate); #Old convention. + self.serial.baudrate=rate; #New convention. MAXLEN=256; #Maximum bytes per read request. def readbulk(self,adr,length):