What are the effects of overclocking an AVR??

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

Recently ive been working on a project involving a mega32, and it involves alot of floating point arithmetic. These chew up the clock cycles, so i was thinking of running the device at around 20Mhz.

Ive never had to clock and AVR higher than what its rated for, and i still dont really need, but i was just thinking about whats going to happen if i do??

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

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

The results of overclocking, like all other exceeding of specifications, is completely undefined. On a more practical basis, overclocking will heat the chip more snd make the operating of the chip less reliable. You can improve reliability by better cooling at overclocking. Nonetheless, once you exceed specifications, no reliable behavior is guaranteed.

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

Quote:
a project involving a mega32, ....i was thinking of running the device at around 20Mhz.
Just switch to the M324, pin compatible and runs at 20MHz at 5V. Code should just need a recompile for the new chip.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Yea, but what are the typical behaviors, at OC, that occur??

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

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

Apart from overheating and using more power and probably crashing don't really know.

Is this a uni exam question? :)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Lol, nah, its acually a hobby project im working on. Basically just a DC power meter to track the output of my solar system.

Hey john i need to do 6 weeks worth of work experience b4 i finish uni (and this is my last year, wooptydoo), and i live in the parramatta area. do have room to take on a free worker :) ?? (as long as you dont make me mow your lawns and wash your car lol). I want to do it with something involving AVR's.

Attachment(s): 

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

Last Edited: Sat. Jan 19, 2008 - 08:45 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ub3r wrote:

"What are the effects of overclocking an AVR?? "

I wouldn't consider over-clocking a best practice...

Ub3r wrote:

Recently ive been working on a project involving a mega32, and it involves alot of floating point arithmetic. These chew up the clock cycles, so i was thinking of running the device at around 20Mhz.

Ive never had to clock and AVR higher than what its rated for, and i still dont really need, but i was just thinking about whats going to happen if i do??


You can also use the Mega644, with little to no side effects - even with timers and the like.
Atmel has a migration application note on the subject that will point you to that end. And the generic version of the Mega644 is good to 20.0MHz.

Quote:
AVR505: Migration between ATmega16/32 and ATmega164P/324P/644(P) (11 pages, revision C, updated 06/06)
This application note summarizes the differences between ATmega16/32 and ATmega164P/324P/644(P) and is a guide to assist current ATmega16/32 users in converting existing designs to the ATmega164P/324P/644(P).

You'll find the application note here:

http://www.atmel.com/dyn/products/app_notes.asp?family_id=607

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

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

Just looked at the datasheet. Pchange interupts on all pins, beautiful. ill be making the switch. Now, where to find the mega324 locally??

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

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

Here is another link to a project im working on. Basically a solar I/V sweeper, which im soon going to turn into a battery tester (requires software changes only).

http://www.archeli.com.au/cobra/...

Why solar, i used to build race solar cars for my school lol.

-Tony

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

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

I would love it if all overclockers were sentenced to one year as a product engineering tech learning to program chip testers followed by one year as a tech writer editing data sheets and answering customer phone calls about the data sheet.

Every single parameter on the data sheet is tested. The chip is clamped in an expensive temperature control rig, driven with a clock oscillator, and every pin timing is tested to make sure it meet spec in all corners of temperature/voltage/clock schmoo.

The short answer to: "What happens when I overlock?" is: YMMV.

You are off the data sheet. All guarantees are off. In addition to more heat, the first thing that will go is pin timings. Your design may have enough margin where that won't matter. Or maybe it won't matter on a cool day, but a hot summer day it gets flakey. Or maybe your design works today, but won't after three years of aging. (Modern CMOS *does* slow down as it ages due to the "hot electron" effect.) It may draw more supply current than spec. Or, maybe only certain date codes work, but parts from marginal boats don't. Or maybe it works with certain date codes of some other manufacturer's RAM chip if they were made on a sweet day, but not marginal ones.

It may appear to work until you exercise one particular logic path that does not make timing at the high clock speed but doesn't matter for common operations. An example being the horde of idiots that overclock Intel Pentium processors and say: "It boots Windows, therefore it works!" Clue #1: There is no floating point in the Windows boot code. Clue #2: Windows does not use the newer instructions in the OS, because it is compiled to run on old processors.

You do not have the ability to test the part the way the manufacturer does. If you get your kicks by overclocking, go for it. But please don't sell it to a customer that expects a reliable system. And don't whine if it breaks. And don't brag to Old Farts(tm) about it, it won't impress us. Having said all that, if it just needs to hang together long enough to turn in a grade.... find a big honkin' heat sink -- power dissipation goes up with the cube of clock speed.

Here's a clue though, if you want to see it really rip, use a copper cup for a heat sink, attach with heat sink grease but allow for plenty of thermal expansion/contraction, and fill that sucker up with liquid nitrogen. You'll see some good clock speeds. That exercise is good humor :) but... you should only do it for the entertainment.

-dave

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

Yeah ive only used AVR for hobby use, they dont even teach us AVR at uni.

dbc wrote:

Here's a clue though, if you want to see it really rip, use a copper cup for a heat sink, attach with heat sink grease but allow for plenty of thermal expansion/contraction, and fill that sucker up with liquid nitrogen. You'll see some good clock speeds. That exercise is good humor :) but... you should only do it for the entertainment.

-dave

Theres a guy on youtube that overclocked a P4 to around 7GHz using that exact method. It was able to compute the first 1 million decimal places of PI in around 8 seconds.

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

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

Quote:
I would love it if all overclockers were sentenced to one year as a product engineering tech learning to program chip testers followed by one year as a tech writer editing data sheets and answering customer phone calls about the data sheet.
Your cruelty knows no bounds!

On the overclocking thing:
I'd really avoid overclocking if possible. Until resorting to it, try setting the code optimizations to max, rewriting the code to be more optimal, do your complex calculations during the time you wait for the LCD (or instead of waiting in general)... or post it and we'll tell you what could be done better.

After a close look at your picture, I believe you are doing another Very Bad Thing: Your Dragon is sitting on the black piece of foam that was provided with it. DO NOT DO THAT! IT IS CONDUCTIVE!

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

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

Quote:
do have room to take on a free worker
I wish I could, but I'm running a home based business without any other workers...you are welcomed to do the lawns though :lol:
Quote:
where to find the mega324 locally??
That is the pain at the moment in Oz. Soanar plus does not stock them yet, may try Braemac if they have any and are willing to sell you 1 or 2, very doubtful even if they have them.

Farnell has them as awaiting delivery at $10.72 for 1 off, not too bad considering. May want to try them out and check for the expected delivery date.

ps Just checked for the M644 at Farnell and they have the older M644 (not the newer M644P) in stock. The main difference would be that the newer type has 2 USARTs (plus lower power and a bit more) and the older one just 1 USART. So if you just use the 1 USART then that's another alternative,

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

dbc wrote:
Every single parameter on the data sheet is tested. The chip is clamped in an expensive temperature control rig, driven with a clock oscillator, and every pin timing is tested to make sure it meet spec in all corners of temperature/voltage/clock schmoo.

You are off the data sheet.
-dave

Most likely a stupid question...
When is a chip considered overclocked ?
-For instance, if I provide a 20.480 MHz crystal instead of 20.000MHz, would that be out of the spec, or would it be 5% over, perhaps 10% ?

-Ofcourse I wouldn't expect 20.480 MHz to be enough to make unpredictable results.

Not that I'm interested in overclocking; more that I'm interested in getting all that's available for me, without stepping over the line. ;)
-I believe that there is some tolerance, as there's tolerance with all other electronic components, even the serial baud rate.

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

Well, it's overclocked if you go 1Hz above the maximum in the spec sheet ;-)

Will it work at 20.480Mhz - almost certainly.

If it doesn't work at some point for some reason, you're on your own (or in Court in front of the Judge if you cause a serious problem)

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

Ub3r, dou you really really need floating point arithmetic? The fixed point is at least 5 times faster and with C++ you only need to change the type from "float" to "Fixed". See http://wiki.yak.net/675/fixed.h (my local copy is at http://194.204.26.104/~andrei/av...).

Next step up in speed is to use the recently announced PIC32, which is in fact an embedded 32-bit MIPS and runs at 72 MHz. Beat that with measly atmega32 :)

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

Quote:
Next step up in speed is to use the recently announced PIC32, which is in fact an embedded 32-bit MIPS and runs at 72 MHz. Beat that with measly atmega32
Or give the 32bit AVRs a try... The UC3 series namely...

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

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

MartinM57 wrote:
Well, it's overclocked if you go 1Hz above the maximum in the spec sheet ;-)

Very clear, thanks MartinM57! :)

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

@andrie - It looks like the PIC32 overlaps with ARM7 and ARM9 quite a bit. Interesting none the less.

@js & OP - I've sent Futurlec and email asking about them stocking the M324 and M644. I'll post if I get a reply. I've had good luck with asking them to stock parts in the past and them doing so. Also, speaking about Sydney thing, Futurlec are run out of Broadmeadow , interesting.

I'm particularly interested in the 4kB or RAM on the M644 and the fact it is in PDIP form. Must.....get.....one......

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

Yes, the software does most of its calculations during the 'wait' period of the LCD, so it doesnt really waste clock cycles. One of the timers is dedicated to handling this task.

Also, currently, it does handle all arithmetic, easily, and takes 50, watt and amp, samples a second (for accuracy) to calculate the Ah and Wh, and refreshes the LCD 10 times a second. Digital IIR filters were also added clean the voltage and current readings, this was necessary as in some cases we were looking at the outputs of high frequency buck converters (solar maximisers), which do contain a voltage ripple. Now, ive tested all this at various speeds, and it keeps up, at speeds as low 4Mhz.

The main question was asked just out of curiosity, and not of need. It was say, what if i wanted to do more complex calculations?? i would require a higher clock speed, so the question arose. I will however, now clock it at higher speeds, just out of curiosity, and to see where the limit frequency, before it crashes, or errors occur, would lay.

Also, i will look at fixed point arithmetic, i actually thought of that as well, but used floating point just for convenience. I don't need a 32bit processor so i don't want to go there, thanks anyways.

@js, i said i DIDNT want to mow your lawns :). However, if you pay me i will, i need the money.

Maybe the best advice ive gained from this thread is to remove the pad from the bottom of my dragon, and also, from js, about the m324.

Thx.

- Tony B. Sydney, Australia.
tbaz2679@mail.usyd.edu.au

Status: Supporting the GNU

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

I've seen mentioned on other threads here on AvrFreaks that the EEPROM is the first sub-system to stop working when you push the clock up.

Embedded Dreams
One day, knowledge will replace money.

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

I ran a 16.000MHz Mega64 and a Mega128 at 20.000MHz, without problems. But that was only some experiments on the STK500/STK501. I didn't use EEPROM, but I did use a couple of timers and both USARTs and quite a few I/O ports, including an 8 bit HD44780 LCD interface.

But Is was only having some fun and wasn't looking to use this data in any design.

As far as the data-sheet specification and tolerance is concerned, that is clearly stated within the "Absolute Maximum " section of the data-sheet. "Absolute Maximum " component specifications are generally treated as a +/-0 tolerance - absolutely.

To the maximum CLK frequency specification, while it could be stated in some percent, I would think it a more practical approach to be looking at this in terms of the "Parts Per Million " (PPM) specification of the crystal.

Looking it the CLK frequency tolerance as a percentage specification, 1% of 16.000MHz is 160.000KHz. But a typical 20PPM specification of a crystal is only 320Hz. This is a specification deviation of 500:1. I think the threshold or transition from not "Overclocking " to that of "Overclocking ", is when the micro-controller CLK is deliberately driven above the PPM specification of the maximum crystal frequency, as called out in the micro-controller data-sheet.

So then, if the micro-controller CLK frequency exceeds the maximum specified crystal frequency in the data-sheet by the crystal PPM specification, you are technically "Overclocking " the micro-controller. In the case of the maximum PPM of a 16.000MHz crystal, the transition from 320Hz to 321Hz is where you leave the data-sheet specification and enter the realm of "Overclocking. "

So, I'd have to conclude that the micro-controller data-sheet is working close to the premise that a crystal is specified using a PPM specification and not a percentage specification. As such, the micro-controller data-sheet CLK specification will incorporate the typical crystal PPM specifications used for a given micro-controller design.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

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

Possibly not too long to wait for the xmegas now which are reported to extend the upper range of the speed envelope for those apps where you really need the extra performance (and other cleverness frees up the CPU to do more too)

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

Every other cpu in the world that executes instructions faster than they can be fetched from instruction memory uses a cache. Guess thats a solution for slow flash with a fast cpu. Seems like clock speed depends on voltage and temperature... so if 16Mhz is the max clock for 50 deg C and 5.00V, is 19Mhz ok for 25 deg C and 5.1V? The manufacturer spec has to assume none of the three params exceed the spec, but if its not going into an engine compartment, maybe you get a little leeway?

Imagecraft compiler user

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

IIRC, the AVR core can handle ~32MHz without problem. It is the other elements of the AVR that limit the speed. I would expect the xmegas to take advantage of this fact.

Regards,
Steve A.

The Board helps those that help themselves.

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

Quote:
Most likely a stupid question...
When is a chip considered overclocked ?
-For instance, if I provide a 20.480 MHz crystal instead of 20.000MHz, would that be out of the spec, or would it be 5% over, perhaps 10% ?

It's not a stupid question, it's an unanswerable question. Manufactures test to the data sheet, designers should design to the data sheet, that's the "contract". There is statistical variation from lot to lot, some lots are sweeter than others. Process engineers earn their keep by getting the yield as close to 100% as possible, if your yield is that high it means the center of the bell curve is well above spec.

But as soon as they get close, marketing moves the goal posts and say: "Hey! New speed grade! What's our bin out going to be at X MHz?" So then a customer engineer negotiates a new data sheet with design and process engineering, and a product engineer adds some new tests to the test tape. And the process engineers work on boosting the bin out to the higher speed bins. Repeat until retirement (of the design or the engineers :) )

Nobody can say what will happen if you go off data sheet, or more importantly, if parts from different lot codes will behave the same way. But if the part doesn't work according to the data sheet, you can send them back. In the 1980's, I got to play the part of the cranky customer during an inventory purge of some (oh, about US$500,000) off-spec PAL's. Now, of course, if I had been using them outside the data sheet, the salesman probably wouldn't have done so much as buy my lunch.

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

Quote:
so if 16Mhz is the max clock for 50 deg C and 5.00V, is 19Mhz ok for 25 deg C and 5.1V?

That's the qualitative science. The quantitative science is more complicated.

Power dissipation in CMOS is mostly charging/discharging gate capacitance. Power dissipated will go up as the square of voltage and the cube of frequency. So, there are two questions: a) how much do I need to cool the chip to keep the junction temperature below destruction? That depends on the thermal characteristics of the package and your heat sink. b) how much do various timing paths change relative to each other? At some point, new speed limiting paths can show up. Sense amps for ram and flash, not being logic but being analog circuits fabbed in a process optimized for logic often get flakey in statistically interesting ways, just to name one.

There is no general rule, it depends on the design of the part. And even the experts get it wrong once in a while -- I'm itching to tell a story about a 200 byte program of mine that got added to the Pentium I test tape... but had better not.

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

Quote:

Also, currently, it does handle all arithmetic, easily, and takes 50, watt and amp, samples a second (for accuracy) to calculate the Ah and Wh, and refreshes the LCD 10 times a second. Digital IIR filters were also added clean the voltage and current readings, this was necessary as in some cases we were looking at the outputs of high frequency buck converters (solar maximisers), which do contain a voltage ripple. Now, ive tested all this at various speeds, and it keeps up, at speeds as low 4Mhz.

There's noting in there that indicates to me to "requirement" for floating point. The readings are probably a discrete number of bits (e.g., AVR's 10-bit A/D) so there is normally not a >>necessity<< to do a lot of floating point calcualtions, although a final FP multiply for conversion to display units can be very >>convenient<<.

Quote:
it involves alot of floating point arithmetic. These chew up the clock cycles, so i was thinking of running the device at around 20Mhz.

Compare Mega32 to Mega324 for package, price, max clock rate, and feature set.

Lee

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

Quote:
Yes, the software does most of its calculations during the 'wait' period of the LCD, so it doesnt really waste clock cycles. One of the timers is dedicated to handling this task.

LCDs are slow devices that should have special timing. In my projects the high level routines write to buffers with same size of the lcd lines.
In parallel, inside a timer, the buffers are copied char by char respecting timing between each access.
The only bottleneck I have is to generate the write pulse (E signal). To generate it I stop the processor in a small loop. This also could be buffered if necessary. This aproach limits some controls of the display like cursors. With some more effort also cursor operations may be done in the internal buffer.
Overclocking: the complete datasheets are good references as guide to overclocking. These datasheets are released after measuring many lots of production so they include statistics data.
In AVR type of CPUs the extra heat generated is negletible. External interfaces are not big problems too since in general projects with microcontrollers use the internal peripherals (as oposed to a PC circuit which has busses). The main problem is malfuncion of the final product. Resets not expected, collected data lost, reduced operation time if in batteries and so. Temperature and voltage applied are the most important variables. If possible to control them more precisely the project may work perfectly. Not all projects needs to operate in military environment situations. In digital age we are measuring the mains voltage with 4 significant digits before connecting a heater on the outlet. We have to take care of this behavior.

Eng.Marco Aurélio Carvalho

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

Hi, so take a look at http://www.micromegacorp.com/
They have SPI floating point unit, which you can easily connect to your processor speeding up calculations.

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

At the price of 20USD, wouldn't it be cheaper/easier to simply use an ARM processor, or, say another processor with an integrated FPU unit?

http://www.parallax.com/Store/Mi...

There are pointy haired bald people.
Time flies when you have a bad prescaler selected.

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

First OC have been in this forum before.
And don't OC if you don't have to !!!
But for fun :D you can.
The first thing to fail is the eeprom write. (at least on the old ones).
The spec for a chip is the worst case
So for a 4.5 to 5.5 Volt chip the 4.5 set the spec so if you can make 5.4 +- 0,1 Volt the chip can run faster than the spec !!!
The same for temp if you can keep the chip cold you can run faster than the spec says.
For volt you can gain about 10% and temp under 25C an other 10% with same stability than the spec!

Jens