Serial-Port

幾秒鐘後,Arduino Micro 串口斷開連接

  • November 30, 2016

我最近購買了一個 Arduino Micro ATMega32u4。我首先在“Mac OSX El Capitan”上對其進行了測試,它執行良好,直到我決定測試某人的程式碼或直到我更新了我的 El Capitan 安全設置。我已經讀過,當您上傳一個大於它可以處理的 main() 函式時,板停止工作,直到您重置 main()。所以我決定嘗試在我的 Linux 機器上使用 arduino,但它會在大約 7 秒左右斷開連接。我在一篇舊文章上讀到,這在 Micros 中很常見,我需要點擊重置按鈕并快速上傳閃爍範例。因為那是埠工作的時候。但是一旦我點擊上傳它就會收到此錯誤消息。

Sketch uses 928 bytes (2%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
ioctl("TIOCMSET"): Broken pipe
ioctl("TIOCMSET"): Broken pipe
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3f
An error occurred while uploading the sketch

在最初的幾秒鐘內,我可以看到 arduino 下lsusbdmesg | tail連接成功,但在 7 秒後 dmesg | tail 給了我這個錯誤資訊,我在 lsusb 下看不到它,

[20720.796854] usb 3-1.3: device descriptor read/64, error -32
[20720.972844] usb 3-1.3: device descriptor read/64, error -32
[20721.148875] usb 3-1.3: new full-speed USB device number 21 using ehci-pci
[20721.220860] usb 3-1.3: device descriptor read/64, error -32
[20721.396880] usb 3-1.3: device descriptor read/64, error -32
[20721.572879] usb 3-1.3: new full-speed USB device number 22 using ehci-pci
[20721.980906] usb 3-1.3: device not accepting address 22, error -32
[20722.052911] usb 3-1.3: new full-speed USB device number 23 using ehci-pci
[20722.460927] usb 3-1.3: device not accepting address 23, error -32
[20722.461090] usb 3-1-port3: unable to enumerate USB device

在前 7 秒內的 Arduino IDE 上,我看到串列埠是 /dev/ttyCOM0,7 秒後它又回到 /dev/ttyS0,我無法使用。

在它自己的板上,插入 tx 和 rx 時同時閃爍,當我點擊重置時,另一個 LED 亮起綠色,有時閃爍 3-4 秒,當我點擊兩次重置時,它閃爍約 7 秒。當我在板上點擊重置並點擊上傳時,綠色 LED 閃爍關閉並進入 tx 和 rx 閃爍序列。或者有時它一直閃爍綠色,但它給了我這個錯誤 Arduino: 1.6.12 (Linux), Board: “Arduino/Genuino Uno”

Sketch uses 928 bytes (2%) of program storage space. Maximum is 32,256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes.
ioctl("TIOCMSET"): Broken pipe
ioctl("TIOCMSET"): Broken pipe
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x3f
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3f
An error occurred while uploading the sketch

關於如何解決此問題的任何提示或建議?謝謝

為了解決這個問題,我不得不使用我的 linux 機器,因為執行 10.11.6 El Capitan 的 Mac OSX 無法辨識 arduino micro,但在 Linux 機器上它至少會接收 7 秒的信號。因此,您必須“不要將 micro 插入 USB 埠。使用簡單的最小草圖打開 arduino ide,選擇 leonardo 板(是的,即使您使用的是 micro)。按下 micro 上的重置按鈕並按住,繼續按住,然後將您的板插入 USB 埠。繼續按住重置按鈕並選擇上傳草圖。一旦您的 ide 視窗完成編譯草圖並開始上傳過程,請釋放重置按鈕。

我的最終結果:草圖載入並且埠斷開連接得到修復,即使在 El Capitan 上,IDE 程序也繼續辨識我的 micro。這是因為我上傳了一個 arduino micro 無法處理的草圖。

引用自:https://unix.stackexchange.com/questions/323522