I can't say what is causing it, but you definitely shouldn't have to re-flash the firmware every time you plug it in. If you can, I'd try swapping the ATmega chip with another one? I'm not sure what to tell you to try on account of it isn't something I've run across.

Do you have a multimeter? To validate what I listed above, everything that I said "is connected to" you set the meter to "continuity" mode (icon usually looks like a speaker beeping) and test with a probe on each thing and make sure it beeps to say they are connected. To check voltage, put one lead on GND and the other on AVCC / VCC / 3.3V and make sure they all say 3.3V. The only thing I can think of is that the voltage is too low or something and the chip is barely functional.