Author Topic: Newbie question re programming an ATmega328PU  (Read 3996 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.
Newbie question re programming an ATmega328PU
« on: December 10, 2014, 09:00:22 pm »
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.pdf


The programme file is provided by the kit designer, it's not something I have tried to create ;)

Thanks
Best regards,

                 Chris Wilson.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 9204
  • Country: de
  • A qualified hobbyist ;)
Re: Newbie question re programming an ATmega328PU
« Reply #1 on: December 10, 2014, 09:13:37 pm »
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.
 

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1100
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Re: Newbie question re programming an ATmega328PU
« Reply #2 on: December 10, 2014, 09:38:08 pm »
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 that :) The 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!
Best regards,

                 Chris Wilson.
 

Online wraper

  • Supporter
  • ****
  • Posts: 19511
  • Country: lv
Re: Newbie question re programming an ATmega328PU
« Reply #3 on: December 10, 2014, 10:14:10 pm »
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 that :) The 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!
Yes they are fuses.
 

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1100
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Re: Newbie question re programming an ATmega328PU
« Reply #4 on: December 10, 2014, 10:20:20 pm »
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.
Best regards,

                 Chris Wilson.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 9204
  • Country: de
  • A qualified hobbyist ;)
Re: Newbie question re programming an ATmega328PU
« Reply #5 on: December 10, 2014, 10:30:58 pm »
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.

Both are possible ;) The first method is an option, the second one works always.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4660
  • Country: us
Re: Newbie question re programming an ATmega328PU
« Reply #6 on: December 11, 2014, 02:46:43 am »
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.
 

Offline Chris WilsonTopic starter

  • Super Contributor
  • ***
  • Posts: 1100
  • Country: gb
  • Race car engineer, dog lover, hoarder.
Re: Newbie question re programming an ATmega328PU
« Reply #7 on: December 11, 2014, 07:50:53 am »
Ahh, OK, it's becoming clearer now, thanks for that, much appreciated.
Best regards,

                 Chris Wilson.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->