atmega 芯片恢复fuse设置

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值