Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

RE: [AVR-Chat] Setting ATMega16 clock options

RE: [AVR-Chat] Setting ATMega16 clock options

2009-09-03 by Tim Mitchell

----Original Message----
Show quoted textHide quoted text
From: AVR-Chat@yahoogroups.com
[mailto:AVR-Chat@yahoogroups.com] On Behalf Of Chuck
Hackett Sent: 03 September 2009 06:49 To: AVR-Chat
Subject: [AVR-Chat] Setting ATMega16 clock options

> 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.    
> 
> 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. 


Strange - the AVR crystal circuit is fairly resilient in my experience.
Your fuse settings look fine.
The only problem I have had is incorrect setting of CKOPT - if CKOPT is
not programmed then the crystal startup becomes uncertain, sometimes it
works and sometimes not.

Have you tried programming your second board with the same fuse settings
to see if that one works? Could be a problem with the Mega16 or the
board?

-- 
Tim Mitchell
tim@sabretechnology.co.uk http://www.sabretechnology.co.uk
Sabre Technology (Hull) Ltd, 3a Newlands Science Park, Hull
HU6 7TQ Registered in England and Wales no.3131504
t:01482 801003 f:01482 801078

RE: [AVR-Chat] Setting ATMega16 clock options

2009-09-03 by Chuck Hackett

> From: Tim Mitchell
> ....
> Hang on a minute, how are you programming this board? If you're using
> ISP and the clock really isn't running, you would not be able to
> program
> it back to internal osc once you'd set it to external - the ISP would
> stop working.

I'm programming it from AVR Studio via JTAG (Ice-Cube adapter) so I'm ok
there ... 

> From: Tim Mitchell
> ....
> 
> Strange - the AVR crystal circuit is fairly resilient in my experience.
> Your fuse settings look fine.
> The only problem I have had is incorrect setting of CKOPT - if CKOPT is
> not programmed then the crystal startup becomes uncertain, sometimes it
> works and sometimes not.
> 
> Have you tried programming your second board with the same fuse
> settings
> to see if that one works? Could be a problem with the Mega16 or the
> board?
> ....

I hadn't tried the other board but I have now ...

I programmed the same firmware and fuses into the processor on board 2 and
it worked, hmmmm ...

I swapped the processors and tried the processor from board 1 in board 2 ...
it worked ... hmmmm ...

I tried the processor from board 2 in board 1 ... it worked ... 

Now things got really crazy ... I put the original processor for board 1
back into board 1 to get back to where I started ... now it worked!

So ... my guess is that, even though the chip was well seated when I went to
remove it, there must have been some corrosion, dust, gremlins, whatever on
one or more pins because re-seating it apparently fixed the problem.

Thanks for suggesting to try the other board as it led me to the problem.
 
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

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.