Maestro 6 Channel not working from RPI 3 and Win 10 IoT Core

Hello,

My ongoing RPI based project needs some help. Since 2015 my robot has been running on RPI2 and Maestro Servo Controller via Windows 10 IoT Core based program written in C#. I have recently upgraded to RPI 3, Visual Studio 2019 and the latest IoT Core build. As a result the servo control has stopped working. Last week I purchased a brand new Maestro - identical to my original - but that didn’t help. Here is what I have:

Visual Studio 2019, version 16.6.4
Windows 10 SDK (10.0.19041.0)
.NET Core 2.2 Runtime
Target - Windows 10, version 1809

Raspberry Pi 3 Model B
Windows 10 IoT Core, build #17763 - the latest official build installed via Windows 10 IoT Core Dashboard

Maestro 6 Channel Micro controller
Maestro Firmware version 1.04
6 Volt Rechargeable NiMH Battery

What works:

  1. Servo is running fine from the Maestro Control Center, serial mode: dual port or fixed baud rate
  2. My UWP app sample code below is driving servo as expected when running from the desktop with Maestro plugged into its USB
  3. On the RPI 3, another USB serial device - RoboClaw motor controller - is still working flawlessly

What doesn’t work:

  1. When deployed to RPI on ARM platform the below code is running fine but fails to rotate the servo.
  2. The green light blinks as if a command has been received but nothing happens, no rotation.

I am testing by setting a breakpoint at the maestroSetTarget, and on desktop the servo rotates while on RPI it does not. No exceptions are being thrown. The controller behaves as if it doesn’t recognize the command.

From the app manifest:

  <Capabilities>
    <Capability Name="internetClient" />
    <DeviceCapability Name="serialcommunication">
      <Device Id="any">
        <Function Type="name:serialPort" />
      </Device>
    </DeviceCapability>
    <DeviceCapability Name="lowLevel"/>
  </Capabilities>

Am I missing a setting somewhere?
Is there a known issue with the 17763 build that might affect some serial devices?
Pololu - have you tested the Maestro 6 with RPI running 17763?

Any help would be highly appreciated
Thanks
Victor

   public sealed partial class MainPage : Page
    {
        Windows.Storage.Streams.DataWriter dataWriter = null;
        SerialDevice serialDevice = null;

        public MainPage()
        {
            this.InitializeComponent();

            Task t = Task.Factory.StartNew(() => TestMaestro());
            Task.WaitAll(t);
        }

        public async Task TestMaestro()
        {
            var selector = SerialDevice.GetDeviceSelector(); 
            DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selector);

            var deviceInfo = devices.Where(p => p.Name.IndexOf("Maestro", StringComparison.OrdinalIgnoreCase) >= 0).Last();
            serialDevice = await SerialDevice.FromIdAsync(deviceInfo.Id); 
            serialDevice.BaudRate = 9600;
            serialDevice.DataBits = 8;
            serialDevice.Parity = SerialParity.None;
            serialDevice.StopBits = SerialStopBitCount.One;
            serialDevice.Handshake = SerialHandshake.None;

            dataWriter = new Windows.Storage.Streams.DataWriter(serialDevice.OutputStream);
            dataWriter.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;

            await maestroSetTarget(dataWriter, 0, 20);
            await maestroSetTarget(dataWriter, 0, 70);
        }

        public async Task maestroSetTarget(Windows.Storage.Streams.DataWriter dataWriter, byte channel, int target)
        {
            byte[] command = new byte[] { 0xAA, 0x0C, 0x04, channel, 0x70, (byte)target };
            dataWriter.WriteBytes(command);
            await dataWriter.StoreAsync();
        }
    }

Hello, Victor.

I am sorry you are having trouble getting the Maestro to work with your new Raspberry Pi. We have not tested the Maestro on Windows 10 IoT Core, but we have heard reports from other customers getting it to work.

You should make sure the serial mode of the Maestro is set to “USB Dual Port”. You mentioned trying the “UART, fixed baud rate” mode but that mode will not work with the C# code you posted. (I’m assuming that you want to control the Maestro via its USB connection and not its RX pin.)

Since you are using the Pololu protocol and specifying a device number of 12 (0x0C), you should make sure that your Maestro’s device number is actually set to 12 (which is the default). You should also make sure there is a servo plugged into channel 0, and that the servo on channel 0 works when you control the Maestro with the Maestro Control Center.

The Maestro provides two USB virtual COM ports: you should check that your program is connecting to the Maestro’s command port. You should be able to see the two ports listed in your Device Manager.

I also noticed that you are sending two “Set Target” commands back to back, with no delay between them. If the servo is already in the position indicated by the second command, you might not notice any movement. You might consider adding a delay between those commands.

Please let me know if you continue to have trouble or have further questions.

–David

Hi David,

Thank you for your suggestions, they helped me getting it to work! I forgot that there were 2 virtual com ports, and somehow on the desktop the last one (see the Last() predicate in my code) was still returning the command port while on the RPI they “switched places” so the one I needed was no longer the last one in the “Maestro” device sequence.

This issue was a side effect of the upgrade to the new IoT Core. Obviously my assumption of the Maestro command port always being the second of the two was incorrect but it worked for all these years :slight_smile:

Great product, and thanks again!
-Victor