diff --git a/AVRdragon_Optiboot_Atmega328/docs/notes b/AVRdragon_Optiboot_Atmega328/docs/notes new file mode 100644 index 0000000..940cdb9 --- /dev/null +++ b/AVRdragon_Optiboot_Atmega328/docs/notes @@ -0,0 +1,78 @@ + + + +where is the (optiboot) bootloader? Hex file is here: +arduino-1.8.5/hardware/arduino/avr/bootloaders/optiboot_atmega328.hex + +ref: https://forum.arduino.cc/index.php?topic=125622.0 + +example cmd: +avrdude -c dragon_isp -P usb -p atmega328p -U flash:w:main.hex:i + +ref: https://forum.arduino.cc/index.php?topic=350727.0 + +HOWEVER THAT IS WRONG. TRAP. + +EDIT: also need fuse bits programmed or else this will not work. +(external crystal is used, in uno.) +TRAP #2: you need an external crystal (16MHz) in the avrdragon, AFTER programming +the fuse bits. You can solder wires to another uno board's crystal +with the chip removed, if you don't have a 16MHz piece of quartz around. + + + +see https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader +example there (note this is usbtiny) +#avrdude -b 19200 -c dragon_isp -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m +EDIT: looks like sparkfun has incorrect information (or outdated). +see arduino-1.8.5/hardware/arduino/avr/boards.txt +for what arduino has for board values +wrong entry (out of date): +avrdude -b 19200 -c dragon_isp -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m + +correct entry: (efuse must be 0xFD, as the reserved high bits must be set as 1's) +avrdude -b 19200 -c dragon_isp -p m328p -v -e -U efuse:w:0xFD:m -U hfuse:w:0xDE:m -U lfuse:w:0xFF:m + +below are fuse bits. These should be used as well. +avrdude -b 19200 -c dragon_isp -p m328p -v -e -U flash:w:hexfilename.hex -U lock:w:0x0F:m + +see also +http://www.martyncurrey.com/arduino-atmega-328p-fuse-settings/ + + + + +Get a good ziff socket for the dragon. + +Notice that the first header is VCC/GND breakout, the second is ICSP, and the +third is directly tied to ZIFF socket. + +Also notice that JTAG and HV_PRG are not connected. + +My dragon was already setup for this, though some extra gnds were connected +(e.g. I had vcc/gnd header's gnd connected to ICSP #6, and then another GND to +pin 8 on the third breakout. But this picture has only ISP #6 to 8 (omitting +the ground loop). Possibly either will work. I know mine works. + + + +You can watch the leds on the uno to see if it's working. + +if you do it correctly, LED 13 lights up with optiboot, then goes blank (or +into sketch). If you have it failed, from a blank atmega328p, it will +go solid, then after a short while start to blink. + + +I have a dedicated Avrdragon for programming optiboot onto atmega328p. +makes things easy. + + +WRONG CHIP: +remember atmega328p-pu is the right chip +atmega328-pu is wrong. +You can program atmega328-pu, by changing avrdude paramters, or using +-F + +In this case, I changed atmega328p to atmega328 to reflect that I had the +incorrect chip + diff --git a/AVRdragon_Optiboot_Atmega328/docs/quickguide b/AVRdragon_Optiboot_Atmega328/docs/quickguide new file mode 100644 index 0000000..30012fd --- /dev/null +++ b/AVRdragon_Optiboot_Atmega328/docs/quickguide @@ -0,0 +1,23 @@ +gotchas: + +* wrong atmega328 (need atmega328p-pu, not atmega328-pu) (though this can still be used) +* need fuse bits set separate from programming hex (pickit w/pics on the other hand + handles this all in one) +* need lock bits set +* need 16MHz crystal when programming hex and lock bits (can use one from uno + board) + +quick guide: + + set proper wiring on avr dragon (see image in pics) + set fuse bits +avrdude -b 19200 -c dragon_isp -p m328p -v -e -U efuse:w:0xFD:m -U hfuse:w:0xDE:m -U lfuse:w:0xFF:m + add crystal, load hex, and program lock fuse +avrdude -b 19200 -c dragon_isp -p m328p -v -e -U flash:w:hexfilename.hex -U lock:w:0x0F:m + +hexfilename.hex - the optiboot loader is included in +arduino-1.8.5/hardware/arduino/avr/bootloaders/optiboot_atmega328.hex + +for more details, and references, see notes + + diff --git a/AVRdragon_Optiboot_Atmega328/pics/Hx8tT.png b/AVRdragon_Optiboot_Atmega328/pics/Hx8tT.png new file mode 100644 index 0000000..0b6fef6 Binary files /dev/null and b/AVRdragon_Optiboot_Atmega328/pics/Hx8tT.png differ