Setting ATMega16 clock options
2009-09-03 by Chuck Hackett
I have an ATMega16 mounted on a Olimex AVR-P40-8535 prototyping board (Schematic here: http://olimex.com/dev/images/avr-p40-8535-sch.gif). My problem is that everything works fine when the clock fuses are set for internal 1 MHz (chip default) but, when I attempt to set the fuses for operation with the board-mounted 8 MHz crystal the chip acts like it does not have any clock running. As you can see from the schematic, the board has matched (SMD) 22pfd caps on the crystal. The caps and crystal are mounted close to the chip pins and the traces are very short with nothing else near them or the crystal. I have read and re-read the (full) ATMega16 datasheet and tried many combinations of CKOPT, CKSEL and SUT, all with no success. If I reset the clock fuses to 1 MHz Internal RC all works again. BTW: The application also runs with the clock fuses to 8 MHz Internal RC. Fuse settings (as shown by AVR Studio on last try): OCDEN: chk JTAGEN: chk SPIEN: chk EESAVE: no chk BOOTSZ: 512 words BOOTRST: no chk CKOPT: chk BODLEVEL: 2.7v BODEN: no chk SUT_CKSEL: Ext. Crystal/Resonator High Freq.; Start-up time: 16k CK + 64 ms I have also tried another crystal from a second AVR-P40 board with no luck. The major reason for wanting to go from the internal RC to the crystal is to get more clock accuracy so I can increase the baud rate used by my boot loader above 4800 (>4800 causes framing errors w/internal RC). I know I could calibrate the internal RC but the crystal is already there and would be easier ... if it worked :-) (BTW: thanks again to all who helped in my search for the boot loader code) Thoughts? Cheers, Chuck Hackett "Good judgment comes from experience, experience comes from bad judgment" 7.5" gauge Union Pacific Northern (4-8-4) 844 http://www.whitetrout.net/Chuck