X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=shellcode%2Fchipcon%2Fcc1110%2Fcrystal.c;h=875c667f582d82088f056f1cc27198668dfe59ea;hp=226cbfdaba83b77eef155a487085008c0fc64654;hb=863730a5be779a7ab5a3217f5fab28d12939457a;hpb=b9e8a6ef91caf381fbc81606a3c442b77974ed62 diff --git a/shellcode/chipcon/cc1110/crystal.c b/shellcode/chipcon/cc1110/crystal.c index 226cbfd..875c667 100644 --- a/shellcode/chipcon/cc1110/crystal.c +++ b/shellcode/chipcon/cc1110/crystal.c @@ -3,11 +3,31 @@ //! Start the crystal oscillator at 26MHz. void main(){ - SLEEP &= ~SLEEP_OSC_PD; // Turn both high speed oscillators on - while( !(SLEEP & SLEEP_XOSC_S) ); // Wait until xtal oscillator is stable - CLKCON = (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) | CLKSPD_DIV_1; // Select xtal osc, 26 MHz - while (CLKCON & CLKCON_OSC); // Wait for change to take effect - SLEEP |= SLEEP_OSC_PD; // Turn off the other high speed oscillator (the RC osc) + // Turn both high speed oscillators on + SLEEP &= ~SLEEP_OSC_PD; + // Wait until xtal oscillator is stable + while( !(SLEEP & SLEEP_XOSC_S) ); + + + + // Select xtal osc, 26 MHz + // This doesn't work for the USB dongles. + CLKCON = + (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) + | CLKSPD_DIV_1; + + + /* + //Needed for CC1111? + CLKCON = + (CLKCON & ~(CLKCON_CLKSPD | CLKCON_OSC)) + | CLKSPD_DIV_2; + */ + + // Wait for change to take effect + while (CLKCON & CLKCON_OSC); + // Turn off the RC osc. + SLEEP |= SLEEP_OSC_PD; HALT; }