User Tools

Site Tools


avr-rcosc

AtMega168 + internal RC oscillator + Arduino bootloader

It took me a while to configure this MCU.

Set the fuses. The biggest problem was to figure out correct BOOTSZ. Here is a convenient tool for that.

/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -patmega168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xF8:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xE2:m

Burn bootloader.

/usr/share/arduino/hardware/tools/avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -patmega168 -cstk500v1 -P/dev/ttyUSB0 -b19200 -Uflash:w:/tmp/arduino-1.6.8-linux64/arduino-1.6.8/hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168_pro_8MHz.hex:i

Confiugure IDE.

atmega168bb.name=ATmega168 on a breadboard (8 MHz internal clock)

atmega168bb.upload.protocol=arduino
atmega168bb.upload.maximum_size=30720
atmega168bb.upload.speed=19200

atmega168bb.bootloader.low_fuses=0xE2
atmega168bb.bootloader.high_fuses=0xDA
atmega168bb.bootloader.extended_fuses=0xF8

atmega168bb.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex
atmega168bb.bootloader.unlock_bits=0x3F
atmega168bb.bootloader.lock_bits=0x0F

atmega168bb.build.mcu=atmega168
atmega168bb.build.f_cpu=8000000L
atmega168bb.build.core=arduino:arduino
atmega168bb.build.variant=arduino:standard

atmega168bb.bootloader.tool=arduino:avrdude
atmega168bb.upload.tool=arduino:avrdude

Update 2021: timing problems

I started having weird timing problems when programming the chip, I had to make the following change to Makefile:

-pro8: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>2' '-DNUM_LED_FLASHES=4' '-DWATCHDOG_MODS'
+pro8: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' '-DWATCHDOG_MODS'

Then compile with

make clean; make pro8
avr-rcosc.txt · Last modified: 2021-09-09 00:53:39 by jenda

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki