1

I am using an Arduino Nano (Clone) which I was programming with the Arduino IDE (Version 1.8.5 on Mac OS X 10.10.5).

Using the Arduino IDE I need to re-plug the Nano before uploading, but after doing this everything works as expected and the sketch is being uploaded successfully.

I then tried to use Platformio core (CLI) and get the well-known not in sync error:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00

As said, this error is well-known, esp. in relation to Arduino clones, and reported several times around the Internet with different solutions.

I just wonder how Arduino IDE is able to upload the code successfully, but Platformio is not since both Arduino IDE and Platformio CLI are just calling avrdude to upload the code.

Remark: Uploading the same code to an Arduino Uno works like a charm with both using Arduino IDE and Platformio.


Updates due to further investigation:

I enabled verbose output for both Arduino IDE and Platformio showing the exact avrdude command executed to upload the built hex-file. I adopted the call to avrdude from Arduino IDE with the path of the compiled Platformio code. This works as expected:

avrdude -v -p atmega328p -c arduino -b 57600 -D -P /dev/cu.usbserial-00000000 -U flash:w:.pioenvs/nano/firmware.hex:i

I then had a look at the command used by Platformio which is quite similar but provides an additional -C for a config-file:

avrdude -v -p atmega328p -C /Users/Albert/.platformio/packages/tool-avrdude/avrdude.conf -c arduino -b 57600 -D -P "/dev/cu.usbserial-00000000" -U flash:w:.pioenvs/nano/firmware.hex:i

Unfortunately, I am not able to run this command from the Terminal due to an error:

avrdude: Version 6.0.1, compiled on Dec 16 2013 at 17:26:24
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/Users/Albert/.platformio/packages/tool-avrdude/avrdude.conf"
avrdude: syntax error at /Users/Albert/.platformio/packages/tool-avrdude/avrdude.conf:1080
  • try to upload to Nano with Uno selected as board – Juraj Sep 23 '18 at 20:40
  • @Juraj: Using Uno instead of Nano does not work as well. – albert Sep 23 '18 at 20:49
  • has Platformio an "old bootloader" option for Nano? – Juraj Sep 23 '18 at 21:00
  • There is a 'normal' and a 'new' option. Both not working. The only difference seems to be the baud rate at first glance. I might have a look at the upload scripts for further differences... – albert Sep 23 '18 at 21:02
  • 1
    I've tried replicating this issue using a nano clone on mac os 10.12.6 using platformio IDE, and there were no issues. I would try two things: upload a simple blink sketch (or an empty loop) using arduino IDE to make sure the board doesn't try to connect over UART thus interfering with the upload process under platformio; and if this doesn't help, then I would re-flash the bootloader. Also, if platformio is not up to date, it is certainly a good idea to update it to make sure it uses the latest avrdude + config file. – ex-punctis Sep 23 '18 at 21:53

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.