Pages: [1]   Go Down
Author Topic: Why an Attiny85 running at 8MHz is under clocked when programming with Arduino.  (Read 1243 times)
0 Members and 1 Guest are viewing this topic.
Westbrook, CT
Offline Offline
Full Member
***
Karma: 2
Posts: 139
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys, I'm now working on a project were two devices have to communicate with each other. The devices are an Attiny85 and an Arduino UNO. It's crucial to me that they work at a same pace. When I was doing previous projects that consisted of an Attiny85 I ran it at 1Mhz since the timing was the closest to the Arduino UNO. I didn't select any other frequencies because they were way off timed. Plus the projects were simple, consisting of just few leds or servo's.

However, now I'm using a library that requires devices to run at least 8Mhz and when I upload a sketch to the Attiny85 using Arduino UNO as an ISCP and while clicking Tools > Board > Attiny85 @ 8MHz (internal oscillator; BOD disabled) the sketch starts to run incredibly slower.
Note: the board options are from an aditional library

For Example:
If I take a sketch that everybody is familiar with, which is the blink sketch that blinks the famous LED on pin 13 on Arduino boards once every two seconds and upload it to the Attiny85 selecting the 8Mhz option (obviously changing the led number 13 to a number from 0 to 4 which corresponds to the pins on the Attiny85). I get a LED blinker that dosent blink every two seconds but instead blinks every ˜10-15 seconds.

So obviously there is a problem with the configuration with the internal clock but I'm sure that I misconfigured something too.

I hope my point was clear. Help would be appreciated,
miXania.


* Screen Shot 2013-03-17 at 5.55.37 PM.png (256.01 KB, 1072x900 - viewed 42 times.)
« Last Edit: March 17, 2013, 05:02:38 pm by mixania » Logged

Arduino Uno R3
Mac OSX Lion


Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1122
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Sounds like you missed the step of burning the bootloader to set the 8MHz fuses (or you did, but it didn't work).  You can still upload the sketch to the 8MHz selection but it will be run 8x slower.  So your 2 second flash comes out around 16sec.

Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Westbrook, CT
Offline Offline
Full Member
***
Karma: 2
Posts: 139
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Sounds like you missed the step of burning the bootloader to set the 8MHz fuses (or you did, but it didn't work). You can still upload the sketch to the 8MHz selection but it will be run 8x slower.  So your 2 second flash comes out around 16sec.

Geoff

I did in fact miss the step with the bootloader. I tried it before but when I followed a tutorial that I found on Internet it didn't work. Can you give a link that describes how to do it?

Do I just have to connect the RESET, SCK, MOSI and MISO from the Attiny85 to the Arduino, select the Attiny85 in the board options and click Tools > Burn Bootloader ?
 Is this right?
Logged

Arduino Uno R3
Mac OSX Lion


Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1122
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

Just have the ATTiny connected as you do for programming it, select the target as Tools>Board>Attiny85 @ 8MHz (internal oscillator; BOD disabled) and then use the burn bootloader menu option.  After a few seconds you'll get the same PAGEL warnings (4 times IIRC) to confirm that it all worked.

That's truly all there is to it smiley
Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Westbrook, CT
Offline Offline
Full Member
***
Karma: 2
Posts: 139
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

Just have the ATTiny connected as you do for programming it, select the target as Tools>Board>Attiny85 @ 8MHz (internal oscillator; BOD disabled) and then use the burn bootloader menu option.  After a few seconds you'll get the same PAGEL warnings (4 times IIRC) to confirm that it all worked.

That's truly all there is to it smiley
Geoff

Thanks for the help Geoff! Very much appreciated smiley
Logged

Arduino Uno R3
Mac OSX Lion


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Tips here for minimal boards: http://www.gammon.com.au/forum/?id=11637

Those chips ship by default with the "divide by 8" fuse set.
Logged


Westbrook, CT
Offline Offline
Full Member
***
Karma: 2
Posts: 139
"Why should I bother with made-up games when there are so many real ones going on." (c) Kurt Vonnegut
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Tips here for minimal boards: http://www.gammon.com.au/forum/?id=11637

Those chips ship by default with the "divide by 8" fuse set.

Wow! Thanks for the link. I love your site by the way, Its very helpful smiley
Logged

Arduino Uno R3
Mac OSX Lion


Pensacola FL
Offline Offline
Jr. Member
**
Karma: 2
Posts: 68
"I've forgotten more than I care to remember!" Capt. Jack Grass
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Doh!  (as Bart Simpson would say)  I'd done an attiny project two months ago.  Was just doing another. Tested great on the Uno, but time was all wrong on the attiny.   FORGOT  (I've forgotten more than I care to remember) the step!   DOH!  My mind is a terrible thing!
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18810
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow! Thanks for the link. I love your site by the way, Its very helpful smiley

Thank you.
Logged


Pages: [1]   Go Up
Jump to: