I have been working on implementing a USC type driver for the maestro on the raspberry Pi 3 windows 10 IOT for a couple of weeks now and have the following portions working and will post the code and instructions in a couple of days code as of this morning uk time is on github i update it every morning and i’ll put the instructions to winusb knstalled and working there tomorrow https://github.com/paulbearne/MaestroDriver
the code Can set speed , acceleration Target and get and set all the Usc settings it also manages multiple devices being connected as well as a device being plugged in or removed but i am getting a data crc error when i try to implement any of the getVariable functions the problem seems to occur when more than 2 bytes are requested function to get the code below. is there any way to retrieve the variables by indexing each variable like the way settings are retrieved as i suspect it is a windows issue when getting a larger packet so i can implement a save frame in the driver.
Also in the datasheet it mentioned that the opcodes for the bytecode were available on request wo do i contact get them
private async Task<IBuffer> getStatusVariable(UscRequest param,byte data)
UInt16 packetlength = data.Length;
var buffer = new Windows.Storage.Streams.Buffer(packetlength);
UsbSetupPacket setupPacket = new UsbSetupPacket
RequestType = new UsbControllRequestType
Direction = UsbTransferDirection.In,
Recipient = UsbControlRecipient.Device,
ControlTransferType = UsbControlTransferType.Vendor,
Request = (byte)param,
Length = packetlength
IBuffer retBuffer = await maestroDevice.device.SendControlInTransferAsync(setupPacket,buffer);
I am sorry you are having trouble developing code for the Maestro on Windows 10 IoT Core. You might be interested in the Maestro Windows IoT Driver that was recently posted on the forum, which uses one of the Maestro’s virtual serial ports.
If you want help troubleshooting your code, could you tell what you mean by “data crc error”? If you are seeing an error message, please post a screenshot of it. In the code you posted, I can’t tell what
Length you are using in the setup packet. Therefore, it would help if you could come up with the simplest possible code that should work, but does not work, and then post all of it, along with a clear description of how you ran the code and why you think the code does not work. Also, since the Get Variable requests are different between the Micro Maestro and the Mini Maestros, I would need to know what type of Maestro you are using.
The Maestro does not have any Get Variables requests that return a smaller, more specific amount of data like you suggested.
The Maestro bytecode consists of opcodes and data bytes. The opcodes start at 0, which is QUIT, and then they are numbered sequentially from there. I have attached Opcode.cs, which is part of the source code of Bytecode.dll and defines the values of the all the opcodes. For some of the opcodes, you will need to insert additional little-endian data bytes into the bytecode after the opcode.
Opcode.cs (3.3 KB)
Thanks for the response David as i’ll capture the Exception Later. i’m sure its to do with the way Microsoft have implemented the control transfers. as i said most of it is working. i’ll dig a bit deeper worst case scenario i end up in the WDK thanks for the opcodes David
Quick update David the crc error seems to be a fallback error that the system puts out when its not sure what to do. The actual error was due to me running out of fingers to count with. i was asking for to many bytes for the buffer. i’ll tidy the code up over the weekend and post it up for anyone interested
I have got most of the Usb Control transfer communications working attached is the code consisting of files from the Usb Sdk the new usb wrapper / driver interface file Maestrousb.cs and its wrapped up in UI demo app which shows how to use the driver lets you change settings and move a servo etc. I am still working on scripts and a bytecode compiler interface most of which works as in the original SDK but windows uwp does not support registry entries which was used to save frames and sequences so i’ve started to write this to the application localstorage. there is an instructions folder which contain winusb driver onto the raspberry pi 3 without this you can only uses the serial ports to communicate , loading the pages in the UI app is a little slow and maybe someone with better knowledge of c# can suggest a way to speed it up i’m more used to embedded c++ with no UI. The project is on Github GitHub - paulbearne/MaestroDriver: Windows 10 IOT Pololu Maestro Native USB Driver. and will be updated when i have the frame working. Hopefully some of your users find it useful.
MaestroDriver.zip (139.0 KB)
Forgot to mention that this also works on a Pc just recompile for the x86 or x64
Thank you for sharing your code. I have added your project to the “Related Resources” section in the Maestro user’s guide.
Thanks @paulbearne for this code.
There sure is allot of it but it is great that you can install the driver on the Pi 3 and just use it as UAP.
Thanks again - This is very valuable work. Sharing is caring.