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
68 u16 glitchH=0xfff, glitchL=0xfff,
69 glitchstate=2, glitchcount=0;
71 //! Glitch an application.
72 void glitchapp(u8 app){
73 debugstr("That app is not yet supported.");
77 //! Set glitching voltages.
78 void glitchvoltages(u16 low, u16 high){
85 ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref on
86 // Delay here for reference to settle.
87 for(i=0;i!=0xFFFF;i++) asm("nop");
88 DAC12_0CTL = DAC12IR + DAC12AMP_5 + DAC12ENC; // Int ref gain 1
89 // 1.0V 0x0666, 2.5V 0x0FFF
91 //DAC12_0DAT = 0x0880;
94 //! Set glitching rate.
95 void glitchrate(u16 rate){
100 //! Handles a monitor command.
101 void glitchhandle(unsigned char app,
106 glitchvoltages(cmddataword[0],
111 glitchrate(cmddataword[0]);
119 debugstr("Unknown glitching verb.");