开发者

Serial Mac OS X constantly freezes/locks/dissappears for USB to Arduino

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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜