Pages: [1]   Go Down
Author Topic: How to check whether internal oscillator is oscillating?  (Read 404 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 103
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How can one check whether the internal oscillator is oscillating for Atmega328? Is it possible to measure the crystal pins to do this? This is useful for troubleshooting non-functional boards.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is a fusebit called CKOUT. If you set it, the controller outputs the clock signal on PB0.
For fiddling around with fusebits, check out the awesome  Engbedded fusebit calculator
(No, I'm not related in any way to this website, just because I promoted it 2 times in 10 minutes smiley)
Logged


Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 150
Posts: 5743
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is a fusebit called CKOUT. If you set it, the controller outputs the clock signal on PB0.

If the board isn't functional you usually can't set fuses.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6639
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are certain that the fuses are set to use the internal oscillator, then I think the only way you can tell whether it is oscillating (i.e. that part of the chip is not dead) is to look for a signal on the CLKO pin, which you will only get if you have set the CKOUT fuse bit.

If the issue is that you don't know whether the fuses are set for the internal oscillator, external clock, or crystal/ceramic resonator, then try measuring the voltage on the XTAL2 pin when neither XTAL1 nor XTAL2 are connected to anything. If it is around half the supply voltage, then this indicates that the chip is set to use a crystal or ceramic resonator - unless you are unlucky and it just happens to be running code that outputs a square wave on that pin.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Faraday Member
**
Karma: 24
Posts: 3499
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If there are ISP connectors try to connect an ISP and see if you can connect to the processor. If so the oscillator is running. If not so it might be to slow --> lower the frequency of the ISP. Still no success? Either the oscillator is not running or you can not connect for other reasons. Wire a small resistor in series to the power supply and have a look with an oscilloscope. If you have a functional board you can take this as a reference. E.g. if the processor is running at 1 MHz (or 8 Mhz) this should be visible as some ripple on the supply line. Now have a look with a non functional board.

This technique is a starting point for what is known as differntial power analysis: http://en.wikipedia.org/wiki/Power_analysis

Logged

Check out my experiments http://blog.blinkenlight.net

Pages: [1]   Go Up
Jump to: