I reprogrammed the Atmega32u4 on my Arduino Uno Wifi Rev2 in order to use it as a human interface device, but I am now having difficulty programming the 4809 (through the 32u4 over UPDI) with the Arduino software. I have tried reprogramming the 32u4 with medbg_updi.hex from Atmel Studio and also Xplained Yourself Firmware from Xplained Yourself | Hackaday.io.
I have had some success writing some smaller applications to the 4809 but when I try to program larger applications (which used to work before I fiddled with the 32u4), I now get verification error saying that there is a mismatch. This happens when I upload binaries that are larger than 16KiB. I have thoroughly tested this by programming different sized binaries with avrdude. A strange phenomena is seen when I try to read back the flash. It would seem that the 2nd 16KiB repeats the first 16KiB... and after I write more than 16KiB it corrupts the beginning of the first 16KiB. Here is the output from avrdude from an upload I attempted
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0200
0x08 != 0x0c
avrdude: verification error; content mismatch
avrdude: jtag3_edbg_signoff(): unexpected response 0x03, 0x80
When cross referencing with other working Uno Wifi Rev2 boards, they have
ICE firmware version: 1.19 (rel. 57)
while I now apparently have
ICE firmware version: 1.13 (rel. 43)
I do not see any place to find the updated/original firmware which came with my Arduino. My thought is that the firmware is not available for direct download because it may be licensed from Microchip (Atmel) and not distributed/proprietary...
Please assist me if possible in restoring the full functionality of my Arduino Uno Wifi Rev2. I first posted my question on arduino stackexchange and sent an email to Arduino support (email@example.com). Arduino support directed me to this forum. I am willing to do any tests/try things to get this to work.
TL:DR -> Is there a download for the original mEDBG that came on 32u4 of Uno Wifi Rev2? If not, how can I program my device (over 16k) via other means (I have looked into/tried MegaCoreX/OptiBoot but have not had success)?