Programming fuses, AVR speed_check possible?

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

Dear all,

To gain some extra speed for the ATmega644p-AVR, I added an external Crystal of 22 MHz with 22 pF capacitors to AVR. Although I am quite unfamiliar to fuse bits and their programming, I decided to give it a try. That said I came across to AVR fuse calculator which gave me some data to use in AVRdude. That fuse which I have programmed settings are:

-U lfuse:w:0xdf:m -U hfuse:w:0x99:m -U efuse:w:0xff:m 





avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e960a
avrdude: reading input file "0xdf"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xdf:
avrdude: load data lfuse data from input file 0xdf:
avrdude: input file 0xdf contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0x99"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0x99:
avrdude: load data hfuse data from input file 0x99:
avrdude: input file 0x99 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xff"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xff:
avrdude: load data efuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified

avrdude: safemode: Fuses OK

avrdude done.  Thank you.



avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e960a

avrdude: safemode: Fuses OK

avrdude done.  Thank you.


 

and the configuration below is what I have chosen to get those fuse bits. It would be of great appreciation if someone can tell me the way to verify at which clock speed the AVR's core is running currently.

So

program is working......

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

22MHz is above the maximum of 20MHz for that chip. I don't use AVRDUDE but if the chip is still running that means that it's OK.

 

You can also enable the clock output fuse temporarily to measure it (CKOUT on PORTB1)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

as you advised I enabled the CKOUT on PORTB1, so now the scope measures frequency which is 22.5/7 Mhz. Does this assure now that the AVR core is running at 22 MHz?.

Also I am a bit concerned about this small jumping of the frequency 22.2- 22.5.MHz. Where  it stems from?, maybe the scopes time-domain is a bit out of calibration, or should I changes the capacitors to a higher values rather than 22pF.surprise

Also why the signal is not a square wave? shouldn't it be a nice square wave?

 

 

program is working......

Last Edited: Wed. Nov 14, 2018 - 09:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dave_Zeb. wrote:

as you advised I enabled the CKOUT on PORTB1, so now the scope measures frequency which is 22.5/7 Mhz. Does this assure now that the AVR core is running at 22 MHz?.

 

Yes. But as has been said above, you are now running your chip out of specification so you run the risk of things not working as they should.

 

 

Dave_Zeb. wrote:

Also I am a bit concerned about this small jumping of the frequency 22.2- 22.5.MHz. Where  it stems from?, maybe the scopes time-domain is a bit out of calibration, or should I changes the capacitors to a higher values rather than 22pF.

 

Do not change the capacitors. And see my answer to the next question.

 

Dave_Zeb. wrote:

Also why the signal is not a square wave? shouldn't it be a nice square wave?

 

 

Your scope is sampling the signal at 200 million samples a second. That sounds a lot but your are sampling a 22MHz signal which means that the scope is only taking 9 samples on each cycle of your signal. Therefore it cannot know that it should be a square wave and can only display using the data it has.

 

Also, how good are your scope probes and how good is your ground connection to the probes?

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "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." - Heater's ex-boss

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

Brian Fairchild wrote:
Therefore it cannot know that it should be a square wave and can only display using the data it has.

 

so it means that the signal actually is square wave, and not this one which scope represents at the moment.

 

 

 

 

 

Also, how good are your scope probes and how good is your ground connection to the probes?

 

The scope is connected to mains. There is no other Ground connection applied. For the probe, I use the ground-clip on the probe and attach it to the same Ground Rail which AVR is attached to.

The bandwidth of the scope is 100MHz. Any chace to improve the picture?.

 

program is working......

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

the scope probe has capacitance and the clkout has limited drive capability - this equates to a low pass filter.
As well, have you adjusted the compensation on your probe? With some experience you’ll get to know when the scope is lying to you and that the real world is somewhat imperfect.

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

Same scope settings every time, same 16MHz signal. All I've done is move the ground point around. Signal is on CH1 of the scope.

 

Ground is via the ground lead of CH2...

 

Ground is via the ground lead of CH1...

 

Ground is via the very front ground connection of the CH1 probe...

 

 

 

See #2 in my signature block below vvvvvv

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "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." - Heater's ex-boss

Last Edited: Wed. Nov 14, 2018 - 10:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

such a dramatic change of the hole signal just changing around the Ground Rail mhhhh.... Could you please let me know how you use the different Ground-Coupling techniques you presented on pictures 1-3.

 

Ground is via the very front ground connection of the CH1 probe...

  details please smiley.

 

 

program is working......

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

Ever wondered what those little springs that came with your scope probe are for?...

 

#1 This forum helps those that help themselves

#2 All grounds are not created equal

#3 How have you proved that your chip is running at xxMHz?

#4 "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." - Heater's ex-boss

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

an hour ago I was looking at those small parts and wondering ^_^).... 

 

There is actually no place on my probes to do a compensation although the tool is supplied, but I cant find where it would be possible to make compensation.

Just checked the manuals, .... nothing about probes either.

 

 

program is working......

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

More than anything it's the ground that needs to be right - don't run half a mile of cable from the PCB to the ground connection of the probe - try to make sure it's a close connection to the signal you are observing.

 

(I'm only a bit mangler - not a sparkie - but I know this from years of probing about with scope probes)

 

One thing you can do if the board is thu-hole plated with large ground areas is solder a cut-off from a resistor/capacitor lead into some of the thru-holes near interesting looking signals then clip the scope ground onto that.

 

But did you see Brian's picture in #9 and that "sticky out bit" to the side of the scope tip? That is a "close ground" - make sure it connects with some part of the ground on the PCB/device.

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

The circled red hole looks very much like the access port to the probe compensation capacitor. But the photo isn't clear enough to be definitive. Perhaps the printed manual tells all.

 

Ross McKenzie ValuSoft Melbourne Australia

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

 

Most xtal's need some time to stabilize after power up, so I would investigate and use a longer SUT time then 0 ms!

 

Jim

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

share.robinhood.com/jamesc3274

 

 

 

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

Dave_Zeb. wrote:

The bandwidth of the scope is 100MHz. Any chace to improve the picture?.

The scope may have 100 MHz bandwidth, but the probes are only 20 MHz (and without 10:1 attenuator), so they will definitely mess with a 22 MHz square wave signal.

 

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

I tried to get access to that Hole on the probe's  BNC connector, but no chance, I can't twist it or remove, i'm afraid I might damage the connector.

program is working......

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

Welcome to the microcontroller digital world!  Since a 22MHz crystal and its caps were added to the design, and the microcontroller works, then none of the above discussion is relevant to anything. 

Yes, uCs can be 10% overclocked.  No, the manufacturer will not legally guarantee it 100% of the time for millions of devices.  But manufacturers will not legally guarantee that the sun will come up tomorrow.  It doesn't mean anything.

 

As a general rule, if you are overclocking a microcontroller for more performance, then it is time to upgrade to a faster family of microcontrollers.  There are ARM processors that run at 40+MHz and cost the same as an AVR. 

 

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

Dave_Zeb. wrote:

I tried to get access to that Hole on the probe's  BNC connector, but no chance, I can't twist it or remove, i'm afraid I might damage the connector.

 

OK... now understood. Your probes are the lowest performance standard of that range and have no compensation facility. You will never get a better waveform using them.

 

Ross McKenzie ValuSoft Melbourne Australia

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

what a pity. I guess I need to get a new scope. Or it might be possible just to get the probes with compensation. But then these probes will cost something like 50 € here. So I guess I could upgrade the scope, instead. Any advises would be really helpful.

program is working......

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

Have you tested your probes to see if they need compensating? Most scopes have a test point for this very reason.

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

Dave_Zeb. wrote:
what a pity. I guess I need to get a new scope. Or it might be possible just to get the probes with compensation. But then these probes will cost something like 50 € here. So I guess I could upgrade the scope, instead. Any advises would be really helpful.

What is the purpose of this hunt?  Surely, there are application areas where a "quality" 'scope setup is essential.  But generally not for AVR work, where most apps run at a few MHz and nearly all external signals are much slower.

 

So what if your picture of the clock is a bit skewed?  What are we trying to accomplish here? Why is it important at all if the signal reads at 22.2 or 22.5?  Surely if it is that important that would mean you need the proper measuring equipment and need to be willing to pay for it.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

well, I agree with you mostly, but my concern regarding the measurement is something what I can trust. When I use scope to check something it means I trust that instrument and what it presents me. So imagine if this trust is kinda not there, then how can I work?. When I first so that skewed  clock signal, It made me think that something was wrong, which as not the case. You know it better I guess. Faith in toolchain. 

program is working......

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

Dave_Zeb. wrote:
When I use scope to check something

Probably then you are looking for something different than I do in general AVR work, mostly industrial and commercial.  Yes, I am merely an aging bit-pusher.  If I want to look at the AVR clock with the 'scope, I'm just concerned that it is clocking, and about what it should be.  (We've had a batch of mis-marked crystals, for example.)  Yes, if you might be quantifying different brands of high-speed crystals  for some kind of precise work, then you ned different equipment.

 

Otherwise, then, can't you extrapolate your argument and you need zillion dollar tools, as every lower level will not be as accurate/precise?  My recommendation:  Realize the limitations of what you have, get over it, and proceed with doing your over-clocked applications.  Indeed this is somewhat ironic -- didja ever think that the jitter >>might<< be caused by exceeding specifications by 10%?

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

i will stick to your advise, assuming that it's not going to have any influence on the setup itself.

 

theusch wrote:

 Yes, I am merely an aging bit-pusher. 

^_^)

program is working......