Go Down

Topic: Attiny85 forced to 8MHz (Read 7361 times) previous topic - next topic

ProfePaco

Dec 17, 2011, 12:27 am Last Edit: Dec 17, 2011, 12:30 am by ProfePaco Reason: 1
I need that my small Attiny85 runs at 8Mhz because it has to make some FFT...

I am a bit lost... I promise you that I have read some threads... but I have problems to summarize the info.

I know how to use the Arduino Uno as a programmer. I know that I have to modify the boards.txt. But there is something about fuses that I cannot understand.

First step. This is the original boards.txt, showing only the part corresponding to UNO as a programmer:

attiny85arduinoisp.name=ATtiny85 (w/ Arduino as ISP)
attiny85arduinoisp.upload.using=arduino:arduinoisp
attiny85arduinoisp.upload.maximum_size=8192
attiny85arduinoisp.build.mcu=attiny85
attiny85arduinoisp.build.f_cpu=1000000L
attiny85arduinoisp.build.core=attiny45_85

so I have to modify the frequency:
attiny85arduinoisp.build.f_cpu=8000000L

Ok. Now, I think I have to add some lines about fuses... right?

What lines? I read in one thread that even writing these additional lines, it will not work if i do not flash a bootloader  ?????

Any help?

Thanks in advance.


johnwasser

Writing the flags is done as part of the Write bootloader process in the Arduino IDE.  If you are familiar with 'avrdude' you can use it to write fuses.

If your ATtiny85 is like most factory chips it comes with the clock set to 8MHz and the pre-scaler flag set to initialize the pre-scaler to divide by 8, resulting in a cycle rate of 1MHz.  You can change the pre-scaler in code: just set CLKPR = 0x80; (to enable changes) and CLKPR = 0x00; (to set the divisor to 1).
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

ProfePaco


Writing the flags is done as part of the Write bootloader process in the Arduino IDE.  If you are familiar with 'avrdude' you can use it to write fuses.

If your ATtiny85 is like most factory chips it comes with the clock set to 8MHz and the pre-scaler flag set to initialize the pre-scaler to divide by 8, resulting in a cycle rate of 1MHz.  You can change the pre-scaler in code: just set CLKPR = 0x80; (to enable changes) and CLKPR = 0x00; (to set the divisor to 1).


OK, thanks a lot for the info. Although I am a newbie and I need some clarifications.

1.- Can I do it with Arduino Uno, or do I have to use avrdude to set fuses? I am not familiar with avrdude. I have just have a look to its webpage and it is a bit scaring.

2.- "just set CLKPR = 0x80; (to enable changes) and CLKPR = 0x00;" You have repeated CLKPR twice, is this correct?

3.- Do I need to write something in the boards.txt file?

4.- I would like to write a tuto for everybody (it seems the information is divided in many places). I think these tiny chips are interesting, but the only drawback is the low default frequency. If we write a tuto more people can use these processors.

Thanks,

Francisco

Coding Badly


Ensure the Arduino IDE is not running.

Download and install the core from here...
http://code.google.com/p/arduino-tiny/
http://code.google.com/p/arduino-tiny/downloads/detail?name=arduino-tiny-0022-0008.zip
Instructions are in the readme.txt file.

Ensure the Uno and ATtiny85 are correctly connected and that the Uno is acting as a programmer (I believe you've already done this).

Start the Arduino IDE.

Select the correct "board" (ATtiny85 @ 8 MHz  (internal oscillator; BOD disabled))

Execute the menu item Tools / Burn Bootloader / Arduino as ISP.

The message "Done burning bootloader" should be displayed just above the status window.

This does not install a bootloader but changes the fuses so the processor runs at 8 MHz using the internal oscillator.  It's also a handy way of "erasing" the processor when switching between projects.

lemming

Quote
This does not install a bootloader ......


I would have followed these same steps to load the bootloader as well as burn the fuses.
(the "Done burning bootloader" message is a bit deceptive)

What should I do to load the bootloader and burn the fuses as well?

Coding Badly


You will need to find a functional bootloader for an ATtiny85 processor.

lemming

Seeing the IDE is not loading a bootloader, should I assume that the fuses are being set to run the processor without a bootloader?

Coding Badly


There really are no "bootloader" fuses (or lock-bits) for the ATtiny85 family.  So the answer will always be "yes, the fuses are being set to run the processor without a bootloader".

Go Up