How I fixed PlatformIO Arduino
Problem:
When uploading an Atmel AVR firmware like for the Arduino Uno using PlatformIO, you see an error message like
Auto-detected: /dev/ttyACM0
Uploading .pio/build/uno/firmware.hex
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
avrdude done. Thank you.
*** [upload] Error 1
or
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/uno/firmware.hex
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=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
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=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
avrdude done. Thank you.
*** [upload] Error 1
Solution
This issue occurs if:
- Either there is no bootloader on the board or the bootloader is damaged or
- The wrong upload speed for this bootloader is selected
Note that you can flash a new/updated bootloader using the Arduino IDE, overwriting the old / defective bootloader. You can do that using an AVR programmer, or you can do it using another Arduino. This will make working with the board much easier in general, but it will most likely fix your programming issues. In case you flash a new bootloader, the correct upload_speed
setting in platformio.ini
will typically be upload_speed = 115200
.
In case you want to work with the bootloader currently present on the board, you need to select the correct upload_speed
setting.
Depending on the age of the bootloader on the board, it will typically have either 115200
, 57600
or 19200
baud speed.
In order to fix the issue, edit platformio.ini
and add
upload_speed = 115200
then restart the upload. In case this doesn’t work, try
upload_speed = 57600
and
upload_speed = 19200
Rarely, the following setting work:
upload_speed = 9600
or
upload_speed = 230400
In case none of these settings work at all, either you are facing a hardware defect or you need to flash a new bootloader onto the board. I recommend to always try to flash a bootloader first before throwing away the board.