RE: [AVR-Chat] Mega8 starting at wrong osc speed
2009-05-18 by Tim Mitchell
----Original Message----
Show quoted textHide quoted text
From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf Of John Samperi Sent: 16 May 2009 00:05 To: AVR-Chat@yahoogroups.com Subject: Re: [AVR-Chat] Mega8 starting at wrong osc speed > At 09:31 PM 15/05/2009, you wrote: > > This suggests that the internal osc is running at 16MHz. > > You are a MIRACLE worker. :-) > > > (but Bod is not enabled, which the datasheet says it > > should be with this setting). If I change it to > > 6CK+64ms then it appears to start up correctly every > > time. > > So why not used the BOD as the data sheet says you > should? Do you have a cap on the reset line? > > Most likely the chip and oscillators are wobbly at power > up and the chip is not being initialised correctly seeing > the a reset gets it working correctly after the > oscillator has stabilised. > Hi, thanks for the useul answers from John and Brian. The customer had programmed the devices using incorrect fuse bit settings. Enabling BOD fixes the problem, as does changing the SUT fuses to give a longer start up time (any setting works except the 6CK+0ms setting they had used). I was just curious as to what was actually going on inside the device, as I have never seen such a way-out clock frequency using an AVR. Brian is probably right that it is something to do with the calibration register - if you program the cal register to FF you can get 200% of the nominal frequency, though I am surprised it actually runs at this speed. We aren't loading the calibration register in software as the default setting (which is only accurate for 1Mhz) is good enough, but I guess that in this case it was not being loaded from hardware either. The datasheet I was using appears to be an old one - the most recent version from Atmel has a lot more info on the oscillator and calibration register, suggesting that I am not the first to see this problem. I do not have a cap on the reset line. Coming from 8051 designs, I started off using a reset cap and had all sorts of trouble with devices not resetting properly in fast power cycle situations. -- Tim Mitchell