Pages: [1]   Go Down
Author Topic: chip is "slow" .. clock/frequency probl  (Read 1011 times)
0 Members and 1 Guest are viewing this topic.
Brno, CZ
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: June 14, 2009, 04:41:53 am by Gargamel » Logged

France
Offline Offline
Faraday Member
**
Karma: 23
Posts: 3010
There is an Arduino for that
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brno, CZ
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Oxford (England)
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brno, CZ
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Brno, CZ
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 506
Posts: 31345
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Pages: [1]   Go Up
Jump to: