New Chipcon library stuff.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 16 Feb 2010 21:54:42 +0000 (21:54 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Tue, 16 Feb 2010 21:54:42 +0000 (21:54 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@329 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/GoodFET.py
client/GoodFETAVR.py
client/GoodFETCC.py
firmware/apps/chipcon/chipcon.c
firmware/apps/glitch/glitch.c

index 654995b..1eb8575 100755 (executable)
@@ -124,6 +124,12 @@ class GoodFET:
         self.data=[app&0xff, verb&0xFF]+data;
         self.writecmd(self.GLITCHAPP,0x81,len(self.data),self.data);
         #return ord(self.data[0]);
         self.data=[app&0xff, verb&0xFF]+data;
         self.writecmd(self.GLITCHAPP,0x81,len(self.data),self.data);
         #return ord(self.data[0]);
+    def glitchstart(self):
+        """Glitch into the AVR application."""
+        self.glitchVerb(self.APP,0x20,None);
+    def glitchstarttime(self):
+        """Measure the timer of the START verb."""
+        return self.glitchTime(self.APP,0x20,None);
     def glitchTime(self,app,verb,data):
         """Time the execution of a verb."""
         if data==None: data=[];
     def glitchTime(self,app,verb,data):
         """Time the execution of a verb."""
         if data==None: data=[];
index d950b53..c0af361 100644 (file)
@@ -11,6 +11,7 @@ from GoodFET import GoodFET;
 
 class GoodFETAVR(GoodFET):
     AVRAPP=0x32;
 
 class GoodFETAVR(GoodFET):
     AVRAPP=0x32;
+    APP=AVRAPP;
     AVRVendors={0x1E: "Atmel",
                 0x00: "Locked",
                 };
     AVRVendors={0x1E: "Atmel",
                 0x00: "Locked",
                 };
@@ -67,12 +68,6 @@ class GoodFETAVR(GoodFET):
     def start(self):
         """Start the connection."""
         self.writecmd(self.AVRAPP,0x20,0,None);
     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."""
         
     def forcestart(self):
         """Forcibly start a connection."""
         
index b700131..83d0b9f 100644 (file)
@@ -13,6 +13,8 @@ from intelhex import IntelHex;
 
 class GoodFETCC(GoodFET):
     """A GoodFET variant for use with Chipcon 8051 Zigbeema SoC."""
 
 class GoodFETCC(GoodFET):
     """A GoodFET variant for use with Chipcon 8051 Zigbeema SoC."""
+    APP=0x30;
+    
     def CChaltcpu(self):
         """Halt the CPU."""
         self.writecmd(0x30,0x86,0,self.data);
     def CChaltcpu(self):
         """Halt the CPU."""
         self.writecmd(0x30,0x86,0,self.data);
@@ -72,6 +74,9 @@ class GoodFETCC(GoodFET):
     def CClockchip(self):
         """Set the flash lock bit in info mem."""
         self.writecmd(0x30, 0x9A, 0, None);
     def CClockchip(self):
         """Set the flash lock bit in info mem."""
         self.writecmd(0x30, 0x9A, 0, None);
+    def lock(self):
+        """Set the flash lock bit in info mem."""
+        self.CClockchip();
     
 
     CCversions={0x0100:"CC1110",
     
 
     CCversions={0x0100:"CC1110",
@@ -162,6 +167,10 @@ class GoodFETCC(GoodFET):
     def CCchiperase(self):
         """Erase all of the target's memory."""
         self.writecmd(0x30,0x80,0,None);
     def CCchiperase(self):
         """Erase all of the target's memory."""
         self.writecmd(0x30,0x80,0,None);
+    def erase(self):
+        """Erase all of the target's memory."""
+        self.CCchiperase();
+    
     def CCstatus(self):
         """Check the status."""
         self.writecmd(0x30,0x84,0,None);
     def CCstatus(self):
         """Check the status."""
         self.writecmd(0x30,0x84,0,None);
@@ -197,7 +206,7 @@ class GoodFETCC(GoodFET):
         """Start debugging."""
         self.writecmd(0x30,0x20,0,self.data);
         ident=self.CCidentstr();
         """Start debugging."""
         self.writecmd(0x30,0x20,0,self.data);
         ident=self.CCidentstr();
-        print "Target identifies as %s." % ident;
+        #print "Target identifies as %s." % ident;
         #print "Status: %s." % self.CCstatusstr();
         self.CCreleasecpu();
         self.CChaltcpu();
         #print "Status: %s." % self.CCstatusstr();
         self.CCreleasecpu();
         self.CChaltcpu();
index 6c910e7..c2c2a27 100644 (file)
@@ -53,10 +53,15 @@ void ccsetup(){
   P5OUT|=MOSI+SCK+RST;
   P5DIR|=MOSI+SCK+RST;
   //P5DIR&=~MISO;  //MOSI is MISO
   P5OUT|=MOSI+SCK+RST;
   P5DIR|=MOSI+SCK+RST;
   //P5DIR&=~MISO;  //MOSI is MISO
+  
+  //P5REN=0xFF;
+  
 }
 
 //! Initialize the debugger
 void ccdebuginit(){
 }
 
 //! Initialize the debugger
 void ccdebuginit(){
+  delay(30); //So the beginning is ready for glitching.
+  
   //Two positive debug clock pulses while !RST is low.
   //Take RST low, pulse twice, then high.
   P5OUT&=~SCK;
   //Two positive debug clock pulses while !RST is low.
   //Take RST low, pulse twice, then high.
   P5OUT&=~SCK;
index df7dc86..56de8c3 100644 (file)
@@ -37,7 +37,7 @@ void glitchsetup(){
   WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
   TACTL = TASSEL1 + TACLR;              // SMCLK, clear TAR
   CCTL0 = CCIE;                         // CCR0 interrupt enabled
   WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
   TACTL = TASSEL1 + TACLR;              // SMCLK, clear TAR
   CCTL0 = CCIE;                         // CCR0 interrupt enabled
-  CCR0 = glitchcount+0x30; //clock divider
+  CCR0 = glitchcount+0x15; //clock divider
   TACTL |= MC_3;
   _EINT();                              // Enable interrupts 
 #endif
   TACTL |= MC_3;
   _EINT();                              // Enable interrupts 
 #endif
@@ -46,11 +46,11 @@ void glitchsetup(){
 // Timer A0 interrupt service routine
 interrupt(TIMERA0_VECTOR) Timer_A (void)
 {
 // Timer A0 interrupt service routine
 interrupt(TIMERA0_VECTOR) Timer_A (void)
 {
-  P1OUT^=1;
   P5OUT&=~BIT7;//Glitch
   P5OUT&=~BIT7;//Glitch
+  //P5DIR=BIT7; //All else high impedance.
   P5OUT|=BIT7;//Normal
   TACTL |= MC0;// Stop Timer_A;
   P5OUT|=BIT7;//Normal
   TACTL |= MC0;// Stop Timer_A;
-  P1OUT&=~1;
+  
   return;
 }
 
   return;
 }