Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

How to change clock speed attiny45 with USBtinyISP
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How to change clock speed attiny45 with USBtinyISP

by Choba on Thu Jun 24, 2010 5:21 pm

Is it even possible? :?

If so, is there a tutorial about it? :)

Thanks
Choba
 
Posts: 16
Joined: Wed Oct 14, 2009 12:20 pm

Re: How to change clock speed attiny45 with USBtinyISP

by mtbf0 on Thu Jun 24, 2010 8:40 pm

what clock source do you want? what speed?

pretty easy to set clock options with avrdude and a usbtiny, but first you have to understand what they are. for that see part six of the tiny45 datasheet.

once you know what you want. find yourself an avr fuse calculator.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: How to change clock speed attiny45 with USBtinyISP

by Choba on Fri Jun 25, 2010 5:03 am

Thanks for the help. :)

For the easylogger I need 16.5Mhz. -> http://www.obdev.at/products/vusb/easylogger.html

So I need to set CKSEL fuse to 0001, page 26 bottom. Is that right?

I found a calculator for it: http://www.engbedded.com/fusecalc/ ,but it is overwhelming with options. :(
Choba
 
Posts: 16
Joined: Wed Oct 14, 2009 12:20 pm

Re: How to change clock speed attiny45 with USBtinyISP

by Choba on Fri Jun 25, 2010 9:09 am

I already tried PLL clock with and without 8 divider, but it does not work. The led does not burn, only on basic settings (divider of 8 ) it burns, but it does not send data. Which I don't understand, because that is 8Mhz clock (1Mhz actually -> divider) - how on earth can it get 16.5Mhz than?

Most simply project and I don't even get it working, it's making me sick this stupid electronics. :cry:
Choba
 
Posts: 16
Joined: Wed Oct 14, 2009 12:20 pm

Re: How to change clock speed attiny45 with USBtinyISP

by franklin97355 on Fri Jun 25, 2010 10:50 am

According to that link the project will work at 12, 15, 16 as well as 16.5. Why not try one of the other speeds?

franklin97355
 
Posts: 21586
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: How to change clock speed attiny45 with USBtinyISP

by Choba on Fri Jun 25, 2010 2:58 pm

franklin97355 wrote:According to that link the project will work at 12, 15, 16 as well as 16.5. Why not try one of the other speeds?


I only see 8Mhz and 6.4Mhz as internal clock for attiny45.
Choba
 
Posts: 16
Joined: Wed Oct 14, 2009 12:20 pm

Re: How to change clock speed attiny45 with USBtinyISP

by franklin97355 on Fri Jun 25, 2010 9:54 pm

Since I'm not building this I have to take their word for it.
CPU CORE CLOCK FREQUENCY
========================
We supply assembler modules for clock frequencies of 12 MHz, 15 MHz, 16 MHz and
16.5 MHz. Other clock rates are not supported. The actual clock rate must be
configured in usbdrv.h unless you use the default 12 MHz.

12 MHz Clock
This is the traditional clock rate of AVR-USB because it's the lowest clock
rate where the timing constraints of the USB spec can be met.

15 MHz Clock
Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock
rate allows for some loops which make the resulting code size somewhat smaller
than the 12 MHz version.

16 MHz Clock
This clock rate has been added for users of the Arduino board and other
ready-made boards which come with a fixed 16 MHz crystal. It's also an option
if you need the slightly higher clock rate for performance reasons. Since
16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
is somewhat tricky and has to insert a leap cycle every third byte.

16.5 MHz Clock
The assembler module for this clock rate differs from the other modules because
it has been built for an RC oscillator with only 1% precision. The receiver
code inserts leap cycles to compensate for clock deviations. 1% is also the
precision which can be achieved by calibrating the internal RC oscillator of
the AVR. Please note that only AVRs with internal 64 MHz PLL oscillator can be
used since the 8 MHz RC oscillator cannot be trimmed up to 16.5 MHz. This
includes the very popular ATTiny25, ATTiny45, ATTiny85 series as well as the
ATTiny26.

We recommend that you obtain appropriate calibration values for 16.5 MHz core
clock at programming time and store it in flash or EEPROM or compute the value
from a reference clock at run time. Atmel's 8 MHz calibration is much more
precise than the guaranteed 10% and it's therefore often possible to work with
a fixed offset from this value, but it may be out of range.

franklin97355
 
Posts: 21586
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: How to change clock speed attiny45 with USBtinyISP

by mtbf0 on Fri Jun 25, 2010 11:53 pm

according to the project's README file
Code: Select all | TOGGLE FULL SIZE
make fuse

see the MAKEFILE for the fuse settings.
"i want to lead a dissipate existence, play scratchy records and enjoy my decline" - iggy pop, i need more
User avatar
mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am
Location: oakland ca

Re: How to change clock speed attiny45 with USBtinyISP

by Choba on Sat Jun 26, 2010 7:29 am

Thank you so much guys! It is working! :D :D

mtbf0 wrote:according to the project's README file
Code: Select all | TOGGLE FULL SIZE
make fuse

see the MAKEFILE for the fuse settings.


That was the golden tip. In the makefile it said this:

-U lfuse:w:0xe1:m

And that is what I needed. I was actually pretty close, I already tried 0xe2.

I also had to change two pins the green and white one from usb.

My room temperature:
275
277
277
277
275
275
275
260
275
275
275
275
275
275
275
275
275
275
Choba
 
Posts: 16
Joined: Wed Oct 14, 2009 12:20 pm

Re: How to change clock speed attiny45 with USBtinyISP

by Entropy on Mon Jun 28, 2010 10:29 am

It also looks like on some ATTiny45s (batch-to-batch variance), you might need to tune the oscillator a bit to get the right speed. (No clue exactly how that needs to be done.)
Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Please be positive and constructive with your questions and comments.