Xtal with Atmega32

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

Hello

I'm trying to connect a 16Mhz quartz crystal to my atmega 32.

I've read that setting wrong fuses is dangerous so
I want to consult with more experienced members first before doing it .
I've also read some posts on google etc but I can't find relevant information.

So I know that I have to connect the Xtal to the XTAL pins on my Atmega32 and I need to connect both pins to ground through 12-22pF ceramic caps.

Question 1 :
Can I/do I have to programm the fuses in my main routine with the CKSEL or/and OSCCAL registers ?

I see that I can set the CKSEL fuses in the device programming section in Atmel studio 6 but I can't see any fuses which would show an external oscillator and 16 mhz .

Could someone guide me in this ? I've read the datasheets and i'm abit confused .

I use Atmel studio 6.1

I don't need the frequency to be accurate. I just need it to run at about 16Mhz

Thanks in advance

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

Also , I don't fully understand startup times .
Do they really matter for non-critical applications ?
The way I understand it is that you set fuses which determine how long it takes for the micro to start up after you are apply power . Is that right?

I also want to mention that I am powering the atmega32 with 5volts from a regulator IC

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

The oscillator does not start very fast: it takes some time to have a stabilized frequency, and one cannot rely on the Xal before : assuming a long startup time is wise...

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

dbrion0606 wrote:
The oscillator does not start very fast: it takes some time to have a stabilized frequency, and one cannot rely on the Xal before : assuming a long startup time is wise...

Ok thanks , so since my application isn't a critical one , I should go with the longest startup time .

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

Beware - you don't want to select "external oscillator"! you want "external crystal".

Select external oscillator and the chip will stop immediately.

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

Kartman wrote:
Beware - you don't want to select "external oscillator"! you want "external crystal".

Select external oscillator and the chip will stop immediately.

Select it where?
Using registers in my main routine or
in 'device programing' section?

Yes I read that selecting an external osc will stop the chip and I would need to apply an external clock to be able to reprogram the chip

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

There is only one place where you can change the fuses.

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

Quote:

There is only one place where you can change the fuses.

and that is:
Quote:

in 'device programing' section?

Before you do anything read my tutorial:

https://www.avrfreaks.net/index.p...

Then you'll know what potential problems you may be up against and how to fix them. The good news for you is that the mega32 does not have the very dangerous RSTDISBL fuse so you should always be able to "get back" if you do the wrong thing.

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

Kartman wrote:
There is only one place where you can change the fuses.

Sorry i'm still a beginner so pardon the stupid questions.

So I can change the fuses in the 'Device Programming" in atmel studio , but as I said :

In the fuses section in device programming there is a fuse named : SUT_CKSEL , and when I click on it there is a dropdown menu where I can select all the clock sources . I'm guessing this is where I have to do it but I cannot find a fuse that says 16mhz.

The biggest one is EXTROSC_8MHZ_12MHZ_6CK_4MS

EDIT:

Oh wait , I see one which is :

EXTHIFXTALRES_16KCK_64 ms

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

Quote:

Before you do anything read my tutorial:

https://www.avrfreaks.net/index.p... ... p;t=106325

Great!! Thanks . I'll read it now before pressing any dangerous buttons

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

Someone at Atmel deserves to be shot. In AS4 (and copied on engbedded.com as shown in the following picture) the programming dialog in Studio used to have meaningful wording which human beings could understand. Now in AS6 it has meaningless gobbledigook that no one understands (see other picture). I have reported this to Atmel. They said they'd "fix it". So far no evidence forthcoming that they actually meant that. My second picture highlights the option you SHOULD choose.

Attachment(s): 

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

Thanks alot Clawson, I will preparing my Dragunov shortly :)
Yes that was the fuse bit that my finger was twitching over . I'm going to try it now.

Also thanks for the tutorial , interesting info.