1

I've got a new Keyestudio ATmega2560 (compatible with Arduino Mega 2560) board and was trying to upload a simple sketch. I noticed that both the Arduino IDE and PlatformIO were unable to do so, they detected the device but at various points during the upload stage they encountered a timeout.

After dozens of failed attempts I was already concluding that the serial interface must be broken so I created a serial loopback (grounded RESET and connected TX and RX) and opened it in the serial monitor of the Arduino IDE. I noticed that it works perfect, whatever I type gets sent back.

After trying some more and experimenting with different programmers in Arduino IDE I managed to get it to write the software once (write completed but subsequent verifying of the flash memory failed) and opening the serial monitor now it really shows the output I had in my program.

I am wondering, what can I do to isolate further where the problem could be? It seems in theory it is working as expected since I was able to upload the code once, but it is clearly not doing so all the time...

Some outputs:

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Wiring
         Description     : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget         : 0.0 V
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

And one that probably got the furthest:

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega2560
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    262144  256   1024  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Wiring
         Description     : Wiring
         Programmer Model: AVRISP
         Hardware Version: 15
         Firmware Version Master : 2.10
         Vtarget         : 0.0 V
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file "C:\Users\yanic\AppData\Local\Temp\arduino_build_482951/sketch_feb19a.ino.hex"
avrdude: writing flash (2012 bytes):

Writing | #####################################avrdude: stk500v2_ReceiveMessage(): timeout
############# | 100% 10.31s

avrdude: 2012 bytes of flash written
avrdude: verifying flash memory against C:\Users\yanic\AppData\Local\Temp\arduino_build_482951/sketch_feb19a.ino.hex:
avrdude: load data flash data from input file C:\Users\yanic\AppData\Local\Temp\arduino_build_482951/sketch_feb19a.ino.hex:
avrdude: input file C:\Users\yanic\AppData\Local\Temp\arduino_build_482951/sketch_feb19a.ino.hex contains 2012 bytes
avrdude: reading on-chip flash data:

Reading | avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: ser_send(): write error: sorry no info avail
avrdude: stk500_send(): failed to send command to serial port
8
  • Have you tried a dedicated ISP programmer, like USBasp or USBtinyISP, to upload firmware directly to the mcu? Just to check if the mcu still alive? I think there is a chance they overcooked the mcu why reflowed it. For me, I just don't trust made in china arduino clones in general.
    – SimonVu14
    Feb 20 at 8:46
  • the USBtinyISP is actually the one that worked once. I guess it might be the board, too bad, never had problems with keyestudio before... I typcially go for the original one as well, but they fixed so many of the things I hate about the Arduino :) Feb 20 at 9:26
  • Not helpful to solve your problem, but I suggest you move on to a different electronic platform, like ARM 32-bit mcu. This 8-bit ATmega family is like a relic of the past, still good for simple applications though.
    – SimonVu14
    Feb 20 at 10:02
  • What error message do you get? Enable "verbose" output in the settings to get a more details. Please edit your question to include the output you get when trying to upload.
    – Gerben
    Feb 20 at 14:51
  • 1
    I've added two sample outputs Feb 20 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.