Why an Attiny85 running at 8MHz is under clocked when programming with Arduino.

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.

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

strykeroz:
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?

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 :slight_smile:
Geoff

strykeroz:
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 :slight_smile:
Geoff

Thanks for the help Geoff! Very much appreciated :slight_smile:

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 :slight_smile:

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!

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

Thank you.