I am migrating from Windows to Ubuntu.
I can use a USBasp with modified firmware to upload successfully on Windows platform - here’s my platformio.ini for this:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:attiny85]
platform = atmelavr
board = attiny85
framework = arduino
; uploader tool selection - use one block but comment out the other
; device is USBASP V2.0 with updated firmware
upload_protocol = custom
upload_port = usb
upload_flags =
-C
; use "tool-avrdude-megaavr" for the atmelmegaavr platform
${platformio.packages_dir}/tool-avrdude/avrdude.conf
-p
$BOARD_MCU
-P
$UPLOAD_PORT
-c
usbasp
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i
As a side note, I have successfully used an Arduino as ISP on the Ubuntu platform - I initially had issues with identifying the com port and then permissions.
When I look for connected devices with pio device list
the USBasp is not listed but it does appear with a sudo dmesg
from an Ubuntu terminal.
From reading articles, specifically about udev rules udev rules I think I need to modify the 99-platformio-udev.rules — PlatformIO v6.1 documentation doc to include an entry for the USBasp (idVendor = 16c0 idPProduct = 05dc) but I am really new to Ubuntu (as in it’s my first day) and I don’t know how to do this.
I found this article that seemed very relevant but the solution still evades me.
https://andreasrohner.at/posts/Electronics/How-to-fix-device-permissions-for-the-USBasp-programmer/
Could anyone spare the time to lead me through the process - I am OK at DOS but am a newbie about basic file manipulation in Unix. Thanks.
pio device list
will look for USB serial devices mostly. The USBasp is no such device. You can see that $UPLOAD_PORT / upload_port
is set to the symbolic value “usb”. So it’s okay that it’s not showing up there.
Regarding the USBasp udev rules, they already have
# USBasp V2.0
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", MODE:="0666", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"
so if the custom USBasp firmware did not change the USB VID (vendor ID) or PID (product ID), then you don’t have to do any changes and can install the regular udev rules, as linked in the documentation. lsusb
will list all USB devices with the VID:PID. Also, dmesg
will print it.
Thanks Max - you are a star and put loads into this forum.
I fixed my issue by downloading the 99-platformio-udev.rules, editing it to add an entry for my USBasp board and saved this to the specified location - as per https://docs.platformio.org/en/stable/core/installation/udev-rules.html
I guess my problem is newness to UNIX - I had to bash through creating the target directory before copying the file. I am also dyslexic so trying to type accurate paths and file names is a challenge - it’s why I originally moved away from Arduino IDE 1.8.19 in the first place. I just can’t see typos.
I’m only going through this process as support for Win10 ends soon and my much loved and upgrades tower is, I am told, no good for Win11.
My next challenge will be UPDI programming - I got nailed on the ‘scope’ of the python install back when and I anticipate this will be a problem again. ‘On vera’ as they say.
Thanks again for speedy response.
Tempus fugit… I got my UPDI script working first time trouble free by making sure to explicitly get the PIO instance of Python by first using pip system info
from PIO terminal and including the full path to python during the pip install of pymcuprog, in my case:
/home/peter/.platformio/penv/bin/python -m pip install pymcuprog
Thanks Max
I checked the contents of the 99-platformio-udev-rules I down loaded and sure enough it already had an entry for USBasp.
I think the edit I made was needless. I guess it was the actual downloading the file and placing it in the environment that was key, as it sure wasn’t working before this.
(I got my UPDI programmers flying too.)
1 Like