Go Down

Topic: How to check whether internal oscillator is oscillating? (Read 427 times) previous topic - next topic

lightaiyee

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.

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 :))

fungus


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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dc42

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

Udo Klein

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

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

Go Up