|
|
@ -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 |
|
|
|
|