我怎样才能“重置” Arduino 板?
我已经将 sketch 上传到 Arduino Uno,其循环如下:
void loop(){
Serial.println("Hello, World!");
}
所以,现在,我无法再上传任何内容,因为 IDE 说“端口已在使用中”。
有没有一种方法可以在没有其他程序员的情况下“重置”Arduino?
没有其他东西使用串行端口,一切都很顺利,直到我上传之前的草图。
我发现了一些有趣的事情:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(21)
尝试以下操作:
引导加载程序启动程序之前有一个延迟,只需按您的时间安排即可。当我的 Arduino 代码中的错误每 500 毫秒执行一次软重置时,它对我有用。
Try the following:
There is a delay before the boot loader starts the programs, just work on your timing. It worked for me when a bug in my Arduino's code was executing a soft reset every 500 ms.
我在两个 Arduino(一个 Uno 和一个 Modern Device Freeduino/USB 主机板)上遇到了同样的问题,并且重置和开始使用串行端口之间的窗口非常小,以至于无法上传。
我最终通过购买另一个 Arduino Uno 并按照这些说明构建 ISP 电缆解决了这个问题,并使用使用 Arduino IDE 版本 0023,按照 这些,将示例中的 Bare Bones 应用程序闪存到每个无法访问的板中更改preferences.txt的说明。 (请务必在编辑之前保存原始文件,以便在拯救 Arduino 后可以替换它。)
需要快速上传才能修复每个板。在经历了如此多的悲伤之后,如此快速的修复。您可能不想购买另一个 Arduino,但请考虑以下好处:
I had the same problem on two Arduinos (one Uno, and one Modern Device Freeduino/USB Host board) and the window between reset and the beginning of serial port usage was so small that it was impossible to upload.
I finally fixed the problem by purchasing another Arduino Uno and building an ISP cable per these instructions, and using it to flash the Bare Bones app from the examples into each inaccessible board, using Arduino IDE version 0023, following these instructions to change preferences.txt. (Be sure to save the original file before editing it so you can replace it after you've rescued your Arduino.)
It took one quick upload to fix each board. Such a fast fix after so much grief. You might not want to purchase another Arduino, but consider these benefits:
Arduino Leonardo 板:
Arduino Leonardo board:
确保将 Arduino 直接插入计算机,而不是通过集线器。使用集线器会出现此错误。
Make sure you plug the Arduino directly into the computer and not through a hub. Using a hub will give you this error.
在我对这个问题摸不着头脑之后,这里有一个非常简单的解决方案,可以随时使用:
瞧!
After scratching my head about this problem, here is a very simple solution that works anytime:
Et voila!
如果您仍然打开串行控制台,它将保留串行端口。关闭它,然后重试。
If you still have the serial console open, it will reserve the serial port. Close it, and try again.
这是我在 Linux 中所做的,以便能够对我的 Arduino Micro 进行编程,当通过 USB 连接时,它陷入了发送 0 键的循环中;
您的输出可能略有不同,因此只需尝试运行;
然后插入 Arduino 并查看输出的格式。
这阻止了 X 接受按键并最终允许 Arduino IDE 进行编程!
Here's what I did in Linux to be able to program my Arduino Micro which was stuck in a loop sending the 0 key when connected by USB;
Your output might be slightly different so just try running;
then plug in the Arduino and see how the output is formatted.
This stopped X from accepting the keypresses and allowed the Arduino IDE to program finally!
根据我对已在使用或被阻止的通信的经验,我会说您正在连接的程序仍然具有开放的通信。
我还发现,如果您断开 USB 电缆,通信将会中断。这不是最好的解决方案,但它解决了问题。
Based on my experience with the communication already in use or blocked, I would say that the program you are interfacing with still has the communication open.
I also found that if you disconnect the USB cable it will rest the communication. It is not the greatest solution, but it solves the problem.
对于Arduino Yún用户,请尝试通过上传以太网/Wi-Fi(菜单工具→端口)。
我遇到了完全相同的问题,并且我尝试了几乎所有方法(除了刻录新的引导加载程序)。我很惊讶它有效,但我上传了一个空草图,没有任何问题。
For Arduino Yún users, try uploading via Ethernet/Wi-Fi (menu Tools → Port).
I had exactly the same problem, and I tried pretty much everything (apart from burning a new bootloader). I am surprised it worked, but I've uploaded an empty sketch without any problem.
我刚刚花了最后五个小时寻找这个问题的解决方案(串行端口 COM3 已经在使用中并且串行端口变灰)...我尝试了我能找到的所有论坛和问答网站的建议,包括这个..是
什么最终修复了它(摆脱了我输入的最后一个被卡住的代码并上传了简单的闪烁功能)?
请点击此链接 - http://arduino.cc/en/guide/windows 并关注安装驱动程序的说明。我的驱动程序“已经是最新的”,但按照这些步骤修复了故障。我现在再次成为一名快乐的露营者。
注意:使用芯片上的按钮手动重置电路板,或通过互联网上的各种代码以数字方式重置电路板并不能解决此问题,因为信号在我的 Arduino Uno 和我笔记本电脑中的端口。更新驱动程序就像重置“串行端口已在使用”问题一样。
至少到目前为止...
I just spent the last five hours searching for a solution to this problem (serial port COM3 already in use and grayed out serial port)...I tried everything every forum and Q&A site I could find suggested, including this one...
What finally fixed it (got rid of the last code I'd input that got stuck and uploaded simple blink function)?
Follow this link -- http://arduino.cc/en/guide/windows and follow the instructions for installing the drivers. My driver was "already up to date", but following these steps fixed the glitch. I am now a happy camper once again.
Note: Resetting the board manually with the button on the chip, or digitally through miscellaneous codes on the Internet did not work to fix this problem, because the signal was somehow blocked/confused between my Arduino Uno and the port in my laptop. Updating the drivers is like a reset for the "serial port already in use" problem.
At least so far...
我也有这个问题。我尝试了上述方法,但似乎都不起作用,但是确实起作用的东西(不知何故,不确定这只是一个奇怪的事情还是实际上是一种方法)是:
I had this issue as well. I tried the above methods and none seemed to work, however something that did work (somehow, not sure if it was just a freak thing or it is actually a way to do it) was:
我今天也遇到了同样的问题。我们找到了一个简单的解决方案来解决这个问题(感谢 Anghiara):
不要使用屏幕上的“上传按钮”(带有绿色箭头的圆圈)将新代码加载到 Arduino,而是使用鼠标单击“草图”,然后“上传”。
使用 Serial.println() 和循环。我通过惨痛的教训吸取了教训。
I had the very same problem today. Here is a simple solution we found to solve this issue (thanks to Anghiara):
Instead of loading your new code to the Arduino using the "upload button" (the circle with the green arrow) in your screen, use your mouse to click "Sketch" and then "Upload".
Please remember to add a delay() line to your code when working with Serial.println() and loops. I learned my lesson the hard way.
如果端口显示已使用,那么您可能使用了错误的端口。
将其切换到您连接 Arduino 的端口,然后尝试重新上传,您一定会看到它工作。
If the port says Already used, then you are probably using the wrong port.
Switch it to the port where you connected your Arduino and then try to re-upload, you will definitely see it work.
确保您没有从终端访问串行端口。该循环(或任何代码)不应阻止 Arduino 的编程。
Be sure you are not accessing the serial port from a terminal. That loop (or any code) should not prevent the Arduino from being programmed.
我遇到了类似的问题。
如果我打开 Arduino 电源,上传的程序执行之前会出现延迟。
所以我利用这个延迟来上传新程序或空程序:
所以我的问题解决了。
上传之前请拔下与 Arduino 引脚的所有连接。
I got a similar problem.
If I power on my Arduino, there is a delay before the uploaded program execute.
So I use that delay for uploading new program, or empty program:
So my problem was solved.
Unplug any connection to Arduino pins before upload.
如果没有任何帮助,那么您应该再安排一块板,并尝试通过 Arduino as ISP 选项将其刷新,如 Arduino 作为 ISP 和 Arduino Bootloader 或 从 Arduino 到面包板上的微控制器。
您可以选择自己的程序通过 ISP 进行闪存,而不是引导加载程序。
If nothing helped then you should arrange one more board and try to flash it through the Arduino as ISP option as shown in Arduino as ISP and Arduino Bootloaders or From Arduino to a Microcontroller on a Breadboard.
Instead of a boot loader, you can select your own programs to flash via ISP.
对于 arduino nano 33 iot 对我有用的唯一方法是连续多次按下板上的重置按钮,然后按 uoplad!
The only way it worked for me for arduino nano 33 iot is via pressing the reset button on the board continuously many time then press uoplad!
如果您尝试通过 USB 电缆进行编程,以下是最佳方法:
您已准备就绪!
Here is the best way that works out if you are trying to program through the USB cable:
You are all set!
我也遇到了你的问题,我使用以下步骤解决了这个问题(尽管你可能已经解决了这个问题,它只是分享给访问此页面的任何人):
I also had your problem,and I solved the problem using the following steps (though you may already finish the problem, it just shares for anyone who visit this page):
它肯定会释放你的端口。
It will free your port for sure.