Micro Maestro Servo Controller: Some precisions

Hi,

I’m currently writing a small ardunio sketch to use all the TTL Serial commands of the the Micro Maestro in my robot, and along the way, I stumbled upon a few things I would like to have some precision about.

4.b. Errors

when the UART what ?

5.c. Command Protocols

I have some trouble to get the initialization phase to work cleanly… Here is the way I proceed :
- “detect baud rate” mode : I reset the module with the RST pin, then wait a few microseconds, then I try to initialize by sending “0xAA” (I don’t want to have to start with a Pololu Protocol command). I could only make it work by sending the start byte twice, which it looks odd to me. Any thoughs ?
The following commands work perfectly.

5.e. Serial Servo Commands:
Get Moving State ():
- it seems that if you set a target outside of the servo’s range, this flag is still set when the servo stops (at his min or max, without ever reaching the target). The documentation says:

But in this case, the two conditions are not disjoint…

I also encountered a strange behavior worth mentioning :
When setting the target, then the acceleration, then the speed for a servo (with occasionally a small delay between the commands), sometimes, the speed and acceleration are taken into account for the current movement, sometimes they are not.
I guess it is normal and due to some timing issues in my commands (all the commands not arriving during the same time interval), but maybe it could deserve a note somewhere.

Thanks ^^
I will post the sketch when it is cleaned up.

Edit : removed a useless question as it was only a mistake in my code.

Hello,
I think I can answer those questions - you have made your issues very clear!

The UART overrun error only would occur if the firmware is unable to process data as quickly as you are sending it. This should never happen in practice, but if it does, a simple fix on your side would be to add some delays. We will get that fixed in the documentation soon.

A few microseconds! A processor can’t really do anything in a few microseconds. We actually have not measured how quickly the Maestro boots up, but I would estimate that it will be ready to receive your input within a few hundred microseconds. Why not give it a few milliseconds to be safe?

You are correct, and we should note it in the documentation. As long as the servo has not reached its destination, it will appear to still be “moving”. As long as you do not try to set an unreachable target, you should not have problems.

I can explain some things that might help you understand what you are seeing. When the speed is set to 0, any new target takes effect instantly. When it is set to some positive value, the position is update on a fixed schedule, every 10 ms. So, suppose you have position=4000 and speed=1000, and you send the sequence position=5000; speed=1. Sometimes, an update will occur between the commands, and position will update to 5000 before the new speed takes effect. Of course, this problem can be solved by sending the speed command first.

Thanks for the feedback and please let me know if you have more questions!

-Paul

OK. I just made some tests with various delays, and it works better with a few milliseconds ^^
However, I still have to send “0xAA” twice, whatever the delay between hard reset and the first communication.

Another “issue” I ran into:
If I set the device in “UART, fixed baud rate” mode, I can’t get a clean start. After a hard reset and a 5ms delay, the first command (in Compact or Pololu protocol) sets the Serial Signal Error (bit 0) and is ignored. Any following command works fine and does not set any error flag.
If I begin by sending a 0xAA once instead of a command, it sets only the Serial protocol error (bit 4) flag.
If I begin by sending a 0xAA twice(like for “detect baud rate”) instead of a command, it sets both the bit 0 and bit 4 flags.
I get the same behavior at 38400 and 57600 bauds. I’m using the NewSoftSerial lib.

Can you reproduce this behavior ? Is it normal ?
The quick & dirty solution could be to send 0xAA twice (like for “detect baud rate”) and just ignore the first error…

Hello,
If you are getting a serial signal error, you are probably not sending a valid serial signal. Can you make sure that you are completely initializing the library before your reset the Maestro? I am not familiar with the Arduino, but I know that some serial ports will send junk on the line when starting up. If you are worried about it, you should check what is actually going over the line when you send the first byte.

-Paul

I had a look to the signal with a logic analyser.

Finally found the problem : between the hard reset of the Maestro and the first command, I held the line down… but the signal is idle high, which implied a corrupted first byte transmitted. I should have looked this stuff up more carefully :confused:

Now the initialization works as it should in both modes.

EDIT: I opened a new discussion on the lib I’m working on here.