+
+ //Perform a reset and disable watchdog.
+ return jtag430x2_jtagid();
+}
+
+
+//! Start JTAG, take pins
+void jtag430_start(){
+ jtagsetup();
+
+ //Known-good starting position.
+ //Might be unnecessary.
+ SETTST;
+ SETRST;
+ delay(0xFFFF);
+
+
+ #ifndef SBWREWRITE
+ //Entry sequence from Page 67 of SLAU265A for 4-wire MSP430 JTAG
+ CLRRST;
+ delay(100); //100
+ CLRTST;
+ delay(50); //50
+ SETTST;
+ delay(50); //50
+ SETRST;
+ P5DIR&=~RST;
+ delay(0xFFFF);
+ #endif
+
+ //Perform a reset and disable watchdog.
+ jtag430_por();
+ jtag430_writemem(0x120,0x5a80);//disable watchdog
+
+ jtag430_haltcpu();
+}
+
+//! Stop JTAG.
+void jtag430_stop(){
+ debugstr("Exiting JTAG.");
+ jtagsetup();
+
+ //Known-good starting position.
+ //Might be unnecessary.
+ //SETTST;
+ CLRTST;
+ SETRST;
+ delay(0xFFFF);
+
+ //Entry sequence from Page 67 of SLAU265A for 4-wire MSP430 JTAG
+ CLRRST;
+ delay(0xFFFF);
+ SETRST;
+ //P5DIR&=~RST;
+ //delay(0xFFFF);
+