Closer to reliable AVR glitching.
[goodfet] / client / GoodFETAVR.py
index 52f82ba..d950b53 100644 (file)
@@ -25,6 +25,7 @@ class GoodFETAVR(GoodFET):
         0x9007: "tiny13",
         0x9108: "tiny25",
         0x930B: "tiny85",
+        0x9206: "tiny45",
         
         0x9001: "S1200",
         
@@ -66,6 +67,21 @@ class GoodFETAVR(GoodFET):
     def start(self):
         """Start the connection."""
         self.writecmd(self.AVRAPP,0x20,0,None);
+    def glitchstart(self):
+        """Glitch into the AVR application."""
+        self.glitchVerb(self.AVRAPP,0x20,None);
+    def glitchstarttime(self):
+        """Measure the timer of the START verb."""
+        return self.glitchTime(self.AVRAPP,0x20,None);
+    def forcestart(self):
+        """Forcibly start a connection."""
+        
+        for i in range(0x880,0xfff):
+            #self.glitchVoltages(0x880, i);
+            self.start();
+            bits=self.lockbits();
+            print "At %04x, Lockbits: %02x" % (i,bits);
+            if(bits==0xFF): return;
     def erase(self):
         """Erase the target chip."""
         self.writecmd(self.AVRAPP,0xF0,0,None);
@@ -73,6 +89,11 @@ class GoodFETAVR(GoodFET):
         """Read the target's lockbits."""
         self.writecmd(self.AVRAPP,0x82,0,None);
         return ord(self.data[0]);
+    def setlockbits(self,bits=0x00):
+        """Read the target's lockbits."""
+        self.writecmd(self.AVRAPP,0x92,1,[bits]);
+        return self.lockbits();
+    
     def eeprompeek(self, adr):
         """Read a byte of the target's EEPROM."""
         self.writecmd(self.AVRAPP,0x81 ,2,
@@ -111,4 +132,4 @@ class GoodFETAVR(GoodFET):
         if device==None:
             device=("0x%04x" % deviceid);
         
-        return device;
+        return "%s %s" % (vendor,device);