You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.8 KiB

4 years ago
4 years ago
  1. where is the (optiboot) bootloader? Hex file is here:
  2. arduino-1.8.5/hardware/arduino/avr/bootloaders/optiboot_atmega328.hex
  3. ref: https://forum.arduino.cc/index.php?topic=125622.0
  4. example cmd:
  5. avrdude -c dragon_isp -P usb -p atmega328p -U flash:w:main.hex:i
  6. ref: https://forum.arduino.cc/index.php?topic=350727.0
  7. HOWEVER THAT IS WRONG. TRAP.
  8. EDIT: also need fuse bits programmed or else this will not work.
  9. (external crystal is used, in uno.)
  10. TRAP #2: you need an external crystal (16MHz) in the avrdragon, AFTER programming
  11. the fuse bits. You can solder wires to another uno board's crystal
  12. with the chip removed, if you don't have a 16MHz piece of quartz around.
  13. see https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader
  14. example there (note this is usbtiny)
  15. #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
  16. EDIT: looks like sparkfun has incorrect information (or outdated).
  17. see arduino-1.8.5/hardware/arduino/avr/boards.txt
  18. for what arduino has for board values
  19. wrong entry (out of date):
  20. 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
  21. correct entry: (efuse must be 0xFD, as the reserved high bits must be set as 1's)
  22. 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
  23. below are fuse bits. These should be used as well.
  24. avrdude -b 19200 -c dragon_isp -p m328p -v -e -U flash:w:hexfilename.hex -U lock:w:0x0F:m
  25. see also
  26. http://www.martyncurrey.com/arduino-atmega-328p-fuse-settings/
  27. Get a good ziff socket for the dragon.
  28. Notice that the first header is VCC/GND breakout, the second is ICSP, and the
  29. third is directly tied to ZIFF socket.
  30. Also notice that JTAG and HV_PRG are not connected.
  31. My dragon was already setup for this, though some extra gnds were connected
  32. (e.g. I had vcc/gnd header's gnd connected to ICSP #6, and then another GND to
  33. pin 8 on the third breakout. But this picture has only ISP #6 to 8 (omitting
  34. the ground loop). Possibly either will work. I know mine works.
  35. You can watch the leds on the uno to see if it's working.
  36. if you do it correctly, LED 13 lights up with optiboot, then goes blank (or
  37. into sketch). If you have it failed, from a blank atmega328p, it will
  38. go solid, then after a short while start to blink.
  39. I have a dedicated Avrdragon for programming optiboot onto atmega328p.
  40. makes things easy.
  41. WRONG CHIP:
  42. remember atmega328p-pu is the right chip
  43. atmega328-pu is wrong.
  44. You can program atmega328-pu, by changing avrdude paramters, or using
  45. -F
  46. In this case, I changed atmega328p to atmega328 to reflect that I had the
  47. incorrect chip
  48. error:
  49. sometimes it will error out:
  50. avrdude: usbdev_open(): Found AVRDRAGON, serno: 00#########
  51. avrdude: jtagmkII_getsync(): sign-on command: status -1
  52. ^C
  53. at this point, just disconnect and reconnect avrdragon from gnulinux box