"Upload using Programmer" option not found in Project Tasks

I’m trying to use an Arduino Uno as a programmer for an ATmega328, but I’m not seeing the “Upload as Programmer” option in Project Tasks in the IDE. I don’t see any discernible differences from this similar post. I get a “Please specify board in platformio.ini to use with ‘arduino’ framework” with just “Upload”.

Below is my platformio.ini file:

[env:program_via_ArduinoISP]
platform = atmelavr
framework = arduino
upload_protocol = custom
upload_port = usb
upload_speed = 19200
upload_flags =
    -C
    ${platformio.packages_dir}/tool-avrdude-megaavr/avrdude.conf
    -p
    $BOARD_MCU
    -P
    $UPLOAD_PORT
    -b
    $UPLOAD_SPEED
    -c
    stk500v1
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i

With PlatformIO, the upload task can use either the programmer or a bootloader. For my USBtinyISP programmer, I just have to add upload_protocol to platformio.ini. When this is done, clicking the upload task will use the programmer.

As you have your ini file set up for Arduino as ISP, just click upload.

HTH.

Cheers,
Norm.

Thanks for the reply. When I click upload, however, I get “Please specify board in platformio.ini to use with ‘arduino’ framework”, but when I add board, it still doesn’t work. Should I change my upload_protocol?

What board did you specify? If you are programming an ATmega328, then that’s what the board should be. For an ATmega328P or PA, board should be “atmega328p” and for an ATmega328pb, it should be “atmega328pb”.

When you say, it still doesn’t work, what was the message? The same as previously?

There’s a full list of AVR microcontrollers and each has details of which board setting etc you shiuld use.

HTH

Cheers,
Norm.

I have an ATmega328. If I specify “board = ATmega328” in my platformio.ini, I get “*** [upload] could not open port usb: [Errno 2] No such file or directory: ‘usb’”. If I change my upload_port to “upload_port = /dev/cu.usbmodem21301” which is the current port the Uno is attached to, I get this:

Aha!

I’ve had this when trying to use the Arduino supplied version of avrdude as a standalone. You must specify the config file with the -C option. In my case this would be, on Linux:

avrdude -C /home/norman/.arduino15/packages/Arduino/tools/avrdude/x.x.x-arduino17/etc/avrdude.conf ....

On your Mac, I’m afraid I have no idea.

What I have done is copy the Arduino avrdude and the afore mentioned config file into /home/norman/bin, which is the first entry on my PATH. Now when I run that version of avrdude, I don’t need to specify he config file option as it looks for it in the same directory as the binary I’m executing.

You could try something similar and specify the path to that avrdude in your platformio.ini file.

I suspect what happens is that avrdude is loading from a different directory to the one you specified for the config file, or more likely, the config file is missing from the location specified.

HTH

Cheers,
Norm.

That seems to have worked! Thank you so much for your timely help. Out of curiosity, what is the difference between these two paths:
/Users/camerongoddard/Library/Arduino15/packages/MiniCore/tools/avrdude/7.1-arduino.1/etc/avrdude.conf
and
/Users/camerongoddard/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf

Both seem to work, but the latter spits out some warnings in terminal - something about missing necessary EEPROM addresses?

Glad you got it working!

The only difference between the two versions, that I can see, is the version number. One is 6.3 the other 7.0. Other than that, I don’t have a clue!

I wonder if running a diff on the two files would throw up any clues.

The Arduino Software moves in mysterious ways! :wink:

Cheers,
Norm.