Newbie question re programming an ATmega328PU - Page 1
Forum section: electronics / general

author: Chris Wilson
author_rank: Super Contributor
timestamp: December 10, 2014, 09:00:22 pm
content: I need to programme some ATmega 328PU devices using Extreme Burner. I am programming on the board the 328 is socketed to.In Extreme Burner there's an option that comes up to set the crystal frequency or something of that nature. I am not sure if I need concern myself with this. The circuit it controls is here:http://www.gatesgarth.com/u3.pdfThe programme file is provided by the kit designer, it's not something I have tried to createThanks

author: madires
author_rank: Super Contributor
timestamp: December 10, 2014, 09:13:37 pm
content: I think you're talking about the fuses, i.e. LFUSE, HFUSE and EFUSE. Those are used to set the clock source, clock divider, brown out detection and some more stuff. The default settings are internal RC oscillator and 8:1 clock divider, i.e. the ATmega will run with 1 MHz. Based on the circuit diagram you should set the fuses to external crystal and 1:1 clock divider.

author: Chris Wilson
author_rank: Super Contributor
timestamp: December 10, 2014, 09:38:08 pm
content: I would have to run the programming software again to give a proper answer, but it wasn't the fuses, they are set in the firmware files I have, it was something that came up about internal oscillator, external RC oscillator, external crystal oscillator and external high frequency oscillator-------- or something like thatThe menu was only visible once the firmware files were loaded I think. I stopped when I saw this as I wasn't sure how, or whether, to proceed. Thanks madires!

author: wraper
author_rank: Unknown
timestamp: December 10, 2014, 10:14:10 pm
content: Quote from: Chris Wilson on December 10, 2014, 09:38:08 pmYes they are fuses.

author: Chris Wilson
author_rank: Super Contributor
timestamp: December 10, 2014, 10:20:20 pm
content: OK, thanks, may I just ask if all pairings of hex and eep files have the fuse setting data contained within them, or do you sometimes have to set the fuses separately? IE, the fuse data is not within these files. Thanks.

author: madires
author_rank: Super Contributor
timestamp: December 10, 2014, 10:30:58 pm
content: Quote from: Chris Wilson on December 10, 2014, 10:20:20 pmBoth are possibleThe first method is an option, the second one works always.

author: westfw
author_rank: Super Contributor
timestamp: December 11, 2014, 02:46:43 am
content: AVRs are programmed over SPI, which is a clocked serial protocol. Many programmers include an option to change the SPI clock speed, because the maximum speed that works is dependent on the speed that the target chip is running at (1/4 to 1/6 of the clock rate, if I'm reading the datasheet correctly.) If you're running the AVR with a 32kHz watch crystal to achieve extreme low power, then you can't program it with 2MHz SPI communications. This usually shows up in the initial programming of the fuses; a "virgin" 328 runs off the internal 8MHz oscillator, further divided to give a 1MHz CPU clock. Therefore, you can't program it with a 1MHz SPI signal. Once you've programmed the fuses to use a external 16MHz crystal (for example), you can save some programming time by increasing the SPI clock rate.

author: Chris Wilson
author_rank: Super Contributor
timestamp: December 11, 2014, 07:50:53 am
content: Ahh, OK, it's becoming clearer now, thanks for that, much appreciated.