32mHz ARDUINO PROJECTS.. ATMega328P etc...

as mentioned a crystal cannot be used at that frequency, only an external oscillator. this is confirmed by my own tests. the fastest i was able to get with a crystal was 22mhz-24mhz depending on the cut and caps.

this is great for fun but be aware there is potential for damage. not from heat like overclocking a pc cpu as many think but damage to the flash structures. atmel makes it clear flash and eeprom cell programming is not recommended over 10% of nominal clock speed. i verified that spm at highest limit does indeed result in failure. constant erase cycles caused measurable retention time deficit in minutes or hours overclocked while same routines within spec went for weeks. few tens of thousands vs at least couple million.

moral of the story: if you overclock dont write to flash.

I don’t know if you can program them to have a default frequency, but using an AD9850 function (square wave) generator module for the clock would be interesting.

i.e you could dynamically increase the frequency using the device its self

not sure about initial boot though from cold / no power

You can lower the clock core frequency before flash/EEPROM critical write functions. From change-the-frequency-of-my-atmega

Apart from that default loaded value you can change the clock prescale at will during runtime, all you need is to include the following header

#include 
and call the following function with the appropriate value you want to use

   clock_prescale_set(clock_div_1),    // divide by 1, for example with 20MHz clock result      20MHz
   clock_prescale_set(clock_div_2),    // divide by 2, for example with 20MHz clock result      10MHz
   clock_prescale_set(clock_div_4),    // divide by 4, for example with 20MHz clock result       5MHz
   clock_prescale_set(clock_div_8),    // divide by 8, for example with 20MHz clock result     2.5MHz
   clock_prescale_set(clock_div_16),   // divide by 16, for example with 20MHz clock result   1.25MHz
   clock_prescale_set(clock_div_32),   // divide by 32, for example with 20MHz clock result  0.625MHz
   clock_prescale_set(clock_div_64),   // divide by 64, for example with 20MHz clock result  0.312MHz
   clock_prescale_set(lock_div_128),   // divide by 128 for example with 20MHz clock result  0.156MHz
   clock_prescale_set(clock_div_256),  // divide by 256, for example with 20MHz clock result 0.078MHz
power.h manual

Interesting views - as I said I havent had any problems YET

Ray, thats an interesting concept for the frquency drop before eeprom write, I do use eeprom within the app, but I am guessing it doesnt matter much about the frequency when programming via USBASP ??

I also tried using standard xtals, I bought a range to try, I could only get to 24mHz before it became hit and miss...

I have dozens of 20/24/25/32 mHz crystals if anyone wants them !! :)

I have dozens of 20/24/25/32 mHz crystals

I very much doubt that ;)

mcnobby: Interesting views - as I said I havent had any problems YET

probably wouldnt ever because not many people reprogram tens of thousands of times. typically a few dozen or hundred. and you might not notice that the 10-20 yr retention spec was compromised.

eeprom tolerates about an order of magnitude more cycles so unless writing constantly wouldnt notice there either. rare applications that reprogram flash a lot and need long data storage might have a problem though.

also worth noting that the programming timer is not influenced by clk prescale so while slowing the cpu helps with power consumption, it does not fix the flash retention problem.

mcnobby: I also tried using standard xtals, I bought a range to try, I could only get to 24mHz before it became hit and miss...

glad to see you were able to duplicate my own crystal experiments.

they are so cheap i also have dozens of different crystals, even hundreds for common values like 16mhz. not that unbelievable.

even hundreds for common values like 16mhz. not that unbelievable.

Yes, it really, really is. In thirty odd years in the electronics industry, I have never, ever seen a single "20/24/25/32 mHz" crystal.

AWOL: Yes, it really, really is. In thirty odd years in the electronics industry, I have never, ever seen a single "20/24/25/32 mHz" crystal.

Ah, I get it now... 20/24/25/32 mhz = 1041 hz :)

or perhaps you meant I spelled Mega Hertz with a small M, so its milli Hertz !!

That really HURTZ !! ha ha

UPDATE : I have tried & tested 32MHz crystal oscillators on many ATMega328, ATTiny85, and ATTiny13A (all 20MHz variants) I have decided to push things to the limit...

I have ordered one 40mhz oscillator for testing.. these things run at a juicy 40ma plus more current drawn from the microprocessor because of the extra speed.

I shall revisit with my results soon :)

Do you feel the need for speed?

ChilliTronix: Do you feel the need for speed?

IMO..

Not just speed, but the thrill of the chase.

Ray

For a while, I was thinking that one of the new XMega chips running at 32MHz would be a useful addition to the Arduino line. Now, I just think that anyone who needs the speed should jump to one of the ARM boards.

Yes, make those LEDs blink really fast … even faster delay() for button pushes …

Ha ha, thanks all !!

westFw, I have been thinking about the arm stuff, even to the point of getting several stm32f1 boards after the (now very long) topic was started on here.

for me its not a simple jump, I write in C AND assembler, the task of learning the 32bit assembly and all the register manupulation didnt suit me too well as I am just about coping with 8 bit !!

:)

Crossroads, it is mainly for multicolour VGA purposes, I really need the speed !!

for me its not a simple jump [to ARM]

This online class has just started, and I highly recommend it. If you already have experience programming AVRs in C and assembly, you'll be well ahead of "median" background, but it's STILL a good introduction to ARM programming...

https://www.edx.org/course/embedded-systems-shape-world-utaustinx-ut-6-02x

Cheers WestFw, I think I would need to sign up as I cant see much on that page/link

Link with no-login-required info (also, previous post "fixed"): https://www.edx.org/course/embedded-systems-shape-world-utaustinx-ut-6-02x

Interesting, I had found I could run at around 24 MHz (note the M) with a crystal but not faster. Now I am motivated to try faster clock inputs, excluding crystals.

AWOL: I very much doubt that ;)

Annoyingly, the proper capitalization of 1,000 is k but 1,000,000 is M.