Go Down

### Topic: "Divide Clock by 8" fuse in order to use 16MHz RC oscillator for low voltage? (Read 5722 times)previous topic - next topic

#### halfdome

##### Aug 18, 2014, 04:49 pmLast Edit: Aug 18, 2014, 04:56 pm by halfdome Reason: 1
The  Arduino (Mini) Board (ATmega328P) runs with 5V at 16 MHz with a RC oscillator. If I want to run it at a lower Vcc (eg 3V), the 16 MHz are out of spec.
I know the formula in the datasheet, however, I am uncertain whether the mentioned clock rate corresponds to the frequency before or after the clock divider.

So I am wondering if the fusebit "Divide Clock by 8" would solve this problem. So externaly the µC would still see 16 MHz but internally the frequency would be 2MHz. Is this inside the specification again at ~3V?

#### fungus

The datasheet says that 3V is enough for about 10MHz so it should be in spec if you do that.

OTOH functions like millis() will stop working correctly. You might need to edit boards.txt to fix that.

#### halfdome

I know what the datasheet says about clock rates and voltages.

What I am uncertain about is whether the clock rate is the "input clock rate" or the "downscaled clock rate" if the fuse bit "Divide Clock by 8" is turned on.

#### JChristensen

#3
##### Aug 18, 2014, 05:16 pmLast Edit: Aug 18, 2014, 05:21 pm by Jack Christensen Reason: 1
I've wondered the same thing. So the question really is whether the oscillator is within spec e.g. at 16MHz and 3V, even though the CPU is within spec with the CKDIV8 fuse bit programmed.

PS: I think the answer is YES based on Note 3 on p29 of the datasheet:

Quote
3. If the crystal frequency exceeds the specification of the device (depends on VCC), the CKDIV8 Fuse can be programmed in order to divide the internal frequency by 8. It must be ensured that the resulting divided clock meets the frequency specification of the device.

That note is for the low-power XO and there are similar notes for the full-swing XO and for the internal RC osc.

#### fungus

I think the fuse bit only applies to the internal 8MHz clock.

There's another prescaler that you can write to in software:

Code: [Select]
`"8.12.2 CLKPR - Clock Prescale RegisterBits 3..0 - CLKPS3..0: Clock Prescaler Select Bits 3 - 0These bits define the division factor between the selected clock source and the internal system clock.These bits can be written run-time to vary the clock frequency to suit the application requirements. As the divider divides the master clock input to the MCU, the speed of all synchronous peripherals is reduced when a division factor is used.`

#### JChristensen

I think the fuse bit only applies to the internal 8MHz clock.

Not so, see Reply #3 above. The CKDIV8 fuse bit just determines the initial value of CLKPR. If CKDIV8 is set, then CLKPR is set to divide by eight, else, it's set to divide by one.

Quote
The  Arduino (Mini) Board (ATmega328P) runs with 5V at 16 MHz with a RC oscillator.
Incorrect. A resonator is used, which is not the same at as an RC oscillator.

Do you have a programmer? It's simple enough to change the fuses in boards.txt to enable the divide by 8 circuit to run at 2 MHz and see how things look.
Change the speed there to 2000000UL as well.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Copy this section, rename pro328 to something else - pro3282MHz ? and change the indicated lines:
Code: [Select]
`##############################################################pro3282MHz.name=Arduino Pro Mini (3.3V, 2 MHz) w/ ATmega328P  <<< all linespro328.upload.protocol=arduinopro328.upload.maximum_size=30720pro328.upload.speed=57600pro328.bootloader.low_fuses=0xFF <<< 0x7F - bit 7 enables devide clock by 8pro328.bootloader.high_fuses=0xDApro328.bootloader.extended_fuses=0x05pro328.bootloader.path=atmegapro328.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hexpro328.bootloader.unlock_bits=0x3Fpro328.bootloader.lock_bits=0x0Fpro328.build.mcu=atmega328ppro328.build.f_cpu=8000000L <<< 2000000Lpro328.build.core=arduinopro328.build.variant=standard##############################################################`
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

The CKDIV8 fuse bit just determines the initial value of CLKPR.

Which means that @halfdome could change the divisor to two in setup resulting in the processor running at 8 MHz.  The processor would always be within specifications for 3 volts but the final speed would be more reasonable.

#### JChristensen

The CKDIV8 fuse bit just determines the initial value of CLKPR.

Which means that @halfdome could change the divisor to two in setup resulting in the processor running at 8 MHz.  The processor would always be within specifications for 3 volts but the final speed would be more reasonable.

Well, the processor would be within spec except for the code executed before setting CLKPR

I agree.  After rereading it my post is confusing.  I meant have the CKDIV8 fuse bit set and adjust the divisor in setup.  Initialization would be at 2 MHz.  Everything else would be at 8 MHz.

#### JChristensen

I agree.  After rereading it my post is confusing.  I meant have the CKDIV8 fuse bit set and adjust the divisor in setup.  Initialization would be at 2 MHz.  Everything else would be at 8 MHz.

What can I say, I can't help picking nits.  Although a person might get away with it the other way around, I can't recommend it.

Go Up