2 \author Travis Goodspeed
3 \brief Glitching Support for GoodFET20
5 See the TI example MSP430x261x_dac12_01.c for usage of the DAC.
6 This module sends odd and insufficient voltages on P6.6/DAC0
7 in order to bypass security restrictions of target devices.
14 //! Disable glitch state at init.
17 //Set GSEL high to disable glitching.
27 WDTCTL = WDTPW + WDTHOLD; // Stop WDT
28 TACTL = TASSEL1 + TACLR; // SMCLK, clear TAR
29 CCTL0 = CCIE; // CCR0 interrupt enabled
31 TACTL |= MC1; // Start Timer_A in continuous mode
32 _EINT(); // Enable interrupts
36 //! Setup analog chain for glitching.
37 void glitchsetupdac(){
38 glitchvoltages(glitchL,glitchH);
41 // Timer A0 interrupt service routine
42 interrupt(TIMERA0_VECTOR) Timer_A (void)
61 CCR0 += glitchcount; // Add Offset to CCR0
67 u16 glitchH=0xfff, glitchL=0xfff,
68 glitchstate=2, glitchcount=0;
70 //! Glitch an application.
71 void glitchapp(u8 app){
72 debugstr("That app is not yet supported.");
76 //! Set glitching voltages.
77 void glitchvoltages(u16 low, u16 high){
84 ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on
85 // Delay here for reference to settle.
86 for(i=0;i!=0xFFFF;i++) asm("nop");
87 DAC12_0CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1
88 // 1.0V 0x0666, 2.5V 0x0FFF
90 //DAC12_0DAT = 0x0880;
93 //! Set glitching rate.
94 void glitchrate(u16 rate){
99 //! Handles a monitor command.
100 void glitchhandle(unsigned char app,
105 glitchvoltages(cmddataword[0],
110 glitchrate(cmddataword[0]);
118 debugstr("Unknown glitching verb.");