A few days ago, we started to upload our program into the atmega2560 chips, but we found that the results are quite diffeerent on periodical running time. By measuring, we found that the system is 16 times slower than our expectation. Later on, we found that the system clock is 1Mhz and we were using the default fuse setting.
However, I mistakenly configured the fuse setting as External Clock (which should be External Crystal Clock). After that, I cannot comminicate with the atmega2560 chips through avrisp2 cables, so that I cannot even reconfigure the fuse setting again.
Fortunately, I found a work around to do this.
http://www.larsen-b.com/Article/260.html
However, I think the program to generate 1MHz clock in previous webpage is not good so that I found the following page to do this.
http://www.bot-thoughts.com/2011/06/generate-clock-signal-with-avr-atmega.html
And my code is listed here,
#include <avr/io.h>
int main(void)
{
TCNT1 = 0;
OCR1A = 8;
TCCR1A |= (1<<COM1A0);
TCCR1B |= (1<<WGM12);
TCCR1B |= (1<<CS10);
DDRB |= _BV(1);
while (1){
// Place your code here
};
return 0;
}
There is also one Chinese forum post about this.
http://www.ourdev.cn/bbs/bbs_content_all.jsp?bbs_sn=3762261