Programmer not responding - ONLY with Mega boards

A couple of days ago I tried to upload new code to my Arduino Mega and found that I could not. When I attempt to upload, I get “Programmer not Responding” and “not in sync” errors. The previously loaded code had been working fine for weeks. The board was mounted in a closed assembly housing, so no new extra wires/inputs/jumpers had been added for quite some time. Uploading was being performed through the USB port, which had been extended to the external wall of the housing, so no disassembly was ever needed to make code changes. I'm working on a Windows 10 machine using the web based IDE (except where noted below). Here’s what I’ve tried:

• Check that proper com ports have been selected, etc – fail
• Uninstall/reinstall USB drivers -fail
• Upload a smaller alternative code – fail
• Upload that same smaller code to an Uno – pass
• Remove Mega from assembly and upload code – fail
• Upload previously successful version of code to Mega – fail
• Try uploading code from different work (windows 10) machine - fail
• Uninstall/re-install Arduino-agent and USB drivers for all boards. -fail
• Try uploading using desktop Arduino IDE - fail
• Reflash bootloader on Mega – bootloader flashed ok, but still couldn’t upload code via USB – fail
• Order brand new Mega board and upload code to it – fail
• Try the code on the Uno again. – pass
• Perform system restore from 8/2 (my earliest available) and try uploading code – fail
• Roll back as many windows updates as I’m able to before last successful code upload (7/27) and try uploading code – fail

At this point, I’m fresh out of ideas. I’m not a super-advanced Arduino user, but it seems that if a brand new Mega board isn’t working, but the Uno does, it’s probably not the board. The fact that it also doesn’t work on another Windows 10 machine might point to some windows update that screwed up the works at some point, but I can’t figure it out. Anyone seen this before?

Post the text of the error output with verbose upload checked in preferences.

Does your program include any string with three consecutive exclamation points in it? This will choke some versions of the bootloader - it was fixed long ago, but some clones still have the bootloader.

When you say "fail" what do you mean? Particularly w/regard to com ports - does the port show up? Does the loopback test work?

Most of the steps you have taken are unrelated to the problem at hand.

Also what version of the IDE (I have no experience except with desktop IDE)? What version of AVR boards package?

Thanks for the response.

No exclamation points in the code aside from the occasional "!=". COM ports show up, and the boards are all recognized when plugged in.

Loopback test passes - typed characters are echoed appropriately.

Verbose output (from the web IDE) is as follows:

Flashing with command:C:/Users/aferdinand/.arduino-create/arduino/avrdude/6.3.0-arduino9/bin/avrdude.exe -CC:/Users/aferdinand/.arduino-create/arduino/avrdude/6.3.0-arduino9/etc/avrdude.conf -v -patmega1280 -carduino -PCOM5 -b57600 -D -Uflash:w:C:/Users/AFERDI~1/AppData/Local/Temp/arduino-create-agent405492790/Dispenser_InitEEPROM_copy.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53

Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:/Users/aferdinand/.arduino-create/arduino/avrdude/6.3.0-arduino9
/etc/avrdude.conf"

Using Port : COM5
Using Programmer : arduino
Overriding Baud Rate : 57600

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xc6

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xc6

and so on through 10 attempts. Boards appear to be genuine arduino, purchased through digikey.
Desktop IDE version 1.8.6
Web IDE version 5.1.0
AVR Boards version 1.6.22 (but I usually work in the web editor)

I'm having this issue with both Mega boards, but the Uno works fine. Plan to bring my Leonardo in to try tomorrow. What's confusing here is that I hadn't made any system changes when it stopped working.

Thanks so much for any help you can provide!

OK - so crazy (an ultimately frustrating) turn of events.

The problems with the web IDE have not gone away

The problems with the desktop IDE (windows 10 app) have not gone away.

The standard windows desktop IDE (XP and newer) seems to work fine.

Go figure. I would really like to know what the difference is, but for now I'm just happy to be back up and running after a week of downtime.

DrAzzy - if you have any additional thoughts on the original issue, I'd appreciate them in case this crops up again.

In the meantime - off in search of a dark theme before I go blind...

Hm, I don't have any thoughts, other than - that was a mega1280, not mega2560 you were trying to upload to, right? Because it's trying to upload to a 1280, and if it was a 2560, that would be the error you'd get I think.

The windows 10 app store version seems to have weird problems for some people, due to weirdness introduced by the app-store-ification.

The response from target to avrdude other than 0x00 or 0xFF usually means not synchronized serial communication due incorrect board selected. As DrAzzy wrote, use appropriate MCU and baudrate. Is your MCU 2560 then why 1280? Also baudrate, new bootloader is probably for 115200 not 57600.