Can the Arduino ISP board be used with PlatformIO?

I usually use the IDE

Happy Coding with PlatformIO! :blush:

Where should I enter with this conf parameters? I’m trying to upload my code to an Arduino loaded with the ArduinoISP code and one ISP shield.

In platformio.ini set the following line inside desired environment block, and change board to whatever matches your platform:

upload_protocol = arduinoisp

Hope this helps. It worked well for me!

1 Like

I will test it and give you a feedback later. Thanks!

I use the following configuration in my platformio.ini and it works:
[env:unoAsIsp]
platform = atmelavr
framework = arduino
board = uno
upload_protocol = arduinoisp
upload_flags = -P$UPLOAD_PORT -b$UPLOAD_SPEED

upload_port = COM4
upload_speed = 19200

Thank you.

You should only need:

[env:unoAsIsp] platform = atmelavr framework = arduino board = uno upload_protocol = arduinoisp

That’s all I needed at least. Hope it helps.

Thank you for a good start for setting it up.
It is not working for me yet.
Any idea with what i do with this?

Looking for upload port...
Auto-detected: COM17
Uploading .pioenvs\unoAsIsp\firmware.hex
avrdude: Error: Invalid -P value: 'COM17'
Use -P usb:bus:device

Witch I understand is that Auto-detected is wrongly formated for the -P.

I see that @Fernando_Fontana used this:
upload_flags = -P$UPLOAD_PORT -b$UPLOAD_SPEED
upload_port = COM4
upload_speed = 19200

But there is no so to say “:device” there. How is that formated?
Thx for your help

Could open Arduino IDE settings and enable a verbose log for build/upload? After that, please program board with Arduino IDE and copy here the full output from console.

When I use

[env:nano328]
platform = atmelavr
board = nanoatmega328
framework = arduino
upload_protocol = arduinoisp

It bitches about not specifying a com port. The problem is my USBtiny is a device.

Dunce cap award today. I needed ty use usbtiny for the protocol.

1 Like

http://docs.platformio.org/en/latest/platforms/atmelavr.html#upload-using-programmer

I want to program an ATMEGA328P via my AVRISP MK2 using PIO on VS Code (Windows 10).

I don’t understand the instructions on the “upload using programmer” page as I’m not used to command lines. What must I place in the platformio.ini file?

I tried:


[env:myenv]
platform = atmelavr
framework = arduino
upload_protocol = stk500v2
; each flag in a new line
upload_flags =
-Pusb


The error seems to be:
“Please specify board in platformio.ini to use with ‘arduino’ framework”

After adding “board = uno” I get:
“Error: Please specify upload_port for environment or use global --upload-port option.”

I just don’t understand how to my PIO not looking for a COM PORT, but using my MK2.

Maybe someone can explain it to me?

I’m beginning to understand that I must not use the “upload” command, but some “program” command instead. There doesn’t seem to be a “program” command available, so maybe I’m still getting something wrong.

You’re after the “Upload using Programmer” command. The plain “Upload” command is more for boards with built in interfaces for programming.

image

Thanks Peter, I have used the “upload using programmer” task/command, but still getting the request to specify my board.

After adding “board = uno”, I still get an error. This is really new to me and I don’t have much insight about what is actually going on

Can someone explain to me what this is all about:

“To upload firmware using programmer you need to use program target instead of upload for platformio run --target command. For example, platformio run -t program”

I just don’t get what the “–target” and “run -t program” rever to.

--target and -t are the same thing. The latter is just shorthand. When you are running platformio from the comandline, you need to tell if if you are just running a build, or running it and sending it to a target… i.e. upload or program are just two possible targets. But you’re using the VSCode extension, so that isn’t really relevant for you… as it works out all that for you.

So you’ve added the board = uno … that’s good… without that platformio had no idea what board your code was intended for. Next is determining what upload_protocol is correct, as I don’t think stk500v2 is correct for the Atmel AVRISP mkII? What about avrisp2 or avrispmkII ? If that doesn’t work, you may need to change one of the drivers, because the ‘native’ atmel driver may be stopping avrdude from talking to your programmer. I have a very similar problem with my Atmel ICE programmer.
https://www.avrfreaks.net/comment/895299#comment-895299

The “stk500v2” part was also strange to me, but I copied it from this link provided by Ivan

http://docs.platformio.org/en/latest/platforms/atmelavr.html#upload-using-programmer