Closed AlbertEmil closed 5 years ago
Resolved in https://github.com/platformio/platform-atmelavr/commit/ccbc004b4539d137cf9e18072cfe921634ca2ec5
Please use board = nanoatmega328new
in your platformio.ini
.
Neither nanoatmega328new
nor nanoatmega328
did do the trick on my Mac. However I was able to upload/flash the code to both of my tested boards with using PlatformIO Core (CLI) on Fedora 29. Due to that, I assume that this issue is not related to the boards itself (from a hardware perspective), but more an avrdude issue of PlatformIO since using Arduino IDE's version of avrdude, if you can call it that way, is working as expected.
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: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.Just to make sure the installation of Platformio is working as desired I switched to an Arduino Uno board, added the additional environment by
platformio init --board uno
, compiled the code and uploaded it which works like a charm (with Arduino IDE as well as Platformio).I enabled verbose output for both Arduino IDE and Platformio to get the exact
avrdude
command executed to upload the compiled hex-file. I then adopted the call toavrdude
from the Arduino IDE with the path of the compiled hex-file:Using the Arduino IDE's
avrdude
call to upload the hex file which was built by using Platformio works as desired, so I had a look at Platformio's call toavrdude
which is slightly different form the Arduino one and provides an additional config-file with passing the-C
option (neglecting possible pre-upload scripts here):Unfortunately, I am not able to run this command from the Terminal by myself due to an error:
Arduino IDE's version of
avrdude
is packed with the Arduino IDE itself and uses a config-file in theetc
subdirectory of the Arduino application directory. Since I am assuming that the error might come from different config files, I compared both. The only difference in theATmega328
section is an additionalin Platformio's config-file.
For the sake of completeness I should mention that I have three different versions of
avrdude
installed on my system:/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude
, config file at/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf
~/.platformio/packages/tool-avrdude/avrdude
, config file at~/.platformio/packages/tool-avrdude/avrdude.conf
/usr/local/CrossPack-AVR/bin/avrdude
and globally available on Terminal asavrdude
, no obvious config file (neither default config file at/etc/avrdude.conf
nor~/.avrduderc
available)