How do I unselect the CLKDIV fuse?

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

Hi Freaks,
I am using a M328P and would like to turn the CLKDIV8 fuse off primarily to increase my serial comm. speed with the same crystal (8Mhz). I am using AVRStudio and I tried to turn it off but it would not. Do I need HVPP to do this?

Thanks.

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

No you can adjust that fuse by ISP just like any other but possibly an easier option than changing the fuse (and will make the software independent of its setting) is to change its effect in software.

All CKDIV8 fuse does is set the initial value of the CLKPR register to the /8 setting. To over-ride this, early in your code do:

// following only for mega48/88/168....
	CLKPR = (1 << CLKPCE); // enable a change to CLKPR
	CLKPR = 0; // set the CLKDIV to 0 - was 0011b = div by 8 taking 8MHz to 1MHz

Cliff

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

I will look at the datasheet but does it work for the 328P?

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

Yes. Any AVR that has CKDIV8 has a CLKPR register because all CKDIV8 does is set the default value for that register which can be changed in software.

Note that if you put the code to change it at the start of main() in C then the whole of the C pre-amble may run at the divided clock speed - so you may want to investigate how your C compiler allows you to put code BEFORE the C pre-amble runs (in GCC this involves putting code into the .init3 section)

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

Hi

I have following problem with Fuse settings. I have ATMEGA 32M1AD15 and AVR Studio + JTAGICE Mk II. I have two identically proto boards. Other one works fine and I can change it's fuse settings but other proto I accidentaly left DIV8 Fuse enabled and it works now 8 times too slowly.
I have tried all different fuse programming speeds down to 51.1 hz. Still all fuse settings remain unattached. Is there some way to put extra high programming voltage to help on this kind of issue or do I have an "mission impossible " chip on my board?

Also programming fails.

This "problem" chip might have got overvoltage spikes during analog part testing. But software is working well but 8 times too slowly

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

When you change to 51.1kHz (I presume you mean kHz not Hz ??) did you actually press the [write] button for the new selection to be passed to the JTAGICEmkII programmer?

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

clawson wrote:
When you change to 51.1kHz (I presume you mean kHz not Hz ??) did you actually press the [write] button for the new selection to be passed to the JTAGICEmkII programmer?

Oh Yes, 51Hz is correct. Yes I pressed write.
Hannu

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

HannuS wrote:
clawson wrote:
When you change to 51.1kHz (I presume you mean kHz not Hz ??) did you actually press the [write] button for the new selection to be passed to the JTAGICEmkII programmer?

Oh Yes, 51Hz is correct. Yes I pressed write.
Hannu
If you operate AVRstudio as accurately as you write here, then you'd better check again what you are doing.

Stealing Proteus doesn't make you an engineer.

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

ArnoldB wrote:
HannuS wrote:
clawson wrote:
When you change to 51.1kHz (I presume you mean kHz not Hz ??) did you actually press the [write] button for the new selection to be passed to the JTAGICEmkII programmer?

Oh Yes, 51Hz is correct. Yes I pressed write.
Hannu
If you operate AVRstudio as accurately as you write here, then you'd better check again what you are doing.

All Right. I need to confess I was a bit hurry when i flashed my device. Presumable I made something wrong. I also tried 200- 500Hz external clock generator and again together with this very low 51Hz ISP frequency, but still all mys Fuses remains unattached. I can make erasing in Main window but software does not disappers from the internal flash.

My fuse programming operation says following:
Writing fuses 0 to 2 0xFF, 0xDF, OxFF ..OK
Reading Fuses 0 to 2 0x7F, 0xDF, 0xFF.. OK
Warning Fuse bits verification FAILED

Edit:
Now I decided to give up. I changed the chip. Now everything works fine.
Maybe the fuse's are the most vulnerable part of the Atmega device. Obviously I need to improve voltage spike filtering of the voltage supply.

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

You cannot program flash with less than about 6KHz clock.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly