Avrdude vs arduino-cli upload

arduino-cli upload mostly works but I've noticed it has issues with usbasp programmers when running on a raspberry pi 4b. It works on one usbasp board but not another. When I use:

arduino-cli upload --fqbn arduino:avr:pro:cpu=8MHzatmega328 --programmer usbasp Blink

I get:

avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
Failed programming: uploading error: exit status 1

The above values come from:

/home/pi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf

It worked from the arduino ide so I used that from the commandline:

avrdude -C/home/pi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/home/pi/dev/arduino/pro_mini_3v3/Blink/build/arduino.avr.pro/Blink.ino.hex:i

even though I'd selected USBasp as the Programmer in the ide it told avrdude to use "arduino" and the upload worked. It's not possible to replicate this with arduino-cli upload as it can't pass parameters to avrdude.

arduino-cli upload uses the same avrdude version and config file as the ide but with parameters that don't work:

/home/pi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/pi/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -V -patmega328p -cusbasp -Pusb "-Uflash:w:/tmp/arduino/sketches/1FA7F8DDA582FB74825745E708392493/Blink.ino.hex:i"

but it won't recognise the programmer as I when I use:

--programmer arduino

it just says:

Programmer 'arduino' not found

It seems arduino-cli upload is blocking access to avrdude if it doesn't recognise the programmer, which exists in the avrdude config file:

programmer
id = "arduino";
desc = "Arduino";
type = "arduino";
connection_type = serial;

Is it better to use avrdude directly as arduino-cli doesn't seem to be in step with avrdude configurations, as well as not being able to refine the avrdude environment.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.