Help us understand the problem. What is going on with this article?

AVRをクリスタル(=水晶発振器)で動かす

More than 5 years have passed since last update.

fuseの計算

http://qiita.com/takeru@github/items/b852bb3052053355f9fe

ArduinoISPのデフォルトで動いているmega88pを
20MHzのクリスタルで動作するようにfuseを書き換えます。

efuse=0x07,hfuse=0xDDはそのまま。

lfuse=0xE2を

bit7:CKDIV8 = 1 8分周しない
bit6:CKOUT = 1 クロック出力しない
bit5:SUT1 = 1
bit4:SUT0 = 1 => 遅い起動(=安定)
bit3:CKSEL3 = 0
bit2:CKSEL2 = 1
bit1:CKSEL1 = 1 => 0.4-20MHz 全振幅発振器
bit0:CKSEL0 = 1 => 外部クリスタル

lfuse=0xF7 にする。

クリスタルを接続する

クリスタル20MHzと12-22pHのコンデンサを接続。
(とりあえず、コンデンサなしでも動いてはいる)

fuseを書く

http://qiita.com/takeru@github/items/8f9f3b44daf30c6c34aa

avrdudeでやってもいいが、boards.txtに定義を追加すればArduinoIDEから書けるはず。

###########################################
avr88p20.name=ATmega88P / Ext.20MHz
avr88p20.upload.maximum_size=8192
avr88p20.bootloader.low_fuses=0xf7
avr88p20.bootloader.high_fuses=0xdd
avr88p20.bootloader.extended_fuses=0x07
avr88p20.bootloader.path=dummy
avr88p20.bootloader.file=dummy.hex
avr88p20.bootloader.unlock_bits=0x3F
avr88p20.bootloader.lock_bits=0x3F
avr88p20.build.mcu=atmega88p
avr88p20.build.f_cpu=20000000L
avr88p20.build.core=arduino:arduino
avr88p20.build.variant=standard

これを追加して、選択して、"ブートローダ書き込み"でfuseが書かれる。
その後、スケッチを再度送信する。

delay(1000)で1秒なことをかくにん。

クリスタルを抜いて、動作がとまればクロックの変更大成功。

シリアル通信が115200 baudでも文字化けしない。やったぜ。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away