Maestro virtual serial port baud rate issue


I have an issue with setting maximum baud rate for Maestro using C++ program under Ubuntu.
I am setting baud rate using termios structure and it works correctly, but only up to 9600.
I can set baud to 1200 and 2400 no problem but trying 19200 or higher seems to have no effect - it works as though 9600 was set - cfsetispeed and cfsetospeed functions dont return -1 which means they work correctly.

As far as I understood the specifications Maestro should allow higher rates without braking a sweat and as it turned out my project requires at least 4 times higher rate than 9600.

Please help:)

Hello, Michau.

The Maestro has two virtual COM ports. Which one are you using? What serial mode have you configured the Maestro to use?

How can you tell that setting the baud rate to 1200 and 2400 worked? How can you tell that setting the baud rate to 19200 was the same as setting it to 9600?


Thank you for such a quick response.

I am running a simple loop that reads three analog inputs 100 times and measure the time it takes.
When i set baud rate to 9600 it takes about 1.2 seconds to complete the loop.
After setting baud to 1200 it takes about 4.6 seconds to complete.
When I try to set it to 19200 or higher it still takes 1.2 seconds.

I am using ttyACM0 in USB chained mode because when using dual port I cannot change the rate at all.

Setting the baud rate of a virtual USB COM port does not actually affect the speed your USB connection is capable of. In USB Chained Mode, it only affects how fast the bytes will be sent out on the TX line (and received on the RX line). If you choose a low baud rate, then the Maestro will have to spend time waiting for the bytes to finish being transmitted on the TX line before it can accept new bytes from the USB virtual COM port, so the transfer rate on the TX line (a.k.a. baud rate) will be a limiting factor in how fast you can send commands to the Maestro. As you increase the baud rate, at some point the baud rate will be high enough that the transfer rate on the TX line is not the limiting factor any more, and you are instead limited by your OS, USB drivers, and the way you wrote your code for doing I/O.

Your 1.2 s result is not too surprising. It sounds like you are probably sending 300 commands to the Maestro and waiting for a response after each command is sent. That’s 300 write operations and 300 read operations. In a multi-tasking operating system, unless you do something special to make your I/O more efficient, it’s reasonable for a read or write request on a USB endpoint to take a 2 milliseconds, so that would 600*2 = 1200 milliseconds, which is what you are seeing.

I don’t understand the motivation here. What are you trying to accomplish by changing the baud rate? Do you actually have a device connected to the Maestro’s TX or RX line? If not, I recommend just using USB Dual Port mode, which will allow you to communicate with the Maestro as fast as possible because the TX and RX lines won’t be involved.


Thank you very much for clearing the situation for me.
I assumed the delay on USB was far less than 2ms but it seems that you are right.

Have u got any suggestions on how to improve the performance?
Is there a serial command in Maestro to acquire data from multiple inputs or do I have to do it one by one? (similar to set multiple targets)

I’ll try to have some fun with Real Time Linux - maybe this will help.

Thanks for help again!

There is no serial command for getting data from multiple inputs, but I think you will get higher performance if you send multiple commands all at once. For example, make a byte array that has the following 6 bytes {0x90 0 0x90 1 0x90 2} and send that entire array to the serial port at once. The packet size on the Maestro’s virtual COM ports is 8 bytes, so all three commands should end up in the same packet when you do this. You should also try to read all three responses at once.