Can't find CLK(I/O) description?

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I am using an ATmega8L with the internal RC oscillator (at 8MHz clock speed). I found a picture of the clock distributions, but no description of the relationship of CLKcpu and CLKi/o (the CPU clock and the I/O clock).

Are they related by some divisor?

Thanks!

-- Steven

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

freq(CLKio)=freq(CLKcpu)

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm having the same trouble with the ATMega88. The data sheet doesn't appear to show this relationship. Does anybody out there know the answer??

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My understanding is that they are all the same clock and the only differentiation that happens in that block called "AVR Clock Control Unit" in figure 7-1 on page 27 is that the individually labelled clocks can be separately enabled/disabled by that "Control Unit" as explained in Chapter 8 for various sleep modes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm...I must be doing something wrong. I'm running at 20 MHz which I've verified by writing code that continually toggles a hardware bit and measuring the result on a scope. However, it appears that CLKi/o is running at 10Mhz. I try to set up the timer according to the data sheet but the actual result is always off by a factor of 2. I'm about ready to give up and just accept the factor of 2 but I'd like to know for sure where it is coming from. Any thoughts?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I'm running at 20 MHz which I've verified by writing code that continually toggles a hardware bit and measuring the result on a scope. However, it appears that CLKi/o is running at 10Mhz.

Let's see that code--loops don't loop with 0 cycles. You can of course unroll and get a burst of pin toggles. The fastest pin toggle will indeed be clk/2 or read as a 10MHz signal on your 'scope.

Quote:
with the ATMega88.

Is your AVR really running at the speed you think it is?

If you enable CLKO pin with the CKOUT fuse, what do you see?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't make a loop, I just did a long sequence of
PORTX = 0;
PORTX = 1;
PORTX = 0;
PORTX = 1;
:
:
I looked at the listing generating and found there would be two instructions per bit toggle. This resulted in the 10 Mhz signal which I measured on the scope. For further verification I also enabled the CLKO pin as you suggested. I do see 20 MHz there.

Ugh...I just figured out my problem. I was toggling a port bit in my timer interrupt. For some dumb reason I was expecting the port output to be the frequency I was setting the timer to. But since I'm toggling, the frequency of my output signal is half that of the timer frequency. There's my factor of 2.

Thanks!