atmega2560 clock/oscillator selection new project

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

hello,

 

I start a new project with an ATMega2560-16u, but i don't understand how I can select the good clock source for the device...

 

it should exist some selection boxes for internal (RC) or external (XTAL) oscillator but there are no boxes availables in online or installed Atmel-Studio ... (see joined files)

 

On the integrated programming tool, I can select the correct clock source I want to use, but only as values in fuses regiters, but how can I be sure

that is really stored in the production files generated ?

 

how can I be sure of the results and how can I modify easily these settings if I need ?

 

Thierry

Attachment(s): 

Last Edited: Sat. Jun 15, 2019 - 11:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Usually for production use you script the programming application to set the fuses - you normally wouldn't have them part of your project.

 

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

Hello,

 

which script you talk about ? I never see any script while generating a project (I try many differents),

 

where is the information for the fuses that will be put in the ELF file ?

 

And so how can I select the correct oscillator for my project ?

 

Thanks.

 

Thierry

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

Do this to include fuse information in the ELF.
See fuse.h for details.

Sorry, I do not use AtmelSTART, so I do not know how to set it up.

 

#include <avr/io.h>

FUSES =
{
    .low = LFUSE_DEFAULT,
    .high = (FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_EESAVE & FUSE_SPIEN & FUSE_JTAGEN),
    .extended = EFUSE_DEFAULT,
};

int main(void)
{
    /* Replace with your application code */
    while (1) 
    {
    }
}

 

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

thierry91 wrote:
which script you talk about ?

The script you create to drive the production flash and fuse programming, usually a DOS batch file or linux shell script.

Here is an example of one I use to program a t25 using the avrdragon in a DOS batch file.

cd "c:\program files (x86)\Atmel\AVR Tools\AvrDragon\"
avrdragon.exe -dATtiny25 -I125000 -q -y -e -s -pb -vb -mi -if"c:\Users\Jim\Desktop\LLSC-Dev\LLSC.hex" -ie"c:\Users\Jim\Desktop\LLSC-Dev\LLSC.eep" -f0xD462 -l0xFC -E0xFF -F0xD462 -L0xFC -G0xFF
pause

Using avrdude or atprogram would be similar.

 

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...