summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorja Martinez2016-11-18 03:07:03 -0600
committerBorja Martinez2016-11-18 03:07:03 -0600
commit5273deab0d21fa5bec49f0b966b7aee001b62011 (patch)
treeb90459207d952d4eeeea2d4046e9208dd5d95c13
parentf611ddb66e2c029cf20b6dc1d2c6e0b827a01637 (diff)
downloadi3-mote-5273deab0d21fa5bec49f0b966b7aee001b62011.tar.gz
i3-mote-5273deab0d21fa5bec49f0b966b7aee001b62011.tar.xz
i3-mote-5273deab0d21fa5bec49f0b966b7aee001b62011.zip
Added MSP432 BSL script
-rwxr-xr-xBasic-Test-Package/BSL/MSP432/msp432-bsl-start.py76
1 files changed, 76 insertions, 0 deletions
diff --git a/Basic-Test-Package/BSL/MSP432/msp432-bsl-start.py b/Basic-Test-Package/BSL/MSP432/msp432-bsl-start.py
new file mode 100755
index 0000000..75df7f8
--- /dev/null
+++ b/Basic-Test-Package/BSL/MSP432/msp432-bsl-start.py
@@ -0,0 +1,76 @@
1#!/usr/bin/python
2
3import serial, time
4
5
6#initialization and open the port
7
8#possible timeout values:
9# 1. None: wait forever, block call
10# 2. 0: non-blocking mode, return immediately
11# 3. x, x is bigger than 0, float allowed, timeout block call
12ser = serial.Serial()
13ser.port = "/dev/ttyUSB0" # Linux
14#ser.port = "COM1" # Windows
15ser.baudrate = 115200
16ser.bytesize = serial.EIGHTBITS #number of bits per bytes
17ser.parity = serial.PARITY_NONE #set parity check: no parity
18ser.stopbits = serial.STOPBITS_ONE #number of stop bits
19#ser.timeout = None #block read
20#ser.timeout = 1 #non-block read
21ser.timeout = 2 #timeout block read
22ser.xonxoff = False #disable software flow control
23ser.rtscts = False #disable hardware (RTS/CTS) flow control
24ser.dsrdtr = False #disable hardware (DSR/DTR) flow control
25ser.writeTimeout = 1 #timeout for write
26ser.readTimeout = 1 #timeout for read
27
28try:
29 ser.open()
30
31except Exception as e:
32 print ("error open serial port: " + str(e))
33 exit(1)
34
35if ser.isOpen():
36
37 try:
38
39 #if inverted:
40 set_bootloader_pin = ser.setRTS
41 set_reset_pin = ser.setDTR
42
43 #else:
44 #set_bootloader_pin = ser.setDTR
45 #set_reset_pin = ser.setRTS
46
47 print("Forze BL[RTS] to Idle State (high)")
48 print("Set RST[DTS] active (low) ")
49
50 set_bootloader_pin(0)
51 set_reset_pin(1)
52 time.sleep(0.2)
53
54 # Start Sequence: High to Low
55 set_bootloader_pin(1)
56 time.sleep(0.001)
57
58 # RST Low to High
59 set_reset_pin(0)
60 # RST High to Low
61 set_reset_pin(1)
62 # RST Low to High Again
63 set_reset_pin(0)
64
65 # Restore Default State
66 time.sleep(0.3) # Time to enter BSL
67
68 ser.close()
69
70 except Exception as e1:
71 print ("error communicating...: " + str(e1))
72 exit(1)
73
74else:
75 print ("cannot open serial port ")
76 exit(1)