PlatformIO Community

Working with Elegoo Mega2560 R3 Board> Help

Hello, I recently installed PlatformIO to use with my Arduino Mega2560 R3 board. I am able to write a simple program to blink the onboard yellow led. The program compiles without any errors. The problem is when I try to Upload the code. I keep getting this message:

avrdude: stk500_recv(): programmer is not responding

My Comm port is 10 and my OS recognizes this port. I am able to use the Arduino IDE without any problems so I must have a setup/config error within PlatformIO.

Any ideas what I should try?

Thank you,
Joe

What com port does PlatformIO say it’s trying to use when you upload? (hint: look at the lines just after the data/program usage)

DATA:    [          ]   0.1% (used 9 bytes from 8192 bytes)
PROGRAM: [          ]   0.6% (used 1630 bytes from 253952 bytes)
Configuring upload protocol...
AVAILABLE: wiring
CURRENT: upload_protocol = wiring
Looking for upload port...
Auto-detected: COM7
Uploading .pio\build\atmega2560\firmware.hex

Also, what is in your platformio.ini file? I use the following to successfully upload to an atmega2560 clone

[env:atmega2560]
platform = atmelavr
framework = arduino
board = megaatmega2560

If PlatformIO isn’t detecting the right com port for your board, you can manually specifiy it via upload_port = COM10

You should do a verbose upload in the Arduino IDE and show us the output.

grafik

The bootloader might be communicating at a different baudrate than what PIO is expecting. (Or, the wrong port alltogether)

Hello, here is the Arduino output:

Build options changed, rebuilding all
Sketch uses 1480 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega2560 -cwiring -PCOM10 -b115200 -D -Uflash:w:C:\Users\DDS\AppData\Local\Temp\ArduinoServer\MW/MyBlink.ino.hex:i 

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

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM10
         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\DDS\AppData\Local\Temp\ArduinoServer\MW/MyBlink.ino.hex"
avrdude: writing flash (1480 bytes):

Writing | ################################################## | 100% 0.24s

avrdude: 1480 bytes of flash written
avrdude: verifying flash memory against C:\Users\DDS\AppData\Local\Temp\ArduinoServer\MW/MyBlink.ino.hex:
avrdude: load data flash data from input file C:\Users\DDS\AppData\Local\Temp\ArduinoServer\MW/MyBlink.ino.hex:
avrdude: input file C:\Users\DDS\AppData\Local\Temp\ArduinoServer\MW/MyBlink.ino.hex contains 1480 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.18s

avrdude: verifying ...
avrdude: 1480 bytes of flash verified

avrdude done.  Thank you.

I’v uploaded some screen shots. I hope this helps in find what could be wrong with the upload process.

Thank you,
Joe

You have ATmega2560 as your board in the platformio.ini, do you get the same failure with megaatmega2560?

1 Like

I think the ATmega2560 board target uses the MegaCore board support package which uses a newer/different and smaller bootloader (Optiboot based, about 7K smaller, giving more program memory space), which is the culprit. Changing to megaatmega2560 should fix that, unless you want to (and have the facility to) burn a new bootloader to the Atmega2560 in order to use MegaCore.

1 Like

Main difference is also that when using ATmega2560, avrdude is instructed to use the protocol arduino but with megaatmega2560 is wiring

Which matches what the working Arduino IDE upload is using.

2 Likes

It’s working!

I changed the board = line in the platformio.ini file to

board = megaATmega2560

Compiled the code and it downloaded without any problems.

Wow!

I’m so happy, thanks to everyone who responded to my message.

Have a great day!

Joe

1 Like