111 void TMSL_TDIH_TDOrd(
void)
117 void TMSL_TDIL_TDOrd(
void)
123 void TMSH_TDIH_TDOrd(
void)
129 void TMSH_TDIL_TDOrd(
void)
137 void ClrTCLK_sbw(
void)
157 void SetTCLK_sbw(
void)
159 if (TCLK_saved & SBWDATO)
181 unsigned long AllShifts(word Format,
unsigned long Data)
183 unsigned long TDOword = 0x00000000;
185 unsigned long MSB = 0x00000000;
191 case F_BYTE: MSB = 0x00000080;
193 case F_WORD: MSB = 0x00008000;
195 case F_ADDR: MSB = 0x00080000;
197 case F_LONG: MSB = 0x80000000;
203 for (i = Format; i > 0; i--)
207 ((Data & MSB) == 0) ? TMSH_TDIL_TDOrd() : TMSH_TDIH_TDOrd();
211 ((Data & MSB) == 0) ? TMSL_TDIL_TDOrd() : TMSL_TDIH_TDOrd();
220 if (TCLK_saved & SBWDATO)
232 TDOword = ((TDOword << 16) + (TDOword >> 4)) & 0x000FFFFF;
246 unsigned long AllShifts(word Format,
unsigned long Data)
251 unsigned long TDOword = 0x00000000;
252 unsigned long MSB = 0x00000000;
260 case F_BYTE: MSB = 0x00000080;
262 case F_WORD: MSB = 0x00008000;
264 case F_ADDR: MSB = 0x00080000;
266 case F_LONG: MSB = 0x80000000;
271 for (i = Format; i > 0; i--)
313 WDTCTL = WDTPW + WDTHOLD;
322 UCSCTL6 = XT2OFF+XT1DRIVE_1+XTS;
328 UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
331 }
while( SFRIFG1 & OFIFG );
335 UCSCTL4 = SELA_0+SELS_0+SELM_0;
339 UCSCTL1 = 6*DCORSEL0_L;
341 UCSCTL2 = FLLD0 + 23*FLLN0;
343 UCSCTL3 = FLLREFDIV_5;
347 UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
350 }
while( SFRIFG1 & OFIFG );
352 UCSCTL4 = SELA__XT1CLK + SELS__DCOCLKDIV + SELM__DCOCLKDIV;
357 TA0CTL = ID_3+TASSEL_1;
362 #if(0) // can be enabled for test /debug
401 SVSMHCTL = SVSHE + SVSHRVL0 * level + SVMHE + SVSMHRRL0 * level;
403 SVSMLCTL = SVSLE + SVMLE + SVSMLRRL0 * level;
405 while ((PMMIFG & SVSMLDLYIFG) == 0);
407 PMMIFG &= ~(SVMLVLRIFG + SVMLIFG);
409 PMMCTL0_L = PMMCOREV0 * level;
411 if ((PMMIFG & SVMLIFG))
413 while ((PMMIFG & SVMLVLRIFG) == 0);
416 SVSMLCTL = SVSLE + SVSLRVL0 * level + SVMLE + SVSMLRRL0 * level;
429 TVCC_EN_OUT |= TVCC_DIS_BIT;
431 TVCC_EN_OUT &= ~TVCC_DIS_BIT;
432 TVCC_EN_DIR |= TVCC_DIS_BIT;
434 if( level < 21 ) level = 21;
435 if( level > 36 ) level = 36;
448 return(
Get_Vx( ADC12INCH_14 ));
456 return(
Get_Vx( ADC12INCH_15 ));
467 UCSCTL8 |= MODOSCREQEN;
470 ADC12CTL0 |= ADC12SHT0_8 + ADC12REFON + ADC12ON;
471 ADC12CTL1 = ADC12SHP;
472 ADC12MCTL0 = ADC12SREF_1 + index;
477 ADC12CTL0 |= ADC12ENC;
478 ADC12CTL0 |= ADC12SC;
481 }
while( (ADC12IFG & BIT0) == 0 );
482 ADC12CTL0 &= ~ADC12ENC;
488 x = (ADC12MEM0 * 9)>>1;
607 if(( source & VPPONTEST ) == 0 )
TEST_dir( 1 );
608 if(( source & VPPONTDI ) == 0 )
TDI_dir( 1 );
675 #if ( INTERFACE == SPYBIWIRE_IF )
719 for(i = milliseconds; i > 0; i--)
722 TA0CTL |= TACLR+MC_1;
723 while ((TA0CCTL0 & CCIFG)==0);
752 while (--microseconds > 0);
835 for (i = Amount; i > 0; i--)
903 void TriggerPulse(word mode)
907 case 1: LEDOUT |= TRIGGER;
909 case 2: LEDOUT |= TRIGGER;
910 case 0: LEDOUT &= ~TRIGGER;
#define LED_GREEN
GREEN LED.
#define STATUS_ACTIVE
Replicator is active.
#define LED_yellow_on()
Switch on yellow LED.
#define JTAGDIR
JTAG direction register.
#define TCK_DIR
TCK Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define TVCC_SHIFT
Value to shift up voltage level.
#define TDIL
SBW macro: clear TDI signal.
#define TMSL
SBW macro: clear TMS signal.
byte TCLK_saved
Holds the last value of TCLK before entering a JTAG sequence.
#define TVCC_DIR
VCC direction register.
void Disable_Vpp(void)
Disable fuse blow voltage Vpp.
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 TMS_DIR
TMS Translator direction 0 - output from REP430F, 1 - input to REP430F.
void configure_IO_JTAG(void)
Set JTAG pins to output direction - from REP430F to target.
#define SW_MODE1
Mode-1 switch.
#define SetTDI()
JTAG macro: set TDI signal.
void usDelay(word microseconds)
Delay function (resolution is ~1 us)
#define JTAGOUT
JTAG output register.
#define TMSLDH
SBW macro: clear TMS signal and immediately set it high again in the SBWTCK low phase to enter the TD...
#define STATUS_IDLE
Replicator is idling.
#define TDIH
SBW macro: Set TDI = 1.
#define VPPONTEST
P8.2 Fuse blow voltage switched to TEST.
byte tdo_bit
Holds the value of TDO-bit.
word Get_target_Vcc(void)
Determine target VCC.
#define ClrTMS()
JTAG macro: clear TMS signal.
#define SW_VPPEN
Switch-Vpp Enable - test and set/clr.
void TDOisInput(void)
This function switches TDO to Input (used for fuse blowing)
#define SBWDATI
JTAG data in pin in SBW mode - separate pin in MSP430F5437 - common IO translator.
#define STATUS_OK
return 1 = no error
#define TDI
P5.7 JTAG TDI input pin.
void InitTarget(void)
Initialization of the Target Board (switch voltages on, preset JTAG pins)
#define TDOI_DIR
TDO/TDI Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define VPPOUT
Fuse blow voltage (Vpp) output register.
#define LED_red_on()
Switch on red LED.
#define TDO
P5.6 JTAG TDO output pin.
void MsDelay(word milliseconds)
Delay function (resolution is 1 ms)
#define LED_YELLOW
YELLOW LED.
void TDI_dir(word dir)
Set the direction for the TDI pin.
#define TDOsbw
SBW macro: TDO cycle without reading TDO.
Low Level function prototypes, macros, and pin-to-signal.
word Get_Ext_Vcc(void)
Determine external VCC.
#define TVCC_MASK
Minimum VCC value.
#define VPPDIR
Fuse blow voltage (Vpp) direction register.
void DrvSignals(void)
Set up I/O pins for JTAG communication.
#define SW_MODE0
Mode-0 switch.
#define ONEMS
Constant for setting up Timer A.
void Enable_Vpp(void)
Enable fuse blow voltage Vpp.
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.
#define TMS
P5.5 JTAG TMS input pin.
void TCLKstrobes(word Amount)
This function generates Amount strobes with the Flash Timing Generator.
#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)
void TCK_dir(word dir)
Set the direction for the TCK pin.
#define LED_green_on()
Switch on green LED.
#define TDO_RD
SBW macro: TDO cycle with TDO read.
void TEST_dir(word dir)
Set the direction for the TEST pin.
#define RestoreTCLK(x)
JTAG macro: restore TCLK signal on TDI pin (based on input: x)
#define JTAGSEL
JTAG select register.
void TMS_dir(word dir)
Set the direction for the TMS pin.
#define SetTMS()
JTAG macro: set TMS signal.
#define SBWDATO
JTAG data_out pin in SBW mode -separate pin in MSP430F5437 - common IO translator.
#define STATUS_ERROR
return 0 = error
void configure_IO_SBW(void)
Set SBW pins to output direction - from REP430F to target.
void InitController(void)
Initialization of the Controller Board.
#define TVCC_OUT
VCC output register.
#define LED_DIR
LED direction register.
#define TMSH
SBW macro: set TMS signal.
void RlsSignals(void)
Release I/O pins.
void ShowStatus(word status, word index)
This function controls the status LEDs depending on the status argument. It stops program in error ca...
#define TEST_DIR
TEST Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define All_LEDs_off()
Switch off all LEDs.
#define RST
P5.3 Hardware RESET input pin.
#define VCC_LEVEL
Set the target's Vcc level supplied by REP430F.
#define ClrTDI()
JTAG macro: clear TDI signal.
#define ScanTDO()
JTAG macro: return TDO value (result 0 or TDO (0x40))
#define RST_DIR
RESET Translator direction 0 - output from REP430F, 1 - input to REP430F.
#define TEST
P5.2 JTAG Test input pin.
#define LED_OUT
LED output register.
#define TCLK
P5.7 TDI (former XOUT) receives TCLK.
void SetTargetVcc(word level)
Set target Vcc (supplied from REP430F)
#define TCK
P5.4 JTAG TCK input pin.
#define SetTCK()
JTAG macro: set TCK signal.
#define ClrTCK()
JTAG macro: clear TCK signal.
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 TDOI_dir(word dir)
Set the direction for the TDO pin.
#define VPPONTDI
P8.1 Fuse blow voltage switched to TDI.
word Get_Vx(word index)
Measure different voltages via ADC12.
void RST_dir(word dir)
Set the direction for the RST pin.