So I've got this idea (for fun) to replace the 16MHz Crystal with a 64MHz Crystal (with the ATmega328) I have laying around, so i did some research and found a tutorial to replace it with a 32MHz Crystal and they had to replace the 22pF capacitors with diffrent one's, so my question is how can I find out what kind of capacitors i need? And I know that the ATmega328 possibly die
"If the crystal frequency exceeds the specification of the device (depends on VCC), the CKDIV8 Fuse can be
programmed in order to divide the internal frequency by 8. It must be ensured that the resulting divided clock
meets the frequency specification of the device."
I don't know about "die" as you said, not sure how well it operate at >3X max clock speed.
Crystal caps - don't know. You're the test pilot on that one.
So first of all I know the maximum operating frequency of the ATmega328P is 20MHz but some people on Youtube naild it? And i've got a few ATmega328P laying around so why not give it a try?
"If the crystal frequency exceeds the specification of the device (depends on VCC), the CKDIV8 Fuse can be
programmed in order to divide the internal frequency by 8. It must be ensured that the resulting divided clock
meets the frequency specification of the device."
I will do some research on programming the CKDIV8 Fuse (I think It's gonna take a while) What would happen If I wouldn't change the Fuse and just power it on? Or will it just not boot?
Try it. The chip will certainly run hotter, as temperature is directly related to switching speed.
As far as stuff working reliably, who knows. One member here reports working at 32 MHz, I don't think I've seen any reports of much functionality of the chip has been checked out. I'm sure changes were made to support the baud rates so serial comm's could be understood - or he just halved the speeds so 9600 in code looked like 19200 to the outside world for example.
The clock divide by 8 - that just needs the upper bit of the Low fuse byte flipped, see Table 28-9 in the '328P datasheet.
Change that in boards.txt for the board type you are using:
So if you were to copy/update this section as a new board type for example, from uno to uno64:
You aren't limited to a prescaler of divide by 8 or 1. That's only true for when you first reset the processor. That's determined by that fuse. But once you're up and running you can change the prescaler to divide by 2, 4, 8, 16,... 256 by writing to a register.
So you could use the divide by 8 fuse to be safe and start at 8MHz. And then in your sketch change the prescaler to divide by 4 so you'd have a 16MHz clock.
I'm not sure what that means for how you set up your board though. I think the bootloader would need to run at 8MHz but you'd want 16MHz for the core. I don't know.
So first off all I'm currently on vacation (Using my laptop) In 5 days I'll be back but I thought I found this code for calculating Pi
int ledPin =Â 13;
void setup(){
 Serial.begin(9600);    Â
Â
 Serial.println("integrating sinc to get pi");
}
void loop(){
 double a = -5000000;
 double b = 5000000;
Â
Â
 for(double N = 1; N <=100000000; N*=2){
   Serial.print("N:");
        float temp = N;
        Serial.print(N);
   Serial.print(" integration: ");
       digitalWrite(ledPin, HIGH);
       double intVar = integrate(a,b,N);
       digitalWrite(ledPin, LOW);
   Â
       Serial.println(intVar,7);
       Â
        delay(1000);
 }
Â
Â
Â
Â
}
double f(double x){
 if(x == 0)//lim(sin(x)/x,x,0) = 1
  return 1;
 return (sin(x)/x);
}
double integrate(double a,double b,double N){
  double dx = (b - a) / N;//delta x, not instantaneous
  double sum = 0;
  for(double iter = 1; iter < N; iter++){
    double x = a + iter*dx;
      sum += f(x);
  }
  return sum*dx;
}
And I was wondering what would happen if I didn't change the fuse at all and just add an 64MHz crystal and see what time it takes to get to
N:65536.00Â integration: 154.1663513
And than take a look how long it takes with a normal arduino, and then see how long it takes than with an Arduino with a 64MHz Crystal and fuse (That i already added to the board.txt )
I have run many AVRs on 32Mhz using TTL oscillator (these are really cheap on ebay for SM device)
No problems to report on ATTinys, ATMega328's (even cheap chinese clones) and ATMega1284..
No heat issues, in fact no noticable heat increase
Timers, UARTS, SPI - all working fine even with sensitive timings for PAL TV and UART of 250kbps
And I havent killed one yet
Just remember your fuses settings - if you mess up you could end up with a bricked micro !
If you overclock you'll lose the high end of the temperature range first, generally CMOS clocks
faster cool and at higher voltages. Also unless you exercise all the different instructions and
functional blocks on the chip you don't really know when it starts failing
(resistance increases with temperature, capacitance is invariant and on-resistance
drops rapidly with gate voltage - hence the temperature and voltage dependences.
Power consumption depends on frequency and voltage-squared.
The oscillator in an Arduino is a pierce oscillator which is a parallel mode oscillator, and operates with crystals in their fundamental mode.
Crystals which are labelled as 64 Mhz are overtone crystals and will only run at their marked frequency in a oscillator circuit which is designed for such crystals.
Such an oscillator must have a loop gain greater than 1 at the marked frequency, but less than 1 at the fundamental mode frequency.
If you run an overtone crystal in a fundamental mode oscillator, then the crystal wont run at its marked frequency, but will run at a lower frequency which is usually approx a 3rd or a 5th of the marked frequency.