我有两个 Ubuntu,一个是 18.04,另一个是 20.04,我也遇到了一些 Arduino 开发板的问题,我试过这说明(引脚连接和...):
但是,Arduino IDE 无法检测到带有 Arduino 的 STM32f013c8t6 板,因此我尝试使用这发布其答案的命令,如下所示:
sudo usermod -a -G dialout $USER
ls -al /dev/USB*
ls: cannot access '/dev/USB*': No such file or directory
并尝试一些其他人发布的说明:
lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0bda:0821 Realtek Semiconductor Corp.
Bus 001 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 001 Device 003: ID 174f:2408 Syntek
Bus 001 Device 006: ID 0483:3748 STMicroelectronics ST-LINK/V2
Bus 001 Device 002: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
通过执行该lsb -v -d
命令我得到以下结果:
lsusb -v -d 0483:3748
Bus 001 Device 006: ID 0483:3748 STMicroelectronics ST-LINK/V2
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x3748 ST-LINK/V2
bcdDevice 1.00
iManufacturer 1 STMicroelectronics
iProduct 2 STM32 STLink
iSerial 3 &/26MCKN
bNumConfigsudo journalctl -furations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 4 ST Link
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0000
(Bus Powered)
因此看不到已通过 snap 安装的 Arduino 上的端口连接,如下所示:
另外,尝试以 root 用户身份运行 Arduino,但出现以下错误:
sudo arduino
mkdir: cannot create directory '/run/user/0': Permission denied
(process:22688): dconf-CRITICAL **: 19:29:51.179: unable to create directory '/run/user/0/snap.arduino/dconf': Permission denied. dconf will not work properly.
(process:22688): dconf-CRITICAL **: 19:29:51.179: unable to create directory '/run/user/0/snap.arduino/dconf': Permission denied. dconf will not work properly.
No protocol specified
(process:22688): dconf-CRITICAL **: 19:29:51.180: unable to create directorit is not worling!.y '/run/user/0/snap.arduino/dconf': Permission denied. dconf will not work properly.
Picked up JAVA_TOOL_OPTIONS:
Set log4j store directory /root/snap/arduino/56/.arduino15
No protocol specified
java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/sun.awt.X11.XToolkit.<clinit>(XToolkit.java:231)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
at java.desktop/java.awt.SystemColor.updateSystemColors(SystemColor.java:473)
at java.desktop/java.awt.SystemColor.<clinit>(SystemColor.java:465)
at processing.app.Theme.init(Theme.java:343)
at processing.app.Base.<init>(Base.java:250)
at processing.app.Base.main(Base.java:150)
所以我猜这是行不通的,因为通过 snap 安装了 Arduino 并且通过命令修复了它sudo snap connect arduino:removable-media
,但我 mkdir: cannot create directory '/run/user/0': Permission denied
再次收到错误,所以我在这里问:
更新1:
基于第一条评论我尝试了sudo journalctl -f
并得到了以下结果:
sudo journalctl -f
-- Logs begin at Thu 2020-11-19 13:24:37 +0330. --
ژوئن 13 20:24:57 so-Lenovo-ideapad-310-15IKB tunnel.service[4851]: add bridge failed: Operation not permitted
ژوئن 13 20:24:57 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:24:58 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:24:59 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:00 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:01 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:02 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:03 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:03 so-Lenovo-ideapad-310-15IKB sudo[30096]: so : TTY=pts/0 ; PWD=/home/so ; USER=root ; COMMAND=/bin/journalctl -f
ژوئن 13 20:25:03 so-Lenovo-ideapad-310-15IKB sudo[30096]: pam_unix(sudo:session): session opened for user root by (uid=0)
ژوئن 13 20:25:04 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:05 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:06 so-Lenovo-ideapad-310-15IKB nautilus-deskto[17909]: connect() failed
ژوئن 13 20:25:07 so-Lenovo-ideapad-310-15IKB tunnel.service[4851]: add bridge failed: Operation not permitted
我也安装了最新的 Arduino 版本此链接并且正在通过sudo arduino
命令运行但仍然有这个问题!。
更新2:
很奇怪我见过以下帖子也就是说ST-link V2 编程器可能伪造的并且有一些错误的引脚连接如果可能的话我想问一下,如果我改变2,4,6基于该帖子的引脚配置?如下所示:
更新 3:
我已经检查过ST-Link V2并且引脚标记正确。所以问题不是出在错误st-link引脚系统!谢谢。
答案1
基于诺伯特评论,问题存在于 Arduino 的 snap 版本中,据说这里:
因此我完成了以下步骤:
1- 我已经安装了最新的 Arduino 版本此链接。
2-基于这个文件,我已经安装了STM32CubePrg
3-选择以下设置和代码进行测试:
#define LED_BUILTIN PC13
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
4- 在将 FTDI 板连接到计算机之前,将 BOOT 0 接头从“0”位置切换到“1”位置,以便刷新引导加载程序,如上所述这个视频摘自这篇文章: