Some bits of Spy-Bi-Wire support, thanks to Mark Rages. (Not yet complete.)
[goodfet] / firmware / apps / jtag / jtag430.c
index 3a2fe68..7bfcba6 100644 (file)
@@ -238,7 +238,8 @@ void jtag430_start(){
   SETTST;
   SETRST;
   delay(0xFFFF);
-  
+
+  #ifndef SBWREWRITE
   //Entry sequence from Page 67 of SLAU265A for 4-wire MSP430 JTAG
   CLRRST;
   delay(100); //100
@@ -249,6 +250,7 @@ void jtag430_start(){
   SETRST;
   P5DIR&=~RST;
   delay(0xFFFF);
+  #endif
   
   //Perform a reset and disable watchdog.
   jtag430_por();
@@ -259,24 +261,19 @@ void jtag430_start(){
 
 //! Start normally, not JTAG.
 void jtag430_stop(){
+  debugstr("Exiting JTAG.");
   jtagsetup();
   
   //Known-good starting position.
   //Might be unnecessary.
-  SETTST;
+  //SETTST;
+  CLRTST;
   SETRST;
   delay(0xFFFF);
   
   //Entry sequence from Page 67 of SLAU265A for 4-wire MSP430 JTAG
   CLRRST;
   delay(0xFFFF);
-  /*
-  delay(100); //100
-  CLRTST;
-  delay(50);  //50
-  SETTST;
-  delay(50);  //50
-  */
   SETRST;
   //P5DIR&=~RST;
   //delay(0xFFFF);
@@ -327,10 +324,11 @@ void jtag430handle(unsigned char app,
     //TAP setup, fuse check
     jtag430_resettap();
     
-    txdata(app,verb,0);
+    cmddata[0]=jtag_ir_shift8(IR_BYPASS);    
+    txdata(app,verb,1);
+
     break;
   case STOP:
-    debugstr("Resetting target.");
     jtag430_stop();
     txdata(app,verb,0);
     break;