71 #include <msp430x54x.h>
80 #define SPYBIWIREJTAG_IF 2
82 #define SPYBIWIRE_IF 3
85 #if( INTERFACE == SPYBIWIRE_IF )
86 #define SPYBIWIRE_MODE
89 #ifndef __DATAFORMATS__
90 #define __DATAFORMATS__
99 #define STATUS_ERROR 0 // false
100 #define STATUS_OK 1 // true
102 #define STATUS_FUSEBLOWN 2
106 #define STATUS_ACTIVE 2
107 #define STATUS_IDLE 3
123 #define TRSLDIR P2OUT
125 #define TRSL_CDIR P2DIR
133 #define TEST_DIR 0x04
141 #define TDOI_DIR 0x40
149 #define SW_PULLUP P1REN
150 #define LED_OUT P1OUT
152 #define LED_DIR P1DIR
156 #define SW_MODE0 0x01
157 #define SW_MODE1 0x02
159 #define SW_VPPEN 0x04
161 #define LED_YELLOW 0x08
163 #define LED_GREEN 0x10
173 #define TVCC_OUT P6OUT
174 #define TVCC_DIR P6DIR
176 #define TVCC_MASK 0xF0
181 #define TVCC_EN_DIR P5DIR
182 #define TVCC_EN_OUT P5OUT
183 #define TVCC_DIS_BIT 1
186 #define LED_yellow_on() ( LED_OUT |= LED_YELLOW )
187 #define LED_yellow_off() ( LED_OUT &= ~LED_YELLOW )
189 #define LED_red_on() ( LED_OUT |= LED_RED )
191 #define LED_red_off() ( LED_OUT &= ~LED_RED )
193 #define LED_green_on() ( LED_OUT |= LED_GREEN )
195 #define LED_green_off() ( LED_OUT &= ~LED_GREEN )
197 #define All_LEDs_off() ( LED_OUT &= ~(LED_GREEN | LED_RED | LED_YELLOW ))
202 #define JTAGOUT P5OUT
205 #define JTAGDIR P5DIR
207 #define JTAGSEL P5SEL
252 #define VPPONTEST 0x04
253 #define VPPONTDI 0x02
265 #define ClrTMS() ((JTAGOUT) &= (~TMS))
266 #define SetTMS() ((JTAGOUT) |= (TMS))
268 #define ClrTDI() ((JTAGOUT) &= (~TDI))
270 #define SetTDI() ((JTAGOUT) |= (TDI))
272 #define ClrTCK() ((JTAGOUT) &= (~TCK))
274 #define SetTCK() ((JTAGOUT) |= (TCK))
276 #define StoreTCLK() ((JTAGOUT & TCLK))
278 #define RestoreTCLK(x) (x == 0 ? (JTAGOUT &= ~TCLK) : (JTAGOUT |= TCLK))
280 #define ScanTDO() ((JTAGIN & TDO))
282 #define VPPon(x) (x == VPP_ON_TEST ? (SetVpp(VPPONTEST)) : (SetVpp(VPPONTDI)))
284 #define VPPoff() (SetVpp(0))
286 #define SetRST() ((JTAGOUT) |= (RST))
288 #define ClrRST() ((JTAGOUT) &= (~RST))
290 #define ReleaseRST() ( RST_dir( 0 ))
292 #define SetTST() ((JTAGOUT) |= (TEST))
294 #define ClrTST() ((JTAGOUT) &= (~TEST))
309 #define TMSH JTAGOUT |= SBWDATO; JTAGOUT &= ~SBWCLK; JTAGOUT |= SBWCLK;
310 #define TMSL JTAGOUT &= ~SBWDATO; JTAGOUT &= ~SBWCLK; JTAGOUT |= SBWCLK;
312 #define TMSLDH JTAGOUT &= ~SBWDATO; JTAGOUT &= ~SBWCLK; JTAGOUT |= SBWDATO; JTAGOUT |= SBWCLK;
317 #define TDIH JTAGOUT |= SBWDATO; JTAGOUT &= ~SBWCLK; JTAGOUT |= SBWCLK;
319 #define TDIL JTAGOUT &= ~SBWDATO; JTAGOUT &= ~SBWCLK; JTAGOUT |= SBWCLK;
321 #define TDOsbw TRSLDIR |= TDOI_DIR; JTAGOUT &= ~SBWCLK; JTAGOUT |= SBWCLK; TRSLDIR &= ~TDOI_DIR;
323 #define TDO_RD TRSLDIR |= TDOI_DIR; JTAGOUT &= ~SBWCLK; _NOP(); tdo_bit = JTAGIN; JTAGOUT |= SBWCLK; TRSLDIR &= ~TDOI_DIR;
327 #define SetSBWTCK() (JTAGOUT |= SBWCLK)
328 #define ClrSBWTCK() (JTAGOUT &= ~SBWCLK)
330 #define SetSBWTDIO() (JTAGOUT |= SBWDATO)
332 #define ClrSBWTDIO() (JTAGOUT &= ~SBWDATO)
335 #if ( INTERFACE == SPYBIWIRE_IF )
337 void ClrTCLK_sbw(
void);
338 void SetTCLK_sbw(
void);
340 #define ClrTCLK() ClrTCLK_sbw()
341 #define SetTCLK() SetTCLK_sbw()
347 #define ClrTCLK() ((JTAGOUT) &= ~(TCLK))
348 #define SetTCLK() ((JTAGOUT) |= (TCLK))
364 typedef unsigned short word;
365 typedef unsigned char byte;
372 void TMSL_TDIL(
void);
373 void TMSH_TDIL(
void);
374 void TMSL_TDIH(
void);
375 void TMSH_TDIH(
void);
376 void TMSL_TDIH_TDOrd(
void);
377 void TMSL_TDIL_TDOrd(
void);
378 void TMSH_TDIH_TDOrd(
void);
379 void TMSH_TDIL_TDOrd(
void);
380 void MsDelay(word milliseconds);
381 void usDelay(word microeconds);
385 unsigned long AllShifts(word Format,
unsigned long Data);
389 void TriggerPulse(word Mode);
395 void SetVpp( word source );
398 word
Get_Vx( word index );
408 void configure_IO_BSL(
void );
void SetVCoreUp(word level)
Function to set a specific voltage level via the PMM.
void SetVpp(word source)
function to set the fuse blow voltage Vpp
void TMS_dir(word dir)
Set the direction for the TMS pin.
void Disable_Vpp(void)
Disable fuse blow voltage Vpp.
void ShowStatus(word Status, word Index)
This function controls the status LEDs depending on the status argument. It stops program in error ca...
void configure_IO_JTAG(void)
Set JTAG pins to output direction - from REP430F to target.
void ReleaseTarget(void)
Release Target Board (switch voltages off, JTAG pins are HI-Z)
void IO_3state(void)
Set all JTAG pins to input direction - from target to REP430F.
void TDOisInput(void)
This function switches TDO to Input (used for fuse blowing)
void MsDelay(word milliseconds)
Delay function (resolution is 1 ms)
void SetTargetVcc(word level)
Set target Vcc (supplied from REP430F)
void Enable_Vpp(void)
Enable fuse blow voltage Vpp.
word Get_Ext_Vcc(void)
Determine external VCC.
void InitTarget(void)
Initialization of the Target Board (switch voltages on, preset JTAG pins)
void RlsSignals(void)
Release I/O pins.
void DrvSignals(void)
Set up I/O pins for JTAG communication.
void TEST_dir(word dir)
Set the direction for the TEST pin.
void TDI_dir(word dir)
Set the direction for the TDI pin.
byte TCLK_saved
Holds the last value of TCLK before entering a JTAG sequence.
word Get_target_Vcc(void)
Determine target VCC.
void usDelay(word microeconds)
Delay function (resolution is ~1 us)
void TDOI_dir(word dir)
Set the direction for the TDO pin.
word Get_Vx(word index)
Measure different voltages via ADC12.
void TCLKstrobes(word Amount)
This function generates Amount strobes with the Flash Timing Generator.
void TCK_dir(word dir)
Set the direction for the TCK pin.
Configurations for the MSP430 Replicator X.
void configure_IO_SBW(void)
Set SBW pins to output direction - from REP430F to target.
void RST_dir(word dir)
Set the direction for the RST pin.
void InitController(void)
Initialization of the Controller Board.
unsigned long AllShifts(word Format, unsigned long Data)
Shift a value into TDI (MSB first) and simultaneously shift out a value from TDO (MSB first)...