Arduino 連接埠未偵測到,無法以 root 身分執行

Arduino 連接埠未偵測到,無法以 root 身分執行

我有兩個 Ubuntu,一個是 18.04,另一個是 20.04,我的 Arduino 板也有一些問題,我已經嘗試過說明(引腳連接和...): 在此輸入影像描述

但是,Arduino IDE無法偵測到具有Arduino的STM32f013c8t6板,所以我嘗試使用以下命令找到連接埠的USB連接發布其答案的命令,如下所示:

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

透過 triglsb -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並且引腳標記正確。所以問題不是出自錯誤聖聯引腳系統!謝謝。

答案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」位置,如上所述這個視頻從這篇文章:

在此輸入影像描述感謝。

相關內容