theunit
Posts: 31
Joined: Fri May 11, 2012 7:52 am

Serial comms with Boost ASIO and Arduino

Tue Jun 05, 2012 7:01 pm

I am trying to get my RP communicating with my Arduino using Boost ASIO but having some problems.

When i try to run my program it does nothing for a while and then I get an error from boost:
what(): Input/output error

The same code runs fine on another computer (although other pc has Boost 1.46.1, RPi has 1.42.0)

The Arduino is connected to the RP via a USB lead and a powered USB hub. The Arduino serial connection appears as /dev/ttyACM0 and I use this to initialise the serial connection in boost.

Anyone else tried serial-Arduino communication in C++? I don't need to use Boost, but this seemed like the easiest option.

theunit
Posts: 31
Joined: Fri May 11, 2012 7:52 am

Re: Serial comms with Boost ASIO and Arduino

Tue Jun 05, 2012 7:10 pm

So just tried using LinuxTTY as described on Arduino website:

http://arduino.cc/playground/Interfacing/LinuxTTY

Using this command:
stty -F /dev/ttyACM0 cs8 38400 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

I get the same Input/output error. Is there some kind of block on the serial communication or something?

theunit
Posts: 31
Joined: Fri May 11, 2012 7:52 am

Re: Serial comms with Boost ASIO and Arduino

Tue Jun 05, 2012 7:38 pm

I just tried a few different combinations of where the USB devices were plugged in and now it works. Clearly a USB issue.

Return to “C/C++”