[AVR] max clock frequency - Page 1
Forum section: electronics / general

author: Simon
author_rank: Unknown
timestamp: April 05, 2017, 11:59:02 am
content: AVR's are rated to 20MHz but I see most applications using 16MHz, any particular reason ? Are they safe to run at 20MHz ?

author: RoGeorge
author_rank: Super Contributor
timestamp: April 05, 2017, 12:03:06 pm
content: As I remember them, old AVRs were 16 MHz. I am thinking here about chips like ATmega8...32.Later edit:As a curiosity, I overclocked an ATmega32P/5Vcc with a 20Mhz Q. It worked OK at the room temp.If the catalog gives 20MHz, then it's safe to use them as 20MHz.One more thing for AVRs datasheets, they sometimes specify 2 max freq, usually is 16MHz for 5Vcc and 8MHz for 3.3Vcc (if the chip can work at 3V, because some are 5V only)

author: Gibson486
author_rank: Frequent Contributor
timestamp: April 05, 2017, 12:37:00 pm
content: Probably because industry standard is usually 8 or 16 Mhz. I have seen some other clocks used. However, the majority of the time is 8 or 16, probably because we tend to think 8 bits at time, so the numbers are just more convenient. In reality, if bumping from 16Mhz to 20Mhz makes or breaks your application, perhaps it would be time for an upgrade to a beefier MCU!

author: Simon
author_rank: Unknown
timestamp: April 05, 2017, 01:17:57 pm
content: 16MHz is fine. I was thinking more on what it could translate into for PWM frequencies. And I'm just curious. I'm designing a generic board where as long as the footprint matches I'd alter the Cristal.Sent from my phone so mind the autocorrect.

author: madires
author_rank: Super Contributor
timestamp: April 05, 2017, 01:48:17 pm
content: For anything timer based is quite simple: 8 to 16 MHz is a factor of 2, 8 to 20 is factor 2.5. and 16 to 20 is 1.25. 20 MHz might be also interesting for the ADC, since the ADC clock's maximum is 200kHz for 10 bit resolution. With 8 or 16MHz you'd set the ADC's prescaler for 125kHz (next higher clock would be 250kHz). But for 20 MHz it's 156.250 kHz. The drawbacks are higher power consumption and some #ifdef fun, if you're going to support different clock rates. I haven't seen any problems with running ATmegas at 20 MHz.

author: Simon
author_rank: Unknown
timestamp: April 05, 2017, 05:30:43 pm
content: Well I tend to declare my clock speed once and base everything off that. Power consumption is not an issue as it's not a battery application and the devices I am controlling are many hundreds of times the power my unit uses. I might actually be able to get a better PWM clock ratio, currently I am at 122Hz but I'd prefer a bit higher.

author: Brutte
author_rank: Frequent Contributor
timestamp: April 05, 2017, 07:40:13 pm
content: Hereis the avrfreaks topic about avr8 core.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: April 06, 2017, 05:24:53 am
content: I have an ATmega1284P running at 20MHz and its totally fine.I am not using ADC and its not on batteries.I did learn to check third party sources for hardcoded F-CPU defines...

author: Simon
author_rank: Unknown
timestamp: April 06, 2017, 06:36:01 am
content: Quote from: Brutte on April 05, 2017, 07:40:13 pmI don't see the relevance, that is about 8 bit versus 32 bit and technology costs. I'm just looking at the real frequencies an AVR can work at as the datssheet says. For example the arduino runs at 20MHz and that is bogged down in stuff and could do with all the speed it needs.

author: FreddyVictor
author_rank: Regular Contributor
timestamp: April 06, 2017, 07:19:49 am
content: Quote from: Simon on April 06, 2017, 06:36:01 amOfcourse you meant 16MHz for ArduinoThe datasheet claims 20MHz max speed (note voltage must be 5v), so unlikely to be a problem at this speedI played around with ATXmega (32MHz max) for a while and ended up using an overclock to 40MHz with no issuesneed more speed ? then best abandon ATmega and move over to STM32F4 (or even F3)they have lots of 5v tolerant pins so no real problem there

author: westfw
author_rank: Super Contributor
timestamp: April 06, 2017, 10:08:09 am
content: The atmega8 used on the original Arduino has a max clock speed of 16MHz, so that's what it ran at. When they started using 20MHz capable cpus like the atmega168, leaving the clock at only 16MHz avoided a lot of software effort.

author: Simon
author_rank: Unknown
timestamp: April 06, 2017, 11:45:55 am
content: hm, the datasheet only specified capacitors for up to 16Mhz

author: ajb
author_rank: Super Contributor
timestamp: April 06, 2017, 12:04:16 pm
content: The ratings vary from part to part. I seem to recall there are still some ATTiny parts that are only rated to 12MHz. Also be sure to check the frequency vs voltage tables for your particular part; the headline clock frequency typically only applies at the top end of the operating voltage range.

author: Svuppe
author_rank: Regular Contributor
timestamp: April 08, 2017, 02:24:50 pm
content: Quote from: Simon on April 05, 2017, 01:17:57 pmThere are some AVR's that have a built-in PLL. Not that the processor run any faster, but a timer or two can, thus permitting higher resolution PWM.ATmega32U4 is one of those capable of high-speed timers (up to 64 MHz), Tiny26 is another, and the rest I can't remember.

author: Simon
author_rank: Unknown
timestamp: April 08, 2017, 02:26:42 pm
content: The tiny 25, 45, 85 can do that too but I don't need that sort of speed.

author: bingo600
author_rank: Super Contributor
timestamp: April 08, 2017, 02:35:15 pm
content: Afaik the new "mega's" lost their "high voltage swing" , and they're limited to 16MHz again (not 20)I think the M328PB, was one of the new ones/Bingo

author: madires
author_rank: Super Contributor
timestamp: April 08, 2017, 02:43:10 pm
content: Just checked (http://www.microchip.com/wwwproducts/en/ATmega328PB). ATmega328PB is still up to 20MHz. But Microchip can't decide if it got 2kB or just 2 Bytes of RAM

author: bingo600
author_rank: Super Contributor
timestamp: April 08, 2017, 02:58:50 pm
content: Quote from: madires on April 08, 2017, 02:43:10 pm. They must have thought it was a PICBut have a look herehttps://hackaday.com/2016/05/03/atmel-removes-full-swing-crystal-oscillator/Andhttp://www.atmel.com/Images/Atmel-42559-Differences-between-ATmega328P-and-ATmega328PB_ApplicationNote_AT15007.pdf/Bingo

author: madires
author_rank: Super Contributor
timestamp: April 08, 2017, 03:21:39 pm
content: That's interesting! Thanks for the hint!

author: technix
author_rank: Super Contributor
timestamp: April 14, 2017, 12:10:11 am
content: Quote from: obiwanjacobi on April 06, 2017, 05:24:53 amATmega32-PU @50MHz w/5.3V power rail and no heat sink. NBD.

author: westfw
author_rank: Super Contributor
timestamp: April 14, 2017, 08:45:02 am
content: Quotethe CPU is still rated to 20MHz, but the crystal oscillators have been down-speced to only work up to 16MHz. (Which is really annoying, given that most external oscillators will more than double current consumption.) YMMV, since there's a lot more variance to crystals than most people pay attention to.