Poor slew rates on ATmega32 output compare in CTC mode...

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

I am using Timer1 on an Atmega32 to generate an output clock of 9.216MHz (sysclk = 18.432MHz) which will feed some other IC's. I generate the clock in CTC mode, and having the mega toggle the output compare every two cycles (OCR1A = 0). The output passes through a 1K/2K resistor divider to bring it down to 3.3v.

The output of this setup is right on a 9.216MHz, but the slew rate on the waveform is [wrong] intriguing... ;)

Is it my resistor divider that is killing the slew rate on the clock? It works anyways, but I would prefer having a proper waveform if at all possible...

P.S. The scope measurements were taken right after the divider, no load connected to the output..

Config Pind.5 = Output ' OC1A pin as output
Ocr1ah = &H00 : Ocr1al = &H00 ' Set output compare register to output a 9.216MHz clock
Tccr1a = &B01000000 : Tccr1b = &B00001001 ' Configure Timer1 as CTC with output compare toggle

Attachment(s): 

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

Well, what could you measure before the voltage divider?
I don't think a simple voltage divider is an adequate
level shifter for that kind of frequency.

Btw., 18 MHz is out of specs for an ATmega32. If you want
to be on the safe side, upgrade the MCU to an ATmega324P.
It's pin and functional upwards compatible but is spec'd up
to 20 MHz (Vcc > 4.5 V).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

You have forgotten to give the resistor values, and wether the probe in x1 or x10 mode?

The probe will be ~18pF and ~120pF depending on mode, and so if Zo is about 400 ohm, the waveform is about right for 1x mode. 2.7k will produce the waveform together with the probe in x10 mode.

You have to think of the scope probe as a big fat capacitor-resistor-inductor load you add to the node you're inspecting.

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

He..He

Kasper ... You do know that Scope model

/Bingo

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

Hmmm Well I gave ya the resistor values (1KOhm/2KOhm), (I don't think the divider is really the problem) but you might be on to something with the probes... This is not my scope, I didn't think to check the probes (mine are always on x10). I will try to take some measurements again with my own scope... In any case it's working fine to clock the devices, just thought it was weird... :)

Thanks!

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

Quote:

Btw., 18 MHz is out of specs for an ATmega32. If you want
to be on the safe side, upgrade the MCU to an ATmega324P.
It's pin and functional upwards compatible but is spec'd up to 20 MHz (Vcc > 4.5 V).

My middle name is Out of Spec. :D

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

Bingo: I have the unfortunate displeasure, yes. Four of them, 50% failure rate. Got four 840C as replacement, 50% failure rate. 10MHz 0.5V sine input. No reason not to show these pictures again:
http://n1.taur.dk/instekscopes.jpg
http://n1.taur.dk/p1010011.jpg
http://n1.taur.dk/p1010015.jpg

An NC7SZ32 or similar single-gate is 6V tolerant on the input regardless of supply voltate, has a typical propagation delay of ~1ns, comes in a SOT23 package, and is just nice as a level shifter.

edit: oopsie, so you did. Looks about right for an 1x probe.