Fixing avrdude stk500v2_ReceiveMessage(): timeout on Mega 2560 board with CH340G on Linuxmint 19

If you have a Mega 2560 clone with CH340G chip, you might encounter this problem when trying to Upload your sketch on Mega 2560 through USB to serial interface.

Using Port : /dev/ttyUSB0
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
stk500v2_ReceiveMessage(): timeout on Mega 2560

It seem the latest version of stk500boot_v2_mega2560.hex fixed some bugs and created more headache for us that use clones.

I encountered this problem in an environment where I have two identical setup with Mega 2560 with RAMP 1.4 shield both uses CH340G chip. One seem to work fine when uploading Repetier Firmware through USB port and the other giving the above error messages.

There was a recent bugs fixes in Mega 2560 bootloader stk500boot_v2_mega2560.hex which fixed some bugs but now is preventing uploading sketch to Mega 2560 through the USB port. Which is a real pain as the ass.

Whenever you use Arduino to flash the bootloader your Mega 2560 will be flashed with the stk500boot_v2_mega2560.hex. Which will break your Mega 2560 board. This is confirmed Arduino 1.8.7 and 1.8.8 releases.

What you need to do is manually flash the Mega 2560 clone with older working version with a USBasp.

$/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/bin/avrdude -C$/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf -v -patmega2560 -cusbasp -Pusb -Uflash:w:$/arduino-1.8.8/hardware/arduino/avr/bootloaders/stk500v2/Mega2560-prod-firmware-2011-06-29.hex:i -Ulock:w:0x0F:m



Linuxmint 19.1
CH341 default module
Arduino 1.8.8
USBasp v2 with usbasp.atmega8.2011-05-28.hex updated firmware
Mega 2560 with CH340G