Go Down

Topic: chip is "slow" .. clock/frequency probl (Read 1 time) previous topic - next topic

Gargamel

Jun 14, 2009, 11:37 am Last Edit: Jun 14, 2009, 11:41 am by Gargamel Reason: 1
Hello everyone (this is my first post on forum here)

I recently found Arduino and completely fell for it, I started a bit hard way (but the cheapest => easiest for me)
I built a breadboard with ATmega8 and parallel programmer for it
For uploading I use avrdude (from linux)
I did not done the bootloading (I don't see it necessary)
Everything works fine except way too slow:

Blink doesn't blink once per second but per circa 15s
I found out that it's probably the clock problem ... so I physically removed the 16MHz clock and capacitators and found out that it works even without them, with the same speed

Can you tell me what can be wrong on the external clock? Is the external clock really needed? Is it there for performance purposes? How much can I lose/get by using/not the external clock?

fdufnews

The processor can run with an external clock or with its own internal RC calibrated clock (1MHz).
It seems that you are running on the internal clock. By default the atMega processors are shipped with the fuses programmed to run this internal clock.
You can tell the processor which clock to use at program time. There are fuses to set this. Look at the atMega datasheet. and/or help screen of AVRDUDE.

Gargamel

that will be the case, thanks
I'll stick with internal 1MHz clock - for testing I don't need more
and I'll look on this later, but if anyone got commands for switching internal/external clock at hand, I'll be happy if you paste it here ;o)

condemned

The fuses you want are lfuse = 0xff, hfuse = 0xc9 so try the following:

         avrdude -p atmega8 -P lpt1 -c dapa -U lfuse:w:0xff:m -U hfuse:w:0xc9:m

Note: lpt1 and dapa are guesses - something tells me that the lpt1 in particular is wrong for a linux box.

I tend to use an online fuse calculator now (such as http://www.engbedded.com/fusecalc/) rather than bend my head around the datasheet.

Gargamel

condemned, thanks
just for info - about the port - on the machine I use for this it's (for god's sake) ubuntu and there it is "paraport0"

anyway, thanks for command and really thanks for calculator - it will take me some time to understand it but it looks really useful :o)

Gargamel

guys, I tried LED fading on PWM pins and when value is anything lower than 255 the LED is blinking rapidly ... sorry to ask, but does this reflect the square waves of PWM output? I thought those are not noticeable by human eye?
or will I need the external 16MHz clock to influence this to be 16 times faster and after that it will become unnoticeable?

Grumpy_Mike

Quote
ut does this reflect the square waves of PWM output?


Yes.

Quote
will I need the external 16MHz clock to influence this to be 16 times faster and after that it will become unnoticeable?


Again yes

AWOL

If the standard (at 16MHz) PWM frequency is around 490Hz, then at 1MHz, the PWM frequency will be 490/16 = just over 30Hz - easily visible flicker.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up