[upload] Error 74 when trying to upload to Opta Lite

Hi there,

I have a “finder OPTA LITE 8A.04.9.024.8300” and I am using PlatformIO VSCode IDE for programming on Ubuntu 20.04 LTS.

My PlatformIO project builds fine. However, when I try to upload the program to the Opta, I get the following error output:

Configuring upload protocol...
AVAILABLE: cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Using manually specified: /dev/ttyACM0
Forcing reset using 1200bps open/close on port /dev/ttyACM0
Waiting for the new upload port...
Uploading .pio/build/Sunburn_PLR/firmware.bin
dfu-util 0.11

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2021 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Cannot open DFU device 2341:0364 found on devnum 10 (LIBUSB_ERROR_ACCESS)
dfu-util: No DFU capable USB device available
*** [upload] Error 74

When I try it the second time, I get this error output:

Configuring upload protocol...
AVAILABLE: cmsis-dap, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Using manually specified: /dev/ttyACM0
*** [upload] Broken pipe

I have checked kernel messages and set the permission on the USB device /dev/ttyACM0 accordingly.

Here are the relevant outputs for my user schorsch:

$ dmesg -Hw
[Apr29 09:17] usb 2-1: new full-speed USB device number 9 using xhci_hcd
[  +0,149404] usb 2-1: New USB device found, idVendor=35d1, idProduct=0064, bcdDevice= 1.01
[  +0,000005] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000002] usb 2-1: Product: Arduino Opta
[  +0,000002] usb 2-1: Manufacturer: Arduino
[  +0,000001] usb 2-1: SerialNumber: 003B00283431510736393538
[  +0,033168] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[  +0,001726] usbcore: registered new interface driver cdc_acm
[  +0,000003] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

$ ls -l /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Apr 29 09:17 /dev/ttyACM0

$ groups
schorsch adm dialout cdrom sudo dip plugdev lpadmin lxd sambashare

My platformio.ini looks like this:

[env:Sunburn_PLR]
platform = ststm32
board = opta
framework = arduino
upload_port = /dev/ttyACM0
lib_deps = arduino-libraries/ArduinoModbus@^1.0.8

What’s wrong here and how can I upload my program to the OPTA? While I am a professional software developer, I am totally new to embedded programming and I don’t know anything about dfu, STLINK, bootloader and all the other buzzwords my Google search came up with. I would be grateful for any help.

Thanks a lot in advance.

Okay, so udev rules are missing.

Did you install PlatformIO’s udev rules exactly as per 99-platformio-udev.rules — PlatformIO latest documentation and rebooted the system thereafter?

Per Portenta H7 on linux error: dfu-util not working (sudo Hacked) - #10 by relberger2 - Portenta H7 - Arduino Forum, you can also try adding

SUBSYSTEMS=="usb", ATTRS{idVendor}=="35d1", ATTRS{idProduct}=="0064", GROUP="plugdev", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0364", GROUP="plugdev", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0364", ATTRS{idProduct}=="2341", GROUP="plugdev", MODE="0666"

to /etc/udev/rules.d/99-platformio-udev.rules then reboot again.

Ah no. I missed that part, since I just installed PlatformIO via the VSCode extension from inside VSCode. All the tutorials I watched mentioned the device permission bit (dialout group and chmod) but not the udev rules.

Thank you for pointing that out. I will try it later next week and write if that solved the problem.