Author Topic: ATmega328PU fuses question  (Read 5036 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1100
  • Country: gb
  • Race car engineer, dog lover, hoarder.
ATmega328PU fuses question
« on: December 11, 2014, 03:11:40 pm »
When I programme a virgin ATmega328PU chip with a firmware from the kit it goes in commercial file pairing the chip seems to "run slow" updates take ages, and when I compare the fuse settings with what they should be, as seen at http://www.chriswilson.tv/fuses.pdf these values are not what the chip has stored. The other settings take and are stored correctly. I manually changed the Calibration figures for a blank space again,  but the last setting for Calibration  has some numbers in it each time, although I set it again as blank. It seems to work OK, is the setting for "Calibration" something that is automatically put in? Do I need to do anything? Thanks. The kit itself is detailed at http://www.gatesgarth.com/u3.pdf   Thanks.
Best regards,

                 Chris Wilson.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 9211
  • Country: de
  • A qualified hobbyist ;)
Re: ATmega328PU fuses question
« Reply #1 on: December 11, 2014, 04:39:47 pm »
The calibration setting is for the internal RC oscillator and is already set by Atmel. There's no need to change it unless you like to re-calibrate the RC oscillator. The default fuse settings for the 328P are:
- LFUSE 0x62
- HFUSE 0xD9
- EFUSE 0xFF

There's a nice online tool at http://www.engbedded.com/fusecalc/ for the fuse settings.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4660
  • Country: us
Re: ATmega328PU fuses question
« Reply #2 on: December 12, 2014, 12:11:22 am »
The factory default settings of the fuses on a m328 are to run using the internal 8MHz clock, additionally divided by 8, to yield a final CPU frequency of 1MHz.   (This has the advantage of always "working" across the entire voltage range of the chip.)  Normally you connect a crystal and set the fuses to (1) use the crystal, and (2) not divide by 8.

The "calibration" is to fine-tune the internal clock, so that it would run 8.0 MHz rather than 7.3MHz or 8.1MHz (that's supposed to be the full range of possible calibration.)  Improper calibration shouldn't cause the chip to run noticeably slow.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: ATmega328PU fuses question
« Reply #3 on: December 12, 2014, 07:12:32 pm »
Some values of OSCCAL can have the chip running more than two times faster than others so improper calibration can be very noticeable.
« Last Edit: December 12, 2014, 07:14:57 pm by paulie »
 

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1100
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Re: ATmega328PU fuses question
« Reply #4 on: December 13, 2014, 10:42:17 am »
Thanks paulie!
Best regards,

                 Chris Wilson.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: ATmega328PU fuses question
« Reply #5 on: December 13, 2014, 12:55:20 pm »
I think the bottom line is that factory OSCCAL values are OK so no need to play with those. Doing so probably causes more problems than it solves.

Fuses on the other hand are very important in order to make the chip work for most applications. The 1mhz factory setting is rarely of much use. Most common is Arduino H=DE L=FF which is easily set by using "burn bootloader" in the IDE. I prefer H=D0 L=E7 which is compatible but has some advantages for me like better POR and preserving EE data. Or L=E2 for running without a crystal.

Fuses are dangerous and number one reason people kill their chip so it pays to be careful and double check before "throwing the switch".
 

Offline MickM

  • Regular Contributor
  • *
  • Posts: 100
Re: ATmega328PU fuses question
« Reply #6 on: December 14, 2014, 12:13:05 pm »
I built one of these:
http://mdiy.pl/atmega-fusebit-doctor-hvpp/?lang=en

It has saved many chips.

Mick M
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: ATmega328PU fuses question
« Reply #7 on: December 14, 2014, 02:24:06 pm »
Thanks for that Mick. Just tried and it works like a charm. I've built many fuse fixers over the years and this is by far the best. In fact IMO best hobby project EVER! Schematics and code and the whole design in general very well done. Hex files for several of the most common AVRs, cheapest components, and minimal circuit. One of the best documented projects I've ever seen too. That guy is a humanitarian genius!

Much better interface (one button) than Avrdude which is probably the biggest chip killer ever invented. I hate that program but it stupidly rose to the top as a result of popular foolishness. Kinda like MS Windows. LOL.
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: ATmega328PU fuses question
« Reply #8 on: December 14, 2014, 08:07:40 pm »
I built one of these (..) It has saved many chips.
Mick M
No RSTDISBL, no fun!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->