Permalink
Browse files

Add option to tristate/HiZ the SWD pins after we're finished.

  • Loading branch information...
1 parent 38ae077 commit f202d95823b9951323b21f32aaa0a2cbeef92a3a @hugovincent hugovincent committed Jul 8, 2011
Showing with 9 additions and 0 deletions.
  1. +8 −0 PirateSWD.py
  2. +1 −0 flashEFM32.py
View
@@ -25,6 +25,14 @@ def resetBP (self, vreg = False):
self.port.write(bytearray([0x63,0x88])) # set speed to 400 kHz, enable output pins
self.clear(9999)
+ def tristatePins(self):
+ self.clear(9999)
+ self.port.write(bytearray([0x00])) # exit RAW mode, unfortunately this kills power and generally resets a bunch of stuff
+ if self.port.read(5) != "BBIO1":
+ raise SWDInitError("unexpected response from bus pirate")
+ self.port.write(bytearray([0xc0, 0x5f])) # re-enable power, disable all output pins
+ self.clear(9999)
+
# this is the fastest port-clearing scheme I could devise
def clear (self, more = 0):
vals = self.port.read(self.expected + more)
View
@@ -54,6 +54,7 @@ def main():
print "Resetting"
efm32.sysReset()
+ busPirate.tristatePins()
if __name__ == "__main__":
main()

0 comments on commit f202d95

Please sign in to comment.