Setting the frequency (Fuses + Prescaler + CKDIV8)

Status
Not open for further replies.

cosmonavt

Member
I am using an ATTiny13A MCU. I am confused about selecting the frequency of the device. I want it to be the least possible. I know that there is an internal clock of 128kHz and I plan to use that. I know that in order to select the 128kHz clock, I need to modify the low bit of the CKSEL fuse to make the last component 11 in binary.

1. Now where exactly is CKDIV8 located?

According to this page: This Page


We have to change the value of the Fuse Low byte from 0x69 to 0x79 which results in binary value changing from 01101001 to 01111001 (bit number 4 is modified)

Now according to **broken link removed**, the bit number 4 is SUT0 and not CKDIV8. I am confused.

2. Is CKSEL the same for every device?

3. Moreover, if CKDIV8 is not disabled, and I also choose a prescaler value of 1024, will the frequency become (128000/8)/1024 = 15.625?
 
Last edited:
What about the last question? Will the frequency always remain 128kHz /8 or is the division by 8 only during startup? If I choose a prescaler of 1024, will the timer freq be ( 128 / 8 ) / 1024 or simply 128/1024?
 
You mix here 2 different things.

The CKDIV8 Fuse divides the clock for the whole! Controller.
The internal Clock source generates a frequency of 8MHz.
When the CKDIV8 Fuse ist set the whole Clock works at 1MHz.

When using a internal timer it can possibly work with the internal controller clock 8MHz when CKDIV8 is not set, and 1MHz when CKDIV8 is set.

The other thing is the internal prescaler of the according Timer.
Think we use 1MHz Clock for Controller ( internal Clock - CKDIV8 Fuse set ) and the Prescaler for Timer 1 is scaled to 1.
Then the Timer 1 counts up with 1MHz.
When the Prescaler of Timer 1 is switched to a scaling factor of 1024 it counts with a clock of ~976Hz. Another Timer in the same Controller with a divider of 8 counts up with 125kHz.
Idependent of that the Timer can also be clocked from a external clock Signal on according Pins of the Controller. The Timer prescaler works in this case too. CKDIV8 Fuse has then no effect for the Timer clock.

The SUT Fuses access the Start Up Time. Thats the time + clock cycles until the Controller start at line 0 of your programm.
Therefor your programm doesn't run in that period it has no direct effect for your timers.
It only will be used to give pheriphal components time to start up proper, before the controller initialize them.

Few controllers give the possibility to clock a Timer from the internal Watchdog clock.
But this Option was nearly never used.
The Timer section of an ATMEGA Controller is very flexible and so very complex.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…