aboutsummaryrefslogtreecommitdiffstats
path: root/reset.py
diff options
context:
space:
mode:
authorAJM <poslathian@poslathian.(none)>2010-05-21 20:02:22 -0400
committerAJM <poslathian@poslathian.(none)>2010-05-21 20:02:22 -0400
commit4197727c10c0a6bb01034458754376104c9ec7e8 (patch)
treef6899b2c53e32daeaed630aff81dc035116e512e /reset.py
parentd44f856baffd72742d2287f75df5c2c5dff07a73 (diff)
downloadlibrambutan-4197727c10c0a6bb01034458754376104c9ec7e8.tar.gz
librambutan-4197727c10c0a6bb01034458754376104c9ec7e8.zip
minor mods to adjust the driver number and the vendor product id's (serial port now 1eaf:0004) and fixed a bug in reset.py,
added a no-delay usb serial loop to main.cpp as an example. has no problem at 115200 in minicom!
Diffstat (limited to 'reset.py')
-rwxr-xr-xreset.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/reset.py b/reset.py
index 1a4d515..020d8cb 100755
--- a/reset.py
+++ b/reset.py
@@ -3,16 +3,21 @@
import serial
import time
-ser = serial.Serial('/dev/ttyACM0', baudrate=115200)
-ser.open()
-# pull dtr and rts low
-ser.setRTS(0)
-ser.setDTR(0)
+try:
+ ser = serial.Serial('/dev/ttyACM0', baudrate=115200)
+ ser.open()
-# toggle DTR
-ser.setDTR(1)
+ # pull dtr and rts low
+ ser.setRTS(0)
+ ser.setDTR(0)
-# close
-ser.close()
+ # toggle DTR
+ ser.setDTR(1)
+
+ # close
+ ser.close()
+
+except:
+ print "Failed to open the serial port for reset, perhaps this is your first upload or the board was already in bootloader mode"