195 for (i = 8; i > 1; i--)
220 word TDOword = 0x0000;
224 (Format == F_WORD) ? (MSB = 0x8000) : (MSB = 0x80);
225 for (i = Format; i > 0; i--)
260 word
Shift(word Format, word Data)
263 word TDOword = 0x0000;
268 (Format == F_WORD) ? (MSB = 0x8000) : (MSB = 0x80);
269 for (i = Format; i > 0; i--)
305 WDTCTL = WDTPW + WDTHOLD;
314 UCSCTL6 = XT2OFF+XT1DRIVE_1+XTS;
320 UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
323 }
while( SFRIFG1 & OFIFG );
327 UCSCTL4 = SELA_0+SELS_0+SELM_0;
331 UCSCTL1 = 6*DCORSEL0_L;
333 UCSCTL2 = FLLD0 + 23*FLLN0;
335 UCSCTL3 = FLLREFDIV_5;
339 UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
342 }
while( SFRIFG1 & OFIFG );
344 UCSCTL4 = SELA__XT1CLK + SELS__DCOCLKDIV + SELM__DCOCLKDIV;
349 TA0CTL = ID_3+TASSEL_1;
354 #if(0) // can be enabled for test /debug
392 SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
394 SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level;
396 while ((PMMIFG & SVSMLDLYIFG) == 0);
398 PMMIFG &= ~(SVMLVLRIFG + SVMLIFG);
400 PMMCTL0_L = PMMCOREV0 * level;
402 if ((PMMIFG & SVMLIFG))
404 while ((PMMIFG & SVMLVLRIFG) == 0);
407 SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level;
420 TVCC_EN_OUT |= TVCC_DIS_BIT;
422 TVCC_EN_OUT &= ~TVCC_DIS_BIT;
423 TVCC_EN_DIR |= TVCC_DIS_BIT;
425 if( level < 21 ) level = 21;
426 if( level > 36 ) level = 36;
439 return(
Get_Vx( ADC12INCH_14 ));
447 return(
Get_Vx( ADC12INCH_15 ));
458 UCSCTL8 |= MODOSCREQEN;
460 ADC12CTL0 |= ADC12SHT0_8 + ADC12REFON + ADC12ON;
461 ADC12CTL1 = ADC12SHP;
462 ADC12MCTL0 = ADC12SREF_1 + index;
467 ADC12CTL0 |= ADC12ENC;
468 ADC12CTL0 |= ADC12SC;
471 }
while( (ADC12IFG & BIT0) == 0 );
472 ADC12CTL0 &= ~ADC12ENC;
478 x = (ADC12MEM0 * 9)>>1;
588 if(( source & VPPONTEST ) == 0 )
TEST_dir( 1 );
589 if(( source & VPPONTDI ) == 0 )
TDI_dir( 1 );
655 #if ( INTERFACE == SPYBIWIRE_IF )
700 for(i = milliseconds; i > 0; i--)
703 TA0CTL |= TACLR+MC_1;
704 while ((TA0CCTL0 & CCIFG)==0);
733 while (--microseconds > 0);
736 #ifdef SPYBIWIRE_MODE
744 void TCLKstrobes(word Amount)
760 for (i = Amount; i > 0; i--)
808 void TCLKstrobes(word Amount)
816 for (i = Amount; i > 0; i--)
884 void TriggerPulse(word mode)
888 case 1: LEDOUT |= TRIGGER;
890 case 2: LEDOUT |= TRIGGER;
891 case 0: LEDOUT &= ~TRIGGER;
#define TMS_DIR
TMS Translator direction 0 - output from REP430F, 1 - input to REP430F.
void TMSH_TDIH_TDOrd(void)
Combination of SBW macros: TMS high, TDI high, TDO read.
#define TDI_DIR
TDI Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define StoreTCLK()
JTAG macro: return current TCLK signal (on TDI pin)
word Shift(word Format, word Data)
Shift a value into TDI (MSB first) and simultaneously shift out a value from TDO (MSB first)...
#define VPPONTEST
P8.2 Fuse blow voltage switched to TEST.
#define SW_MODE0
Mode-0 switch.
#define TMSL
SBW macro: clear TMS signal.
void TDOI_dir(word dir)
Set the direction for the TDO pin.
void SetTCLK_sbw(void)
Set TCLK in Spy-Bi-Wire mode.
void ShowStatus(word status, word index)
This function controls the status LEDs depending on the status argument. It stops program in error ca...
#define TDOsbw
SBW macro: TDO cycle without reading TDO.
void SetTargetVcc(word level)
Set target Vcc (supplied from REP430F)
#define TEST
P5.2 JTAG Test input pin.
JTAG Function Prototypes and Definitions.
#define VPPOUT
Fuse blow voltage (Vpp) output register.
#define VCC_LEVEL
Set the target's Vcc level supplied by REP430F.
word Get_Vx(word index)
Measure different voltages via ADC12.
#define TDO_RD
SBW macro: TDO cycle with TDO read.
void TCK_dir(word dir)
Set the direction for the TCK pin.
#define SetTMS()
JTAG macro: set TMS signal.
void DrvSignals(void)
Set up I/O pins for JTAG communication.
#define VPPDIR
Fuse blow voltage (Vpp) direction register.
void TMSH_TDIH(void)
Combination of SBW macros: TMS high, TDI high, no TDO read.
void IR_Ex_Blow_SBW_Shift(void)
Provide JTAG fuse blow instruction.
#define RST_DIR
RESET Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define SW_MODE1
Mode-1 switch.
void ClrTCLK_sbw(void)
Clear TCLK in Spy-Bi-Wire mode.
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)
#define STATUS_ACTIVE
Replicator is active.
void Disable_Vpp(void)
Disable fuse blow voltage Vpp.
#define TMSH
SBW macro: set TMS signal.
#define STATUS_ERROR
return 0 = error
#define JTAGSEL
JTAG select register.
#define TCLK
P5.7 TDI (former XOUT) receives TCLK.
#define STATUS_IDLE
Replicator is idling.
void TMSL_TDIL(void)
Combination of SBW macros: TMS low, TDI low, no TDO read.
#define LED_yellow_on()
Switch on yellow LED.
#define TVCC_OUT
VCC output register.
void MsDelay(word milliseconds)
Delay function (resolution is 1 ms)
#define TVCC_MASK
Minimum VCC value.
#define ClrTMS()
JTAG macro: clear TMS signal.
#define TDIH
SBW macro: Set TDI = 1.
#define ONEMS
CCR0 delay for 1ms with a 1.5 MHz TA clock.
void TMS_dir(word dir)
Set the direction for the TMS pin.
void TDOisInput(void)
This function switches TDO to Input (used for fuse blowing)
#define ClrTCK()
JTAG macro: clear TCK signal.
void InitController(void)
Initialization of the Controller Board.
#define LED_OUT
LED output register.
void SetVpp(word source)
function to set the fuse blow voltage Vpp
#define TVCC_SHIFT
Value to shift up voltage level.
#define TEST_DIR
TEST Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define TDOI_DIR
TDO/TDI Translator direction 0 - output from REP430F, 1 - input to REP430F.
byte tdo_bit
Holds the value of TDO-bit.
void SetVCoreUp(word level)
Function to set a specific voltage level via the PMM.
void configure_IO_SBW(void)
Set SBW pins to output direction - from REP430F to target.
#define TCK
P5.4 JTAG TCK input pin.
void TMSL_TDIH(void)
Combination of SBW macros: TMS low, TDI high, no TDO read.
#define SBWDATO
JTAG data_out pin in SBW mode -separate pin in MSP430F5437 - common IO translator.
#define ScanTDO()
JTAG macro: return TDO value (result 0 or TDO (0x40))
void RST_dir(word dir)
Set the direction for the RST pin.
word Get_Ext_Vcc(void)
Determine external VCC.
#define TCK_DIR
TCK Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define RST
P5.3 Hardware RESET input pin.
#define LED_red_on()
Switch on red LED.
#define LED_green_on()
Switch on green LED.
#define LED_YELLOW
YELLOW LED.
#define JTAGOUT
JTAG output register.
#define All_LEDs_off()
Switch off all LEDs.
#define TDO
P5.6 JTAG TDO output pin.
#define LED_GREEN
GREEN LED.
void InitTarget(void)
Initialization of the Target Board (switch voltages on, preset JTAG pins)
word Get_target_Vcc(void)
Determine target VCC.
void TMSL_TDIL_TDOrd(void)
Combination of SBW macros: TMS low, TDI low, TDO read.
void usDelay(word microseconds)
Delay function (resolution is ~1 us)
#define LED_DIR
LED direction register.
#define STATUS_OK
return 1 = no error
#define JTAGDIR
JTAG direction register.
void TDI_dir(word dir)
Set the direction for the TDI pin.
void TEST_dir(word dir)
Set the direction for the TEST pin.
#define TMSLDH
SBW macro: clear TMS signal and immediately set it high again in the SBWTCK low phase to enter the TD...
void IO_3state(void)
Set all JTAG pins to input direction - from target to REP430F.
#define TVCC_DIR
VCC direction register.
byte TCLK_saved
Holds the last value of TCLK before entering a JTAG sequence.
void TMSH_TDIL_TDOrd(void)
Combination of SBW macros: TMS high, TDI low, TDO read.
void Enable_Vpp(void)
Enable fuse blow voltage Vpp.
#define SBWDATI
JTAG data in pin in SBW mode - separate pin in MSP430F5437 - common IO translator.
#define TDI
P5.7 JTAG TDI input pin.
#define IR_EX_BLOW
Perform JTAG fuse blow.
#define TDIL
SBW macro: clear TDI signal.
#define SetTCK()
JTAG macro: set TCK signal.
#define TMS
P5.5 JTAG TMS input pin.
#define VPPONTDI
P8.1 Fuse blow voltage switched to TDI.
#define RestoreTCLK(x)
JTAG macro: restore TCLK signal on TDI pin (based on input: x)
#define ClrTDI()
JTAG macro: clear TDI signal.
void RlsSignals(void)
Release I/O pins.
#define SetTDI()
JTAG macro: set TDI signal.
Low Level function prototypes, macros, and pin-to-signal assignments regarding to user's hardware...
void TMSH_TDIL(void)
Combination of SBW macros: TMS high, TDI low, no TDO read.
void TMSL_TDIH_TDOrd(void)
Combination of SBW macros: TMS low, TDI high, TDO read.
#define SW_VPPEN
Switch-Vpp Enable - test and set/clr.