Can the Arduino ISP board be used with PlatformIO?

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

Here is the driver details of my MK2, the Jungo-driver-problem doesn’t seem to be here?

Is there anybody on this forum that is using an AVRISP MK2 with PIO?

I’m not sure where the Jungo reference actually comes from - in the case with my Atmel ICE, it was one of the two Atmel drivers that was being installed that was the problem - as they were only meant to talk to Atmel Studio. I used zadig to replace it with the libusb driver, and I had not problems using avrdude to upload to MCUs on Windows since. And if I wanted to use Atmel Studio again, I would have just to reinstall the Atmel driver again, which was easy enough since it was included in the program install folder.

Try using avrdudess (as it’s a nice GUI for avrdude) and see if you programmer will talk to avrdude at all (you’ll be able to pick programmer options from the dropdown)… see if you can get it to detect the processor type on it’s own by hitting the ‘detect’ button (obviously with the target board plugged in!).

This solved all of my issues. Thanks a ton

1 Like

Hey,
I don’t know how to use my arduino mega2560 as a programmer. I want to programm a atmel 644 via isp with my arduino.
Actually I did the following steps

  1. Open arduino ide and flash the arduino with the example programm arduino isp
  2. Open VSCode and platformio and select my atmel 644 for the project.
  3. Connecting arduino and 644 via isp.
  4. Now I want to upload a simple blinky programm. Led is connected to pin 5.
    But I don’t get any response. The terminals response is that the get_synck() 1 of 10.
    Can I programm the ardunio as programmer via the platformio and flash the atmel644 by one platform.ini ? When yes how should my platform.ini should look like ? Or have to do it in two steps and different projects ? Thanks for help and for a detailed instructions i would be great full

Please open a new thread with your full platformio.ini. This has already 33 posts in it and was marked as solved.