From 26c4abcee563fe45a8fe0fb0efa0bfe92925abd5 Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Mon, 8 Feb 2010 23:28:24 +0100 Subject: Shutdown the chip after usage Signed-off-by: Michael Buesch --- chip.py | 3 +++ chip_atmega8dip28.py | 12 ++++++++++++ toprammer | 11 +++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/chip.py b/chip.py index 6f93429..96ded13 100644 --- a/chip.py +++ b/chip.py @@ -61,6 +61,9 @@ class Chip: def initializeChip(self): pass # Override me in the subclass, if required. + def shutdownChip(self): + pass # Override me in the subclass, if required. + def readSignature(self): # Override me in the subclass, if required. raise TOPException("Signature reading not supported on " + self.chipID) diff --git a/chip_atmega8dip28.py b/chip_atmega8dip28.py index 510fa6a..b5f4776 100644 --- a/chip_atmega8dip28.py +++ b/chip_atmega8dip28.py @@ -41,6 +41,7 @@ class ATMega8DIP28(Chip): self.signature = "\x1E\x93\x07" # The expected signature bytes def initializeChip(self): + self.printDebug("Initializing chip") self.top.cmdSetGNDPin(18) self.top.cmdSetVCCXVoltage(5) self.top.cmdFlush() @@ -48,6 +49,17 @@ class ATMega8DIP28(Chip): self.top.cmdFlush() self.top.cmdSetVPPVoltage(12) + def shutdownChip(self): + self.printDebug("Shutdown chip") + self.top.cmdSetVCCXVoltage(5) + self.top.cmdFlush() + self.top.cmdSetVPPVoltage(5) + self.top.cmdFlush() + self.top.cmdLoadVCCXLayout(0) + self.top.cmdLoadVPPLayout(0) + self.top.cmdFlush() + self.top.cmdSetGNDPin(0) + def readSignature(self): self.__checkDUTPresence() self.__initPins() diff --git a/toprammer b/toprammer index 571df51..c70a58f 100755 --- a/toprammer +++ b/toprammer @@ -115,6 +115,9 @@ class TOP: self.__initializeHardware() + def shutdown(self): + self.chip.shutdownChip() + def getForceLevel(self): return self.forceLevel @@ -150,8 +153,7 @@ class TOP: def __initializeHardware(self): "Initialize the hardware" ver = self.cmdRequestVersion() - self.printInfo("Detected a " + ver) - self.printDebug("Initializing hardware...") + self.printInfo("Initializing the '" + ver + "'...") self.send("\x0D") stat = self.cmdReadStatusReg32() @@ -435,7 +437,7 @@ def usage(): print "Optional:" print " -d|--device BUS.DEV Use the programmer at BUS.DEV" print " First found programmer is used, if not given." - print " -V|--verbose LEVEL Set the verbosity level. Default = 2" + print " -V|--verbose LEVEL Set the verbosity level. Default = 1" print " -o|--force LEVEL Set the force level. Default = 0" print " Note that any value greater than 0 may brick devices" print " -Q|--noqueue Disable command queuing. Really slow!" @@ -453,7 +455,7 @@ def fileIn(filename): return file(filename, "rb").read() def main(argv): - opt_verbose = 2 + opt_verbose = 1 opt_forceLevel = 0 opt_bitfile = None opt_device = None @@ -541,6 +543,7 @@ def main(argv): top.writeFuse(fileIn(opt_file)) else: assert(0) + top.shutdown() except (TOPException, BitfileException, IOError), e: print e return 1 -- cgit v1.2.3