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?
platform = atmelavr
framework = arduino
upload_protocol = stk500v2
; each flag in a new line
The error seems to be:
platformio.ini to use with ‘arduino’ framework”
After adding “board = uno” I get:
“Error: Please specify
upload_port for environment or use global
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.
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.
-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.
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
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.
The “stk500v2” part was also strange to me, but I copied it from this link provided by Ivan
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
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
- Open arduino ide and flash the arduino with the example programm arduino isp
- Open VSCode and platformio and select my atmel 644 for the project.
- Connecting arduino and 644 via isp.
- 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.