#include <std_disclaimer.h> /* You break it, it’s on you. This worked for me. */
I spent far too long beating my head against tgFX and updating the firmware on my TinyG, but I finally solved the problem so I figured I would share the solutions.
tl;dr: Erase the chip *before* trying to flash if all other methods are failing. Don’t rely on a command line switch or check box, erase as a standalone step.
The long version:
Problem: Flashing the Edge .hex using avrdude fails with a mismatch error.
Problem: Changing USB cables has no bearing.
Problem: Flashing the Edge .hex using AVRStudio 6.1 and mkII returns a mismatch error.
Problem: Lockbits are wrong and changing them in AVRStudio 6.1 fails.
Problem: Fuses are wrong and changing them in AVRStudio 6.1 fails.
I know, perfect crap-storm of failures.
Solution:
With power unplugged, remove all connections except power and the mkII.
Power on.
Wait for board to finish booting. (Spindle light stops flashing)
Hit the reset button and wait for the board to finish booting.
Open AVRStudio 6.1.
Select Tools->Device Programming
Select Tool: AVRISP MKII
Select Device: ATxmega192A3
Click Apply
If nothing shows up in the Device Signature and Target Voltage boxes, click the Read buttons next to each.
Select Memories
Select Erase Chip on the Device pulldown if it’s not already selected.
Click Erase Now
Select Fuses
Verify all fuses according to the settings on the wiki.
Select Lockbits
Verify all bits are set according to the settings on the wiki (NOLOCK)
Select Memories
Flash the bootloader according to the wiki.
Flash the firmware according to the wiki.
Turn it all off, disco the mkII, hook up a known good USB cable, power on, fire up tgFX and rejoice.
Hope this helps. 🙂