我正在尝试使用 platformio 在运行 ubuntu 的笔记本电脑上用 libopencm3 对 stm32 设备进行编程。代码可以编译,但当我尝试运行它时,它不起作用,而是显示“无法初始化”
我正在尝试使用 platformio 在运行 ubuntu 的笔记本电脑上用 libopencm3 对 stm32 设备进行编程。代码可以编译,但当我尝试运行它时,它不起作用,而是显示“无法初始化设备”和“*** [上传] 错误 1”。
并不是说它看不到设备,因为如果我尝试在未插入任何设备的情况下上传它,它会给出不同的错误。我怀疑可能是因为我的 99-platformio-udev.rules。我尝试按照 platformio 网站 操作。为此,我确实在 /etc/udev/rules.d/99-platformio-udev.rules 中有一个名为 99-platformio-udev.rules 的文件,它与网站上最新的文件相匹配,并且确实执行了 sudo service udev restart,但我认为我可能做错了下一步。它说
Ubuntu/Debian 用户如果不是“root”,则可能需要将自己的“用户名”添加到“dialout”组,这样做会发出
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
但我不确定这是什么意思,所以我尝试按原样运行命令,但我认为这是错误的。我该怎么办?下面我将介绍设备与笔记本电脑的连接、我如何输入命令以及完整的输出/错误。如果需要任何其他信息,请询问
连接
我的 usermod 命令
这是platformio.ini platformio.ini
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.