Arduino Micro 串口在几秒后断开连接

Arduino Micro 串口在几秒后断开连接

我最近购买了 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 下的 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

在 Arduino IDE 上,前 7 秒内我看到串口为 /dev/ttyCOM0,7 秒后又回到 /dev/ttyS0,我无法使用。

在板上,当我按下重置按钮时,tx 和 rx 会同时闪烁,另一个 LED 会呈绿色亮起,有时会闪烁 3-4 秒,当我按下重置按钮两次时,它会闪烁大约 7 秒。当我点击板上的重置并单击上传时,绿色 LED 闪烁会关闭并进入 tx 和 rx 闪烁顺序。或者有时它保持闪烁绿色,但它给我这个错误 Arduino:1.6.12(Linux),主板:“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

关于如何解决此问题有任何提示或建议吗?谢谢

答案1

为了解决这个问题,我必须使用我的 Linux 机器,因为我运行 10.11.6 El Capitan 的 Mac OSX 无法识别 arduino micro,但在 Linux 机器上它至少会接收信号 7 秒。所以你必须“不要将微型计算机插入USB端口。用一个简单的最小草图打开arduino ide,选择leonardo板(是的,即使您使用微型计算机)。按下微型计算机上的重置按钮并按住,继续按住,并将开发板插入 USB 端口。 继续按住重置按钮,然后在 ide 窗口完成编译草图并开始上传过程后,释放重置按钮。

我的最终结果:草图已加载,端口丢失连接已修复,即使在 El Capitan 上,IDE 程序也能继续识别我的微型计算机。这是因为我上传的草图太大,arduino micro 无法处理。

相关内容