X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETAVR.py;h=f48001736214a5efb77e88dcd8cd49d6cbd96abb;hp=df4acf41fda55a5a0dfdb5289cc7f7aa9298bf2c;hb=5d5f93016a718c2cf7230dafbf967adcfe31a3b5;hpb=ece5c9e0f1fa967a118de9e59ce4b2981aaf132f diff --git a/client/GoodFETAVR.py b/client/GoodFETAVR.py index df4acf4..f480017 100644 --- a/client/GoodFETAVR.py +++ b/client/GoodFETAVR.py @@ -11,6 +11,7 @@ from GoodFET import GoodFET; class GoodFETAVR(GoodFET): AVRAPP=0x32; + APP=AVRAPP; AVRVendors={0x1E: "Atmel", 0x00: "Locked", }; @@ -54,7 +55,7 @@ class GoodFETAVR(GoodFET): }; def setup(self): - """Move the FET into the SPI application.""" + """Move the FET into the AVR application.""" self.writecmd(self.AVRAPP,0x10,0,self.data); #SPI/SETUP def trans(self,data): @@ -67,6 +68,15 @@ class GoodFETAVR(GoodFET): def start(self): """Start the connection.""" self.writecmd(self.AVRAPP,0x20,0,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); @@ -74,6 +84,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, @@ -112,4 +127,4 @@ class GoodFETAVR(GoodFET): if device==None: device=("0x%04x" % deviceid); - return device; + return "%s %s" % (vendor,device);