Página
principal
ARDUINO - Grabar el boot loader
El otro día me llegaron dos Atmega328, los había pedido para
colocarlos en el arduino. El caso es que venían sin el cargador de
arduino, normal si son nuevos. ¿Como grabar el boot loader en el
Atmega328?. Tengo varios grabadores de ATMEGA, entre ellos uno
conectado al USB llamado usbasp de la página:
http://www.fischl.de/usbasp/
Este montaje lo he construido yo también, y mis experiencias las
comente hace unos años en mi página:
miATp.html
Como la versión que tengo de Arduino IDE no soporta mi grabador
usbasp he tenido que buscar gente que le pasa lo mismo y encontré la
página:
http://wolfpaulus.com/tag/atmega168
Explica bastante bien los comandos que tienes que dar al avrdude
para grabar el boot loader.
Yo los he cambiado para que me sirvan al mio y aquí los expongo.
avrdude
-p m328p -c usbasp -V -e -U lock:w:0x3F:m -U
hfuse:w:0xD8:m -U lfuse:w:0xFF:m -U efuse:w:0x03:m
avrdude -p
m328p -c usbasp -V -D -U
flash:w:ATmegaBOOT_168_atmega328.hex:i
avrdude -p
m328p -c usbasp -V -U lock:w:0x0F:m
También expongo el resultado de la consola de avrdude.
root@debian6:/home/seta#
avrdude -p m328p -c usbasp -V -e -U lock:w:0x3F:m -U
hfuse:w:0xD8:m -U lfuse:w:0xFF:m -U efuse:w:0x03:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## |
100% 0.02s
avrdude: Device signature = 0x1e950f
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):
Writing | ################################################## |
100% 0.01s
avrdude: 1 bytes of lock written
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## |
100% 0.02s
avrdude: 1 bytes of hfuse written
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## |
100% 0.02s
avrdude: 1 bytes of lfuse written
avrdude: reading input file "0x03"
avrdude: writing efuse (1 bytes):
Writing | ################################################## |
100% 0.02s
avrdude: 1 bytes of efuse written
avrdude: safemode: Fuses OK
avrdude done. Thank you.
__________________GRABACION DE
CODIGO________________
root@debian6:/home/seta# avrdude -p m328p -c
usbasp -V -D -U flash:w:ATmegaBOOT_168_atmega328.hex:i
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## |
100% 0.02s
avrdude: Device signature = 0x1e950f
avrdude: reading input file "ATmegaBOOT_168_atmega328.hex"
avrdude: writing flash (32670 bytes):
Writing | ################################################## |
100% 154.37s
avrdude: 32670 bytes of flash written
avrdude: safemode: Fuses OK
avrdude done. Thank you.
__________________VERIFICACION DE
CODIGO________________
root@debian6:/home/seta# avrdude -p m328p -c
usbasp -V -D -U flash:v:ATmegaBOOT_168_atmega328.hex:i
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## |
100% 0.02s
avrdude: Device signature = 0x1e950f
avrdude: verifying flash memory against
ATmegaBOOT_168_atmega328.hex:
avrdude: load data flash data from input file
ATmegaBOOT_168_atmega328.hex:
avrdude: input file ATmegaBOOT_168_atmega328.hex contains 32670
bytes
avrdude: reading on-chip flash data:
Reading | ################################################## |
100% 140.54s
avrdude: verifying ...
avrdude: 32670 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
root@debian6:/home/seta# avrdude -p m328p -c usbasp -V
-U lock:w:0x0F:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## |
100% 0.02s
avrdude: Device signature = 0x1e950f
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):
Writing | ################################################## |
100% 0.02s
avrdude: 1 bytes of lock written
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Espero que os sirva.
Un saludo.
SETA43