Go Down

Topic: 32mHz ARDUINO PROJECTS.. ATMega328P etc... (Read 13916 times) previous topic - next topic

Tom Carpenter

Which ATTiny's are spec'ed at 12MHz? The t84 and t85 are both rated up to 20MHz...
~Tom~

aldolo

Hi. Are you still here? I wonder how you can remove the crystal and replace it with an external clock without changing the fuse bits before. It seem a chicken and egg problem. Have you burned the bootloader with the fuse and then changed the circuit?

Budvar10

#32
Jan 09, 2018, 01:12 pm Last Edit: Jan 09, 2018, 01:13 pm by Budvar10
It is absolutely no problem, but once if the chip is set to use external clock or crystal, it (clock signal generally) must be present otherwise the MCU will not start. So, just replace the crystal. Of course, the bootloader have to be changed for exact frequency.
However I'm not recommending to use 32MHz. I have some experience with overclocking on ATmega1284P. Some features doesn't work at higher frequency as 25MHz, e.g. prescaler for ADC. I had the best results with 24MHz. The MCU works reliably at 24MHz, no getting a heat and all features seem to work.
...but 328P can be different story!
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

mcnobby

Hi All

I am currently overclocking an ATTiny13A to about 16MHz on INTERNAL resonator, just by setting it to 9.6MHz internal resonator, then writing OSCCAL to 255 (I think only 7 bits are actually used), this then doubles the 9.6MHz internal clock approximately. If you dont need to worry about exact timing then this is great fudge.

I use this for receiving and decoding an 800KBPS data stream and driving a servo from the data and it works a treat as I continually sync on the start/high transition of each bit and sample in the middle, so probably even 1MHz either way would still work

The ATTiny13A does not have pins for a standard xtal, and can only be driven externally by a TTL Clock oscillator, so I chose the method above for cost and simplicity

This overclock can also be done on an ATTiny45/85, so I believe (although you can use a standard xtal with those)

Bob
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

mcnobby

I have done many ATMega projects using 32MHz TTL clock oscillators and not found any heat problems, in fact not noticed and heat given off at all. I cant verify that any new microcontrollers still work as well since Microchip took over the AVR range and I believe they opened a new fabrication plant in Scandinavia and reduced some of the specs on devices from 20MHz down to 16MHz.. early 2017 from my memory anyway !
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

Budvar10

#35
Mar 06, 2018, 08:14 am Last Edit: Mar 06, 2018, 08:23 am by Budvar10
... reduced some of the specs on devices from 20MHz down to 16MHz..
Which ones specifically? I checked the 328P and my favorite 1284P. Both are 20MHz and additional about 40 mega and tiny MCUs.

Which mega with 32MHz did you use? Try to check the ADC. I doubt it will work reliably - sample rate and the highest resolution. I tested 1284P. It seems to work reliably just up to 25MHz.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

mcnobby

Hi, I just saw some notification last year, I cant remember the detail now but I think it had something to do with the maximum frequency using a standard xtal (maybe)
and with my overclocking I wasnt using ADC, just bit blasting
I was using ATTiny13A/85 and ATMega328/1284 with 32Mhz clock oscillator
I think I found that you can use up to 24Mhz standard xtals with some of the ATMegas
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

Budvar10

#37
Mar 08, 2018, 02:17 pm Last Edit: Mar 08, 2018, 02:22 pm by Budvar10
Hi!
I think, they use same fabrication process for all AVRs, so it is not as surprising that it works with 32MHz clock. You motivate me to test it at least on spare time.
It is some time ago, but I think Krupski had presented here ATmega2560 at 32MHz. This is only 16MHz MCU according the datasheet.

BTW: The link "www.smartshow.lighting" below your karma is incorrect.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

mcnobby

I also bought some 40MHz clock oscillators, but never got round to testing them :)
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

krupski

I have been using 32mHz crystal oscillators on my projects for some time now without any crashes or ANY noticable heat from the processor.
I run my AVR boards at 22.1184 all the way to 29.952 without any problems. By the way, you don't need an OSCILLATOR to do this, just set your crystal drive from "low power" to "full swing" and it works fine.


Gentlemen may prefer Blondes, but Real Men prefer Redheads!

krupski

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.

moral of the story: if you overclock dont write to flash.
Just set your low fuse from 0xFF to 0xF7 (full swing oscillator) and any reasonable crystal up to 32-something works fine.

As far as writing flash or eeprom, since those writes are timed by the internal R/C oscillator, the clock speed is irrelevant. Have you ever actually TRIED what you posted?
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

krupski

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

Code: [Select]
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 <avr/power.h>
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



Not necessary. The AVR internal R/C oscillator times flash and eeprom writes. The cpu clock speed is irrelevant.
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

krupski

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.
Ever see a DDS board?
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

krupski

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.
Just remember to set your LFUSE from 0xFF to 0xF7 (full swing).  And, contrary to what the "experts" here say, running at full swing doesn't draw any more current (at least nothing I can measure).
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

Budvar10

#44
Mar 12, 2018, 06:48 pm Last Edit: Mar 12, 2018, 06:48 pm by Budvar10
@mcnobby
Seems like some AVRs are discontinued under Microchip, e.g. ATmega2560 is not on product list anymore.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

Go Up