I am trying to use platformio to program an stm32 device with libopencm3 on a laptop running ubuntu. The code compiles but when I try to run it it doesn’t work an instead says it “Failed to init device” and “*** [upload] Error 1”.
It isn’t that it can’t see the device because if I try to upload it without anything plugged in it gives a different error. I suspect it might be because my 99-platformio-udev.rules. I tried to follow the instructions on the platformio site. To that end I do have a file named 99-platformio-udev.rules at /etc/udev/rules.d/99-platformio-udev.rules that does match the most updated one on the website and did do sudo service udev restart, however I think I might be doing the next step wrong. It says
”
Ubuntu/Debian users may need to add own “username” to the “dialout” group if they are not “root”, doing this issuing
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
“
but I’m not sure what it means by that, so I tried to run the commands as is but I’m assuming that is wrong. What should I do? Below I will put the devices connection to the laptop, how I inputed the command, and the full output/error. If there is any other information needed please ask
the connection
my usermod command
Processing genericSTM32F446RE (platform: ststm32; board: genericSTM32F446RE; framework: libopencm3)
Verbose mode can be enabled via -v, --verbose
option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/genericSTM32F446RE.html
PLATFORM: ST STM32 (17.3.0) > STM32F446RE (128k RAM. 512k Flash)
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES:
- framework-libopencm3 @ 1.10000.200730 (1.0.0)
- tool-dfuutil @ 1.11.0
- tool-dfuutil-arduino @ 1.11.0
- tool-openocd @ 3.1200.0 (12.0)
- tool-stm32duino @ 1.0.1
- toolchain-gccarmnoneeabi @ 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> https://bi
{need to seperate the next part to post because its a shortened url but its one line}
t.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Checking size .pio/build/genericSTM32F446RE/firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [ ] 0.0% (used 12 bytes from 131072 bytes)
Flash: [ ] 0.3% (used 1692 bytes from 524288 bytes)
Configuring upload protocol…
AVAILABLE: blackmagic, dfu, jlink, serial, stlink
CURRENT: upload_protocol = serial
Looking for upload port…
Auto-detected: /dev/ttyACM0
Uploading .pio/build/genericSTM32F446RE/firmware.bin
Failed to init device.
stm32flash Arduino_STM32_0.9
http://github.com/rogerclarkmelbourne/arduino_stm32
Using Parser : Raw BINARY
Interface serial_posix: 115200 8E1
*** [upload] Error 1
================================================================ [FAILED] Took 1.86 seconds ================================================================
- The terminal process “platformio ‘run’, ‘–target’, ‘upload'” terminated with exit code: 1.
- Terminal will be reused by tasks, press any key to close it.