Go Down

Topic: Internal oscillator - needs time to settle? (Read 927 times) previous topic - next topic

int2str

Hi all!

I'm using an ATMega328p that's running at 8 MHz, using the internal oscillator.
It's hooked up to a serial LCD display using a modified version of the SoftwareSerial library (long story, don't ask :) ).

The problem I'm having is that when I first power the setup, the serial communication does not seem stable and the timing seems to be all off, resulting in garbled characters on the display. I thought that might be a oscillator calibration problem, but my logic analyzer confirms that after an initial period,the timing is absolutely spot on. There are just intermittent frame errors in the first few seconds.

Does the internal oscillator need time to settle or something?
If so, any bets on what a safe time to wait for that would be?

Thx!

Jack Christensen

#1
Sep 10, 2013, 10:38 am Last Edit: Sep 10, 2013, 10:44 am by Jack Christensen Reason: 1

Does the internal oscillator need time to settle or something?


Yes, but the datasheet indicates that 14 clock cycles plus 65ms should suffice, I wouldn't expect it to take seconds.

I might suspect the power supply, what are you using? Are there sufficient bypass capacitors in the circuit?

EDIT: But you don't have to explicitly wait the 14CK + 65ms (or whatever time is selected via the SUT and CKSEL fuse bits) as the MCU is held in reset for the specified period after power-on.
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

int2str

Yes, but the datasheet indicates that 14 clock cycles plus 65ms should suffice, I wouldn't expect it to take seconds.


Ok, that's reassuring, thanks.

Quote
I might suspect the power supply, what are you using? Are there sufficient bypass capacitors in the circuit?


And I suspect you're right :)
No, I don't have enough (read: any) bypass capacitors.
It's a 12V desk power supply connected to a LM7805.

I'll add some capacitors...

Thanks!

mrburnette

Quote
serial LCD display


My guess is the uC on the LCD to do the serial to parallel conversion is SLOW to initialize the LCD.  A delay in your setup() before dropping into loop() is probably all that is required.  Oh, some LCDs need a delay() after any Serial.clear()

Ray


int2str

Thanks guys!
You'll be shocked and completely surprised to learn that a capacitor fixed the problem :)

Jack Christensen


Thanks guys!
You'll be shocked and completely surprised to learn that a capacitor fixed the problem :)


Neither, given that there were none ;)

But I also thought the LCD initialization was a good guess; it could have been both :smiley-eek:
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Docedison

Missing, Wrong Value(s) or improperly placed bypass capacitors along with daisy chained instead of the preferable star ground topology has turned more good ideas and code into wasted time than ANY other reason I've ever seen in 20+ years of embedded controller design experience.
Holes are cheap the first time but terribly expensive after the fact.
SMD pads even cheaper... A 'little' easier after the fact.
Free before (the pads), and the greatest thing is that too many is far better than too few. The simple truth is that not all need be used and those of no real value are simply dropped on the next revision of the board
I 'learned', finally what my Prof's were trying to pound into my thick skull... The hard way. Sometimes one can get lucky and change a handful of caps to larger values and add short fat jumpers to the larger caps... Not so lucky is to have to double all the cap values... But still real lucky compared to having to scrape solder-mask to add by-pass caps or truly unlucky when it was a 4 layer board and holes had to be drilled. Those of that complain bitterly today about poorly bypassed circuits made it... Those that didn't became technical writers... Which is why most data sheets make a passable attempt to be "Greek" in any language ("Greek" being any language you don't understand and not a slur on a fine and proud people).
I got so wounded by that issue that those Damn parts are the first things I look for. Now. Also the last to be trusted.

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Go Up