Fuse bits changed for CKSEL, AVR not responding with 16MHz crystal

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

I recently set the fuse bits for lfuse as 0xE7 for using it with an 16MHz crystal, I am unable to figure out what went wrong. The hardware setup uses 22pF as load capacitance. DC Supply is 5V.  

This topic has a solution.
Last Edited: Thu. Mar 19, 2020 - 05:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which model AVR and what is your hfuse set to?

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

We're certainly not going to be able to figure out what went wrong when we don't even know the microcontroller you used. Also you should probably explain what exactly happened, because as it stands we just know something went wrong. 

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

I AM SO SORRRY, I thought I had put it in the tags. I am using an ATMega8A. The programmer is a bitbanged gpio on an orange pi pc. HFUSE is set to 0xD9

Last Edited: Thu. Mar 19, 2020 - 07:59 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

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

Looks like it's time to read the datasheet and hook up an RC oscillator.

 

Most of us here use http://www.engbedded.com/fusecalc/ as a check.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Last Edited: Thu. Mar 19, 2020 - 08:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Shouldn't this lfuse setting(0xE7) work for an ATMega328, with the 16MHz crystal? The site shows full swing crystal oscillator.

Last Edited: Thu. Mar 19, 2020 - 08:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Go to the fuse calculator.   Select LFUSE=0xE7 for mega8, 88, 8U2, 16, 32,  328, ...

 

You will find that the fuse bits vary from device to device.

 

It is a mystery why anyone would choose a mega8 unless it is the only chip available in your local market.

The ATmega88PB, 88PA, 88 are cheaper (and better endowed)

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

Yep, you guessed it right. ATMega8 is the cheapest AVR available locally. I tried this lfuse setting on the 328. What I want to know is, will this setting work for the 16MHz crystal? I am not really sure if the full-swing is going to be a problem.

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

It is important that you select the correct fuses for the specific target device.

 

Trial and error will just mean tears before bedtime.

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

OK. I got that. What fuse settings should I use for a 16MHz crystal for a ATMega 328 and 8? I don't want to make more chips unusable. It would be very helpful if you just provided me with the right setting.

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

rexonnucleide wrote:
What fuse settings should I use for a 16MHz crystal for a ATMega 328 and 8?
NOt easy for anyone here to say as fuses are not JUSt about clock selection so you need to specify the complete chip configuration then either you or someone else can put that configuration into http://www.engbedded.com/fusecalc/  to be told the fuse values to use.

 

If/when you get the fuses wrong then read:  https://www.avrfreaks.net/forum/tutsoft-recovering-locked-out-avr

 

You will be OK as long as you NEVER touch RSTDISBL

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

How is the full swing setting different from low power oscillator mode, can the same crystal be used in both?

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


rexonnucleide wrote:
How is the full swing setting different from low power oscillator mode

That's described in the datasheet.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Mar 19, 2020 - 09:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Any idea as to why the atmega328p configured for full-swing crystal hooked with 16MHz crystal is not responding with e:0x07,h:0xd9,l:0xe7 settings?

Last Edited: Thu. Mar 19, 2020 - 10:24 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it's a 328 then along with everything else enable the CKOUT fuse and look at the signal on the CLKO pin with a scope and see if the chip is actually clocking.

 

Of course there are things like the actual electronics themselves. If you are selecting "full swing crystal" then can we assume there actually is a 16MHz crystal across the XTAL1/XTAL2 pins and can we further assume that each leg of that has a 12-20pF capacitor to ground?

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

The capacitors are of 22pF and each leg is grounded. And yes there is a crystal over XTAL1/XTAL2. Sorry, I don't have a scope.

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

You have a cavalier approach to electronics and datasheets.

 

I suggest that you check your components carefully e.g. 22pF and not 22nF or 22uF

And recall your "fuse programming" session.   e.g. did you try random fuse values, voltages, ... ?

 

Capacitors,  crystals, soldering, ... can be poor quality.   Everything must be 100% before it works in electronics.

 

David.

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

I have used the same crystal before, the fuses were programmed by the arduino IDE, but for another chip(328p), not the one I am using now, it had worked perfectly. I am sure that the caps are 22pF. The crystal used is about a year or two old. I will be checking it with fresh hardware tonight. Thanks for your advice and patience! I will update once I use the new components.  Did not try random fuse settings. The connections are made on a breadboard, there are no solderings.

Last Edited: Thu. Mar 19, 2020 - 11:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

rexonnucleide wrote:
The connections are made on a breadboard, there are no solderings.

Why mess with bare chips on BB when Arduino Nano, Pro-micro's are available, easy to use and cheaper then bare chips, and this problem is never seen!

Do you have both VCC and AVCC pins connected to power as well as both GND and AGND pins?  Are there also 100nf caps across each power pin pair, yes these are necessary and required too!

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't connect 22pF caps on breadboards. They add a ton of parasitic capacitance. Try to solder them on the board instead. The paths between the external oscillator and the microcontroller should be as small as possible. 

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

rexonnucleide wrote:
I have used the same crystal before ... The connections are made on a breadboard, there are no solderings.

So this crystal has been in  and out of various projects, then ?

 

Note that crystals can be damaged by dropping and other mechanical abuse.

 

And, as others have said, solderless breadboards are notorious for loose contacts, high capacitance, etc, etc - so it's not uncommon for something to be working fine on a breadboard one day, and not the next ...

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you writing source code and cross-compiling it (for AVR) on the Orange PI PC?  And then using a DIY AVR programmer that toggles the GPIO pins on the PI to load the binary file into the AVR using ISP programming?

 Does this set-up work well with other AVR devices?  What are the programs and Linux distribution that you are using?

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


rexonnucleide wrote:
on an orange pi pc. 

This:  http://www.orangepi.org/orangepipc/  ?

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, I am going for it. I am giving up on breadboard.

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

Yes, this board.

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

I use Atmel Studio on a laptop, copy the hex file to Google drive, download it on my phone, use USB tethering on my phone which has an ftp server running, use wget to copy it from phone to orange pi. The orange pi is controlled by sending commands through its onboard uart connected to laptop by a USB to uart adapter.

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

Yes, I totally agree with you. It just works sometimes and more often does not.

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

What a surprise, I just removed the load capacitance and put the xtal just next to its pins, get a stable blinking led.