105 void TMSL_TDIH_TDOrd(
void)
110 void TMSL_TDIL_TDOrd(
void)
115 void TMSH_TDIH_TDOrd(
void)
120 void TMSH_TDIL_TDOrd(
void)
125 #ifdef SPYBIWIRE_MODE
173 unsigned long AllShifts(word Format,
unsigned long Data)
175 unsigned long TDOword = 0x00000000;
176 unsigned long MSB = 0x00000000;
181 case F_BYTE: MSB = 0x00000080;
183 case F_WORD: MSB = 0x00008000;
185 case F_ADDR: MSB = 0x00080000;
187 case F_LONG: MSB = 0x80000000;
193 for (i = Format; i > 0; i--)
197 ((Data & MSB) == 0) ? TMSH_TDIL_TDOrd() : TMSH_TDIH_TDOrd();
201 ((Data & MSB) == 0) ? TMSL_TDIL_TDOrd() : TMSL_TDIH_TDOrd();
222 TDOword = ((TDOword << 16) + (TDOword >> 4)) & 0x000FFFFF;
236 unsigned long AllShifts(word Format,
unsigned long Data)
239 unsigned long TDOword = 0x00000000;
240 unsigned long MSB = 0x00000000;
245 case F_BYTE: MSB = 0x00000080;
247 case F_WORD: MSB = 0x00008000;
249 case F_ADDR: MSB = 0x00080000;
251 case F_LONG: MSB = 0x80000000;
256 for (i = Format; i > 0; i--)
292 WDTCTL = WDTPW + WDTHOLD;
301 UCSCTL6 = XT2OFF+XT1DRIVE_1+XTS;
306 UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
308 }
while( SFRIFG1 & OFIFG );
312 UCSCTL4 = SELA_0+SELS_0+SELM_0;
316 UCSCTL1 = 6*DCORSEL0_L;
317 UCSCTL2 = FLLD0 + 23*FLLN0;
318 UCSCTL3 = FLLREFDIV_5;
321 UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
323 }
while( SFRIFG1 & OFIFG );
325 UCSCTL4 = SELA__XT1CLK + SELS__DCOCLKDIV + SELM__DCOCLKDIV;
330 TA0CTL = ID_3+TASSEL_1;
335 #if(0) //can be enabled for test /debug
372 SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
374 SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level;
376 while ((PMMIFG & SVSMLDLYIFG) == 0);
378 PMMIFG &= ~(SVMLVLRIFG + SVMLIFG);
380 PMMCTL0_L = PMMCOREV0 * level;
382 if ((PMMIFG & SVMLIFG))
383 while ((PMMIFG & SVMLVLRIFG) == 0);
385 SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level;
398 TVCC_EN_OUT |= TVCC_DIS_BIT;
400 TVCC_EN_OUT &= ~TVCC_DIS_BIT;
401 TVCC_EN_DIR |= TVCC_DIS_BIT;
403 if( level < 21 ) level = 21;
404 if( level > 36 ) level = 36;
417 return(
Get_Vx( ADC12INCH_14 ));
425 return(
Get_Vx( ADC12INCH_15 ));
436 UCSCTL8 |= MODOSCREQEN;
437 ADC12CTL0 |= ADC12SHT0_8 + ADC12REFON + ADC12ON;
438 ADC12CTL1 = ADC12SHP;
439 ADC12MCTL0 = ADC12SREF_1 + index;
444 ADC12CTL0 |= ADC12ENC;
445 ADC12CTL0 |= ADC12SC;
448 }
while( (ADC12IFG & BIT0) == 0 );
449 ADC12CTL0 &= ~ADC12ENC;
456 x = (ADC12MEM0 * 9)>>1;
570 if(( source & VPPONTEST ) == 0 )
TEST_dir( 1 );
571 if(( source & VPPONTDI ) == 0 )
TDI_dir( 1 );
637 #if ( INTERFACE == SPYBIWIRE_IF )
680 for(i = milliseconds; i > 0; i--)
683 TA0CTL |= TACLR+MC_1;
684 while ((TA0CCTL0 & CCIFG)==0);
713 while (--microseconds > 0);
731 for (i = Amount; i > 0; i--)
798 void TriggerPulse(word mode)
802 case 1: LEDOUT |= TRIGGER;
804 case 2: LEDOUT |= TRIGGER;
805 case 0: LEDOUT &= ~TRIGGER;
void Enable_Vpp(void)
Enable fuse blow voltage Vpp.
void ClrTCLK_sbw(void)
Clear TCLK in Spy-Bi-Wire mode.
void usDelay(word microseconds)
Delay function (resolution is ~1 us)
#define TCLK
P5.7 TDI (former XOUT) receives TCLK.
#define STATUS_ACTIVE
Replicator is active.
void SetVpp(word source)
function to set the fuse blow voltage Vpp
#define TDOsbw
SBW macro: TDO cycle without reading TDO.
byte TCLK_saved
Holds the last value of TCLK before entering a JTAG sequence.
word Get_Vx(word index)
Measure different voltages via ADC12.
void TCK_dir(word dir)
Set the direction for the TCK pin.
void ShowStatus(word status, word index)
This function controls the status LEDs depending on the status argument. It stops program in error ca...
void TDI_dir(word dir)
Set the direction for the TDI pin.
void configure_IO_JTAG(void)
Set JTAG pins to output direction - from REP430F to target.
#define TMSLDH
SBW macro: clear TMS signal and immediately set it high again in the SBWTCK low phase to enter the TD...
#define LED_GREEN
GREEN LED.
#define SW_MODE0
Mode-0 switch.
void Disable_Vpp(void)
Disable fuse blow voltage Vpp.
#define LED_YELLOW
YELLOW LED.
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)...
#define VPPDIR
Fuse blow voltage (Vpp) direction register.
#define LED_yellow_on()
Switch on yellow LED.
#define LED_red_on()
Switch on red LED.
void IO_3state(void)
Set all JTAG pins to input direction - from target to REP430F.
#define TDO_RD
SBW macro: TDO cycle with TDO read.
#define STATUS_IDLE
Replicator is idling.
#define TVCC_MASK
Minimum VCC value.
#define TVCC_DIR
VCC direction register.
#define VPPONTEST
P8.2 Fuse blow voltage switched to TEST.
#define TEST_DIR
TEST Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define VCC_LEVEL
Set the target's Vcc level supplied by REP430F.
void SetVCoreUp(word level)
Function to set a specific voltage level via the PMM.
#define TDO
P5.6 JTAG TDO output pin.
#define SBWDATI
JTAG data in pin in SBW mode - separate pin in MSP430F5437 - common IO translator.
void InitController(void)
Initialization of the Controller Board.
#define All_LEDs_off()
Switch off all LEDs.
#define SBWDATO
JTAG data_out pin in SBW mode -separate pin in MSP430F5437 - common IO translator.
#define TMS_DIR
TMS Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define SW_MODE1
Mode-1 switch.
#define LED_green_on()
Switch on green LED.
void TCLKstrobes(word Amount)
This function generates Amount strobes with the Flash Timing Generator.
#define TDIH
SBW macro: Set TDI = 1.
#define RestoreTCLK(x)
JTAG macro: restore TCLK signal on TDI pin (based on input: x)
void TEST_dir(word dir)
Set the direction for the TEST pin.
void TDOI_dir(word dir)
Set the direction for the TDO pin.
#define JTAGSEL
JTAG select register.
#define TMSH
SBW macro: set TMS signal.
#define TDOI_DIR
TDO/TDI Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define ClrTDI()
JTAG macro: clear TDI signal.
#define TMS
P5.5 JTAG TMS input pin.
#define VPPOUT
Fuse blow voltage (Vpp) output register.
#define TEST
P5.2 JTAG Test input pin.
#define SetTCK()
JTAG macro: set TCK signal.
#define TDI
P5.7 JTAG TDI input pin.
void TMS_dir(word dir)
Set the direction for the TMS pin.
#define TDIL
SBW macro: clear TDI signal.
#define SetTMS()
JTAG macro: set TMS signal.
#define LED_DIR
LED direction register.
#define TVCC_SHIFT
Value to shift up voltage level.
#define StoreTCLK()
JTAG macro: return current TCLK signal (on TDI pin)
#define STATUS_OK
return 1 = no error
#define TMSL
SBW macro: clear TMS signal.
void ReleaseTarget(void)
Release Target Board (switch voltages off, JTAG pins are HI-Z)
#define RST_DIR
RESET Translator direction 0 - output from REP430F, 1 - input to REP430F.
void TDOisInput(void)
This function switches TDO to Input (used for fuse blowing)
#define SW_VPPEN
Switch-Vpp Enable - test and set/clr.
#define LED_OUT
LED output register.
byte tdo_bit
Holds the value of TDO-bit.
void MsDelay(word milliseconds)
Delay function (resolution is 1 ms)
void configure_IO_SBW(void)
Set SBW pins to output direction - from REP430F to target.
#define TCK_DIR
TCK Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define TVCC_OUT
VCC output register.
#define JTAGDIR
JTAG direction register.
#define STATUS_ERROR
return 0 = error
void SetTargetVcc(word level)
Set target Vcc (supplied from REP430F)
#define TCK
P5.4 JTAG TCK input pin.
#define ClrTCK()
JTAG macro: clear TCK signal.
void RST_dir(word dir)
Set the direction for the RST pin.
#define JTAGOUT
JTAG output register.
void InitTarget(void)
Initialization of the Target Board (switch voltages on, preset JTAG pins)
word Get_target_Vcc(void)
Determine target VCC.
#define ScanTDO()
JTAG macro: return TDO value (result 0 or TDO (0x40))
#define SetTDI()
JTAG macro: set TDI signal.
word Get_Ext_Vcc(void)
Determine external VCC.
void RlsSignals(void)
Release I/O pins.
Low Level function prototypes, macros, and pin-to-signal assignments regarding to user's hardware...
#define RST
P5.3 Hardware RESET input pin.
#define VPPONTDI
P8.1 Fuse blow voltage switched to TDI.
void SetTCLK_sbw(void)
Set TCLK in Spy-Bi-Wire mode.
#define TDI_DIR
TDI Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define ONEMS
CCR0 delay for 1ms with a 1.5 MHz TA clock.
void DrvSignals(void)
Set up I/O pins for JTAG communication.
#define ClrTMS()
JTAG macro: clear TMS signal.