Author Topic: using external crystal  (Read 4491 times)

0 Members and 1 Guest are viewing this topic.

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
using external crystal
« on: March 09, 2008, 09:28:23 AM »
i want to use a external crystal for my next project can anyone tell me how do i connect the crystal most probably to an atmega16 or32(circuit description) and also if any kind of programming needs to done to initialize the crystal
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Steel_monkey

  • Full Member
  • ***
  • Posts: 85
  • Helpful? 0
Re: using external crystal
« Reply #1 on: March 09, 2008, 10:20:50 AM »
In short words, if you are going to use high-speed (>400 KHz) crystal, you need to connect leads of the crystal to XTAL1 and XTAL2 pins of your MCU and ground each connection with 22 pF capacitor. As a result, you need 1 crystal and 2 capacitors. The closer the crystal to MCU the better.
The, you need to set fuse bits with your download program using download cable (like hex downloading). It is possible to make a mistake while setting up fuses and then MCU stop working, so special care must be taken. Sometimes, in download program, fuse bits are inverted.  The best way is first read initial bit setup and refer with datasheet (initial configuration is mentioned there), and then set up what you need. Datasheet:   www.atmel.com/dyn/resources/prod_documents/doc2466.pdf
Circuit description: www.atmel.com/dyn/resources/prod_documents/doc2521.pdf
 

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #2 on: March 09, 2008, 10:59:27 AM »
yes but how do u program the fuse bits since i have got no idea i am seeking ur advice as playing with the fuse bits can be really dangerous
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: using external crystal
« Reply #3 on: March 09, 2008, 11:32:26 AM »
you can do so using ponyprog , it has a special button to change fuses
check the datasheet for the right option of fuses and change em using ponyprog
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #4 on: March 09, 2008, 11:46:02 AM »
well yes but since iam using homemade bsd proggrammer i cant use ponyprog as it works only with winavr thats why i needed to know how to change the fuse bits the hard way :(
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: using external crystal
« Reply #5 on: March 09, 2008, 12:05:04 PM »
isnt the programmer you'r using should be connected to the serial port of the computer?paralel port? ponyprog supports both
i did the ponyprog one myself , its an easy building one
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #6 on: March 09, 2008, 12:07:28 PM »
well winavr recognises my programmer but ponyprog doesnt so thats the problem i have to use avrdude to change fusebits

can u help??
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline benji

  • Supreme Robot
  • *****
  • Posts: 830
  • Helpful? 0
Re: using external crystal
« Reply #7 on: March 09, 2008, 12:10:33 PM »
i only used ponyprog,but anyways , changing fuses is a mattre of changing registers, check datasheet for these registers
good ol' BeNNy

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #8 on: March 09, 2008, 12:14:41 PM »
thats the part i understand which registers to change but how do i read the high bits and low bits and how to write in them
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Steel_monkey

  • Full Member
  • ***
  • Posts: 85
  • Helpful? 0
Re: using external crystal
« Reply #9 on: March 09, 2008, 12:37:34 PM »
There is AVRdude documentation pdf file in 'doc' folder ( WINavr 20071221). It tells AVRdude can set fuse and lock bits (I just made brief search). If your version of WINavr lack of it, I can upload it here (most likely it exists).

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #10 on: March 09, 2008, 01:32:01 PM »
yes i do have hat exact version let me check if it is there
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: using external crystal
« Reply #11 on: March 15, 2008, 04:30:49 PM »
If you are using AVR Studio, connect to your AVR, click on the Fuses tab, and just select the fuse you want. Its really simple.

You'd want the Ext. Crystal Osc. fuse, just choose the specific one that matches you system.

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #12 on: March 16, 2008, 01:03:43 AM »
yes avr studio and pony prog can ease up the process but u see my programmer seems to only work with winavr coz its a bsd programmer thats why the problem...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: using external crystal
« Reply #13 on: March 21, 2008, 06:28:25 PM »
There will be two fuses you need to change.

You need to remove the div by 8, and you need to change the ext crystal osc fuse like I mentioned earlier.

Just look those up in the datasheet and on your pony prog (or whatever you use).

And then tell us the changes you will make (give a screenshot would work), and we will verify before you push the button.

Offline superchikuTopic starter

  • Supreme Robot
  • *****
  • Posts: 952
  • Helpful? 5
  • cooll
Re: using external crystal
« Reply #14 on: March 21, 2008, 10:59:40 PM »
well iam for the time being concentrating on the avrdude documentations and according to it i have to change the mcu's high and low fusebits , and according to the data sheet the initial configuration is like this

lowbit 0xE1
highbit 0x99

wat should be my final configuration using avrdude
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

 


Get Your Ad Here

data_list