I have a 30MHz oscilloscope ( in good working condition ) and would like to see the 16MHz clock waveform on a bare bone Atmega 328P running normally ( at least its blinking the LED at the expected rate ). I am using a 16MHz crystal and two numbers of 22pF capacitors.
Tried to see the waveform ( unsuccessfully ) on one of the crystal pins. Which would be the best way ? Is it possible to route the clock to one of the digital pins ?
Mogaraghu:
Tried to see the waveform ( unsuccessfully ) on one of the crystal pins. Which would be the best way ? Is it possible to route the clock to one of the digital pins ?
Yep, just set the right fuse.
Easy way to do so is to create / edit boards.txt and copy and rename (or temp modify) the Uno lines of the fuses. Just past the fuses it uses now into an online fuse calculator and turn on "Clock output on PortB0" and use the fuses it has now in boards.txt. Then reburn the bootloader with the modified or edited board.
Visited the page you linked. Very nicely done. Thanks.
But it looks like its not for the weak of heart to monkey around with the fuse bits ....
If this is what it takes to route the clock to a port pin, I would tend to look at ways of directly probing it on the crystal pins.... Possible at all ?
Sure, you can examine the raw crystal signal pins - but it's not going to be the nice 5 volt peak-to-peak square wave that you'd get with the port output method. You'll see maybe a half volt or so ugly ac signal at the fundamental crystal frequency.
Also, your scope probe may have enough capacitance to possibly load the crystal circuit enough that it may cause things to stop oscillating - so don't be surprised if things suddenly stop working!
avr_fred:
Sure, you can examine the raw crystal signal pins - but it's not going to be the nice 5 volt peak-to-peak square wave that you'd get with the port output method. You'll see maybe a half volt or so ugly ac signal at the fundamental crystal frequency.
Also, your scope probe may have enough capacitance to possibly load the crystal circuit enough that it may cause things to stop oscillating - so don't be surprised if things suddenly stop working!
Great ... this is the response I was expecting. " ....ugly ac signal..." is what I was observing when probing the crystal pins and I thought the something is seriously wrong. In fact that signal is practically of no use since it looked more like noise than signal.
Ok now I have to learn how to mess with the bits and then burn the boot loader. Would be happy to get a Tutorial on this ... I am sure the Arduino ecosystem will sure have it some where ...
I never really figured out how to to do it the nice way with my own boards.txt, but if you edit the normal boards.txt ([Arduino install]\hardware\arduino\avr\boards.txt) and you add this
That should add a new board in the menu. And if you use that to burn the bootloader it will set the fuse to have a clock out. The rest is a copy of the normal Arduino so in normal use there is no difference in selecting this or the normal Uno. And when you want to disable the clock output, just burn the normal bootloader. That will restore the fuses.
Mogaraghu:
I have a 30MHz oscilloscope ( in good working condition ) and would like to see the 16MHz clock waveform on a bare bone Atmega 328P running normally ( at least its blinking the LED at the expected rate ). I am using a 16MHz crystal and two numbers of 22pF capacitors.
Tried to see the waveform ( unsuccessfully ) on one of the crystal pins. Which would be the best way ? Is it possible to route the clock to one of the digital pins ?
Thanks
You will only have a chance of seeing this with 10x selected on your 'scope probe (in general always
use 10x, not 1x, if you want to observe a high frequency or high impedance circuit).
You should be able to see something, try both crystal pins as one is lower impedance than the other.