.debug_str 881 0
Total 11763
<lambda>(["upload"], [".pio/build/micro/firmware.hex"])
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
BeforeUpload(["upload"], [".pio/build/micro/firmware.hex"])
Warning! Please install `99-platformio-udev.rules`.
More details: https://docs.platformio.org/page/faq.html#platformio-udev-rules
Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
====================================================
I have no upload port at my configuration.
The USB programmer avrispmkII is detect at avrdude I does not set any port?
Need to be indented with either a tab, or spaces. I use 4 spaces:
upload_flags =
-c
avrispmkII
-p
atmega32u4
-P
Normally, when using my USBtiny programmer, I follow the settings given on the above link. I din’t need to use the options above in your example, then I use the program target rather tgan upload:
Thank s for your hint.
I see some more, but I have not success.
I see a missing config file with ubuntu in the path. I using opensuse. I do not understand why avrdude use a config file. I have never used a config-file. This is stupid command line tool.
…
avrdude -c avrispmkII -p atmega32u4 -U flash:w:.pio/build/micro/firmware.hex:i
avrdude: can’t open config file “/home/jenkins/workspace/avrdude/label/Ubuntu12.04x64/objdir/etc/avrdude.conf”: No such file or directory
avrdude: error reading system wide configuration file “/home/jenkins/workspace/avrdude/label/Ubuntu12.04x64/objdir/etc/avrdude.conf”
*** [program] Error 1
I get a similar error all the time in the Arduino IDE, but it still works. I have never used a config file either. I suspect however, that my system (Linux Mint) does have a global config file for avrdude – how does it know which boards use which communications etc?
I’m confused though, you are using OpenSuse, but the error relates to Ubuntu 12.04. Interesting. A quick Google shows that Jenkins runs in a container, that’s probably where the Ubuntu comes in.
My theory is that the Jenkins environment probably needs the avrdude global config file installing. Apparently, the Arduino version of avrdude is built on a Jenkins server and that hard codes the global config file into the avrdude executable.
On your linux box, try this command:
locate avrdude.conf | grep -i avrdude.conf$
That will find your various avrdude.conf files. You probably have at least one, somewhere in /etc I would think.
Tha Arduino IDE always passes the global config file during an upload, you need to do likewise. The option is -C /path/to/avrdude.conf with an upper case ‘C’. It seems that avrdude always needs a config file passing.
If you have the Arduino IDE, you will have a suitable one. Try an upload with the verbose option in settings enabled, then copy the filename and path for use in PlatformIO.
Alternatively, remove the upload_command from platformio.ini as the Arduino framework and toolchain used by PlatformIO, will know where to find its own config file.
My aim is
That exists at the IDE a upload function in the status bar.
I want to click with the mouse the button and after the microcontroller is programmed.
How It is called “program” or “upload” this … . I need a working change to command behind the button in the IDE or I need a new button with my own command.
Now, when you click on the upload button, ->, in the VSCode editor’s PlatformIO toolbar, it should run a “pio run --target program” and upload via the USB device.
If not, open a new VSCode terminal, and type the command pio run --target program. If you have the terminal open in the directory where platformio.ini lives, it will program the board.
If that worked, then the VSCode is doing a pio run --target upload instead. I think adding:
upload_protocol = stk500v2
And an extra flag:
upload_flags =
-Pusb
to platformio.ini will force it to change target from upload to program, which is what youbwant.
I see the new option but there is an addtional option -C and overwride my declared config file.
([“program”], [“.pio/build/micro/firmware.hex”])
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
avrdude -c avrispmkII -p atmega32u4 -P -C /etc/avrdude.conf -v -p atmega32u4 -C /home/red/.platformio/packages/tool-avrdude/avrdude.conf -c avr109 -U flash:w:.pio/build/micro/firmware.hex:i
avrdude: Version 6.3, compiled on Sep 12 2016 at 15:21:49
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
I see also -c avr109 this is the wrong programmer.
This is the issue. An option -c avr109 is add always.
Upload = upload firmware to board using board’s bootloader.
Program = board’s bootloader is ignored, ICSP device used to upload firmware. On an Uno, for example, programming overwrites the bootloader so upload cannot be subsequently used until a bootloader is burned into the board, with the ICSP.
When pasting code, do it like this:
```
Your code here
```
Those are backticks by the way, not single quotes. That will format the code exactly as you copied it, including all indentations. Thanks.
Possibly, you have deleted the bootloader at some point? Using the ICSP device?
Quickest way is to load up the Arduino IDE, then tools->Burn Bootloader. Then try another upload.
You canpio run --target bootloader but you’ll need additional “stuff” in platformio.ini.
Click the “alien” bug’s head on the far left, then find the option to program in the list of allowable tasks. (I’m away from my laptop at present, so I’m saying that off the top of my head.)
Configuring upload protocol...
AVAILABLE: avr109
CURRENT: upload_protocol = avr109
Looking for upload port...
Auto-detected: /dev/ttyACM0
Forcing reset using 1200bps open/close on port /dev/ttyACM0
Waiting for the new upload port...
Error: Couldn't find a board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.
*** [upload] Explicit exit, status 1
========================================================================================= [FAILED] Took 6.18 seconds =========================================================================================
The terminal process "platformio 'run', '--target', 'upload'" terminated with exit code: 1.
Does this work on your system?
I use the udev rules from platformIO but I have everytime the reconnecting of the serial port. I have read much but I could not solve It.
I believe that the Leonardo has to disconnect the current port in order to upload? I don’t know if it needs to change the port speed or not, but I believe that there is be a timeout setting you can change so that it waits a bit longer to detect the port reconnecting. Does this link help, it’s to a workaround someone else found/created which might also work for you, perhaps?
One other thing, does your USB cable work as a data cable for other stuff? Some cables are two wire only - these are used for charging phones etc and are no good for uploading musinc to a music player, or, in this case, for uploading code to a Leonardo!