Using high frequency clock sources for ATMEGA32U4

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

I am using the ATMEGA32U4 chip with the default bootloader. The chip comes with the CKDIV8 fuse bit enabled by default. I want to run the chip at 8MHz. As I am aware, I can simply disable this fuse and use an 8MHz external clock source. But writing fuse bits is not possible via the bootloader and requires the ISP interface. But is there any way to achieve this without using the ISP? For instance, can I use a 64MHz external clock source, so that I get my required 8MHz after the CKDIV8 operation?

Thanks!

This topic has a solution.

Regards,
Frederic Philips

Last Edited: Sun. Dec 23, 2018 - 04:00 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, you can do this from your program - but it may already be done by the bootloader.

 

One way to check is to write a program to blink a LED once per second based on 8MHz

clock, and then time the blinks.

 

 

As shown in the datasheet for the ATmega32U4,  the default clock source

is the low power external Xtal with the CKDIV8 fuse programmed.

 

You can change the the clock prescaler from 8 to 1 inside your program using

clock_prescale_set () located in <avr/power.h>.

#include <avr/power.h>

clock_prescale_set ( clock_div_1);   

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Chuck99,

You are amazing! Your solution solved my issue. Thanks a lot and happy holidays!

Regards,
Frederic Philips