USB 转 Arduino 的串行 Mac OS X 不断冻结/锁定/消失
我的 C++ 代码在使用 AMSerial 库和通用库的 Xcode 中运行时遇到问题C(ioctl、termios)。
重新启动后,我的应用程序运行良好,但在我“杀死”程序后,串行(我认为)未释放。
我已经检查了 /dev
下打开的文件,并从那里终止了与串行 USB 的连接,但我的 C++ 仍然无法打开 USB 端口。
我已将其范围缩小到一个低级别的 Mac OS X 问题,即无限期地阻止端口,无论是否使用上述库关闭它。
仅供参考,我试图通过 USB 端口将数字串行发送到 Arduino Duemilanove 9600 波特率。在 Arduino 中运行串行监视器完全没问题,但是,通过 C++ 应用程序运行它会冻结我的计算机,有时,我的鼠标/键盘会冻结:需要硬重置。
如何解决这个问题?看来 Mac OS X 不支持 USB!
I have a problem with my C++ code running in Xcode with both the AMSerial library as well as the generic C (ioctl, termios).
After a fresh restart, my application works well but after I "kill" the program the Serial (I think) is not released.
I have checked my open files under /dev
and have killed the connection to serial USB from there, but my C++ still can't open the USB port.
I have narrowed this down to being a low level Mac OS X issue, regarding blocking the port indefinitely, regardless of closing it using the aforementioned libraries.
Just for context, I'm trying to send numbers through my USB port, serially to an Arduino Duemilanove at 9600 baud. Running Serial Monitor in Arduino is perfectly fine, however, running through a C++ application it freezes up my computer, occasionally, my mouse/keyboard freeze up: requiring a hard reset.
How can this problem be fixed? It seems like Mac OS X is not USB friendly!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,不久前回答了我自己的问题!
连接到 Arduino 后,我必须添加 sleep(2) 以确保串口实际连接。
Sorry, answered my own question a while back!
After I connect to the Arduino, I have to include a sleep(2) to ensure the serial is actually connected.