View Full Version : [Question(s)] Async IO with RS485 on Roboard on linux

02-06-2012, 04:07 PM
Has anybody tried to do async IO with dynamixels (read in particular)?
I'm trying to optimize communications with servos on Roboard 110 running linux.
The sources I have found on net have read function within the loop which is very inefficient. In my tests it calls read ~1000 times before actually receiving anything.
Here is the code from usb2dynamixel library:
}while( gbCommStatus == COMM_RXWAITING );

All my experiments with open flags (O_ASYNC, O_SYNC, etc...) and waiting for signals have failed.
Is it even possible to do async IO on that port/board?

Thank you,

02-06-2012, 05:35 PM
The dynamixel bus is half duplex, you can't move on until the servo that is responding has done so.


02-08-2012, 07:00 AM
That's right. And I want to do something else while it's moving.
Actually, yesterday, I was able to set up async io using both SIGIO and select call but for some unknown reasons the performance of that method was 10 times worse that with read in the loop. i.e. signal arrived within 10 ms instead of 1. So, I went on with the simple solution by inserting usleep(100) in the loop which dramatically improves the CPU usage from 100% to 4%. Now I'm able to do other calculations in another thread.