USBASP not working in platformio

HI there,
i have problem uploading code to AVR uC using USBASP. Connection and everything is good because iam able to detect the chips (i tried Attiny13, 85. Atmega328,8) and also upload code using hex file gnerated in project folder. But using platformio i have no luck uploading.

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 0 
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

*** [upload] Error 1

here is env. settings iam using to upload

    [env:program_via_USBasp]
platform = atmelavr
framework = arduino
board = ATmega328P
upload_protocol = custom
upload_port = usb
upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    $PROJECT_PACKAGES_DIR/tool-avrdude/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -c
    usbasp
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

With which exact program and program invocation is that?

Iam using avrdudess to seting fuses etc. There everything is working.

What version of avrdude is avrdudess using there exactly?

Iam currently on v 6.3

PlatformIO uses the same version (C:\Users\<user>\.platformio\packages\tool-avrdude\).

C:\Users\Max\.platformio\packages\tool-avrdude>avrdude.exe -?
[..]
avrdude version 6.3, URL: <http://savannah.nongnu.org/projects/avrdude/>

Does it work as a test if instead of

you pass the absolute path to the avrdude.conf configuration that avrdudess uses?

[env:program_via_USBasp]

platform = atmelavr

framework = arduino

board = ATmega8

upload_protocol = custom

upload_port = usb

upload_flags =

    -C

    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform

    C:\Program Files (x86)\AVRDUDESS\avrdude.conf

    -p

    $BOARD_MCU

    -P

    $UPLOAD_PORT

    -c

    usbasp

upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

Didint work. Same error as before. I already tried to replace avrdude.conf in platformio folder with the one from avrdudess folder but no succes.

And what if you replace the avrdude.exe too?

If both the executable and the config is the same, the invocation must be the culprit.

Thank you very much. I thoutght the global system env. variabe is used tu call avrdude. But so far seems to be working.

Hi can you please share your final platformio.ini? I can’t get it working with this programmer (it works with avrdudess):

Hi, can you help me? I’m not sure how to replace avrdude.exe. How can i replace it to use the one of avrdudess?
Thank you

Path is shown above.

1 Like

Just to double check: are you also getting the same error message as the original poster?

avrdude: error: program enable: target doesn't answer. 0

Sorry, i have to ovverride avrdude.exe file with the one copied from avrdudess folder? I’m right?

Yes, same error message

Ok, got it working!!! I replaced avrdude.exe in C:\Users\Gio.platformio\packages\tool-avrdude with the one picked from avrdudess folder. They are different in size and date. The one picked from avrdudess folder is some month older (17/02/2016 vs 12/09/2016).

1 Like

Can you provide more information on what exact chip you’re programming in which exact configuration? Maybe PlatformIO’s version needs an update…

Device USB\VID_10C4&PID_EA60\0001 is what it reads in the device manager

image

And the USBasp, and USBasp_clone protocols in PlatformIO look for something different:

Uploading .pio\build\uno\firmware.hex
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor=‘www.fischl.de’ product=‘USBasp’

If that device list is editable, I can try to make a local edit and see if I can make it work?

Nope, just found out I was spoiled by the Arduino IDE… all ya gotta do there is pick Pro Mini 16MHz 5V… it picks type. Not in PIO, I picked my first match… the Atmel168, should have been Atmel328 (sigh)

Sorry all for my stumbling… maybe someone else sees this first and it saves them the time… :smiley: