platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
136 stars 104 forks source link

avrdude lacking functionality #275

Open uwezi opened 2 years ago

uwezi commented 2 years ago

The version of avrdude which is shipped with PlatformIO lacks support for widespread uploaders like the usbasp by Thomas Fischl. This functionality is available in the regular build of avrdude.

Configuration

Operating system: Windows 10 64bit

PlatformIO Version: Core 5.2.5 Home 3.4.1

Description of problem

When experimenting with the upload settings under PlatformIO to utilize bare microcontrollers without Arduino-boards I noticed that avrdude was giving me error messages about not finding the necessary USB device for my programmer, an usbasp - normally fully supported by avrdude. Changing the executable in the command to a known-working copy of avrdude everything works fine and as expected. Both avrdude-executables identify themselves as version 3.6

Steps to Reproduce

see here: https://youtu.be/BKO1rYMPF_k?t=480

Actual Results

error message

Expected Results

no error message

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:ATmega328P]
platform = atmelavr
board = ATmega328p

board_build.f_cpu = 1000000UL

upload_protocol = custom
upload_flags    = -pm328p
    -Pusb
    -B4
    -cusbasp

upload_command = "C:\Program Files (x86)\AVRDUDESS\avrdude" $UPLOAD_FLAGS -U flash:w:$SOURCE:i 

Source file to reproduce issue:

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
  DDRC = (1 << PB5);
  while (1)
  {
    PORTC ^= (1 << PB5);
    _delay_ms(500);
  }
}

Additional info

MCUdude commented 1 year ago

@uwezi can you try with the latest upstream version? Avrdude 6.3 has been replaced with version 7.1, and is a huge improvement.

Since there hasn't been a release in a while, you'll have to tell PlatformIO to use the git version:

[env:ATmega328P]
platform = https://github.com/platformio/platform-atmelavr.git
board = ATmega328p

board_build.f_cpu = 1000000UL

upload_protocol = custom
upload_flags    = -pm328p
    -Pusb
    -B4
    -cusbasp

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