Avrdude : inconsistent performance

Arduino Pro Mini 328P with FTDI breakboard.

PIO version of avrdude uploading very inconsistent, whereas arduino’s ide version - always uploads.
I use the same source ( obviously for arduino’s ide it is missing #include ). There are no HW changes between attempts to upload.

Arduino’s uploads consistently and slowly - visually it’s progress of upload is slow. The same with PIO is lightning fast but it fails on verification.

Arduino’s IDE avrdude output:

avrdude: Version 6.0.1, compiled on Apr 14 2015 at 19:04:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/az/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 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 : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "/tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex"
avrdude: writing flash (10458 bytes):

Writing | ################################################## | 100% 2.93s

avrdude: 10458 bytes of flash written
avrdude: verifying flash memory against /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex:
avrdude: load data flash data from input file /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex:
avrdude: input file /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex contains 10458 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.19s

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

avrdude done.  Thank you.

PIO avrdude:


Looking for upload port...
 
Warning! Please install `99-platformio-udev.rules` and check that your board's PID and VID are listed in the rules.
https://raw.githubusercontent.com/platformio/platformio/develop/scripts/99-platformio-udev.rules
Auto-detected: /dev/ttyUSB0
Uploading .pioenvs/pro8MHzatmega328/firmware.hex
 

Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
 
avrdude: Version 6.0.1, compiled on Apr 14 2015 at 19:04:16
System wide configuration file is "/home/az/.platformio/packages/tool-avrdude/avrdude.conf"
User configuration file is "/home/az/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port                    : /dev/ttyUSB0
Using Programmer              : arduino
Overriding Baud Rate          : 57600
AVR Part                      : ATmega328P
Chip Erase delay              : 9000 us
PAGEL                         : PD7

BS2                           : PC2
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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
lock           0     0     0    0 no          1    0      0  4500  4500 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 : Arduino
Description     : Arduino
Hardware Version: 2
Firmware Version: 1.16
Vtarget         : 0.0 V
Varef           : 0.0 V
Oscillator      : Off
SCK period      : 0.1 us
 
avrdude: AVR device initialized and ready to accept instructions
 

Reading | ################################################## | 100% 0.00s
 
 
avrdude: Device signature = 0x1e950f
avrdude: reading input file ".pioenvs/pro8MHzatmega328/firmware.hex"
avrdude: writing flash (10904 bytes):
Writing | ########################################
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x00
#avrdude: stk500_cmd(): programmer is out of sync
*** [upload] Error 1
========================== [ERROR] Took 10.65 seconds ==========================

Could you provide full output of Arduino IDE? Go to Arduino IDE settings, and check “Verbose”…

Using library SPI in folder: /home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/libraries/SPI 
Using library DW1000 in folder: /home/az/work/Arduino/libraries/DW1000 

/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10605 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/variants/eightanaloginputs -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/libraries/SPI -I/home/az/work/Arduino/libraries/DW1000/src /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp -o /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.o 
In file included from /home/az/work/Arduino/libraries/DW1000/src/DW1000.h:248:0,
                 from BasicConnectivityTest.ino:15:
/home/az/work/Arduino/libraries/DW1000/src/DW1000Time.h:27:0: warning: "TIME_RES" redefined [enabled by default]
 #define TIME_RES 0.000015650040064103f
 ^
In file included from BasicConnectivityTest.ino:15:0:
/home/az/work/Arduino/libraries/DW1000/src/DW1000.h:26:0: note: this is the location of the previous definition
 #define TIME_RES 0.000015650040064103
 ^
In file included from /home/az/work/Arduino/libraries/DW1000/src/DW1000.h:248:0,
                 from BasicConnectivityTest.ino:15:
/home/az/work/Arduino/libraries/DW1000/src/DW1000Time.h:28:0: warning: "TIME_RES_INV" redefined [enabled by default]
 #define TIME_RES_INV 63897.6f
 ^
In file included from BasicConnectivityTest.ino:15:0:
/home/az/work/Arduino/libraries/DW1000/src/DW1000.h:27:0: note: this is the location of the previous definition
 #define TIME_RES_INV 63897.6
 ^
Using previously compiled file: /tmp/build4777040840136462297.tmp/SPI/SPI.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/DW1000/DW1000Time.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/DW1000/DW1000.cpp.o
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-gcc -c -g -x assembler-with-cpp -mmcu=atmega328p -DF_CPU=8000000L -DARDUINO=10605 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/variants/eightanaloginputs /home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/wiring_pulse.S -o /tmp/build4777040840136462297.tmp/wiring_pulse.S.o 
Using previously compiled file: /tmp/build4777040840136462297.tmp/wiring_shift.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/wiring.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/wiring_pulse.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/hooks.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/wiring_digital.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/WInterrupts.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/wiring_analog.c.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/USBCore.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/new.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/HardwareSerial1.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/WString.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/abi.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/HardwareSerial0.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/HardwareSerial.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/Print.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/Stream.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/HID.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/CDC.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/HardwareSerial2.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/IPAddress.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/Tone.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/WMath.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/main.cpp.o
Using previously compiled file: /tmp/build4777040840136462297.tmp/HardwareSerial3.cpp.o
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/wiring_pulse.S.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/wiring_shift.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/wiring.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/wiring_pulse.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/hooks.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/wiring_digital.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/WInterrupts.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/wiring_analog.c.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/USBCore.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/new.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/HardwareSerial1.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/WString.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/abi.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/HardwareSerial0.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/HardwareSerial.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/Print.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/Stream.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/HID.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/CDC.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/HardwareSerial2.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/IPAddress.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/Tone.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/WMath.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/main.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-ar rcs /tmp/build4777040840136462297.tmp/core.a /tmp/build4777040840136462297.tmp/HardwareSerial3.cpp.o 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-gcc -Wall -Wextra -Os -Wl,--gc-sections -mmcu=atmega328p -o /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.elf /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.o /tmp/build4777040840136462297.tmp/SPI/SPI.cpp.o /tmp/build4777040840136462297.tmp/DW1000/DW1000Time.cpp.o /tmp/build4777040840136462297.tmp/DW1000/DW1000.cpp.o /tmp/build4777040840136462297.tmp/core.a -L/tmp/build4777040840136462297.tmp -lm 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.elf /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.eep 
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.elf /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex 

Sketch uses 10,458 bytes (34%) of program storage space. Maximum is 30,720 bytes.
Global variables use 670 bytes (32%) of dynamic memory, leaving 1,378 bytes for local variables. Maximum is 2,048 bytes.
/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avrdude -C/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex:i 

avrdude: Version 6.0.1, compiled on Apr 14 2015 at 19:04:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/az/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 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 : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: reading input file "/tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex"
avrdude: writing flash (10458 bytes):

Writing | ################################################## | 100% 2.93s

avrdude: 10458 bytes of flash written
avrdude: verifying flash memory against /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex:
avrdude: load data flash data from input file /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex:
avrdude: input file /tmp/build4777040840136462297.tmp/BasicConnectivityTest.cpp.hex contains 10458 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 2.19s

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

avrdude done.  Thank you.

the /home/az/.avrduderc is empty.

diff -h /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/etc/avrdude.conf /home/az/.platformio/packages/tool-avrdude/avrdude.conf
761a762,771
> # https://github.com/platformio/platformio/issues/717 Arduino Slr ISP Support
> programmer
>   id    = "arduinoisporg";
>   desc  = "Arduino ISP Programmer";
>   type  = "usbtiny";
>   connection_type = usb;
>   usbvid     = 0x2A03;
>   usbpid     = 0x0049;
> ;
> 
8046a8057
>     #signature		= 0x1e 0x95 0x0F;