Jrk 21v3 setting parameters programatically


I would like to write my own Jrk 21v3 configuration utility.
I can’t find any documentation about the native API I could use.

Any help appreciated.


You can find documentation about interfacing with the jrk under the “Writing PC Software to Control the Jrk” section in the jrk user’s guide, which can be found under the Resources tab on any of the jrk product pages. For more information about the Pololu USB Software Development Kit (SDK) and how to use the library, you can read the source code, which serves as our main documentation of the jrk’s USB interface. Also, you might find it helpful to look at the source code for JrkCmd (that comes with the USB SDK), a configuration and control utility for the jrk motor controller that works with the Command Prompt.

- Amanda


The Pololu USB Software Development Kit only shows how to use C# and this makes use of a .NET DLL (UsbWrapper.dll) with no source code and which cannot be used by a native Windows application (I mean a Win32/64 application, not a .NET application).

What I need is the same examples but written using C/C++. Actually I’m using Delphi but anything in C or C++ for Win32/64 can easily be translated to Delphi.

The readme.txt file in the SDK clearly states what I’m looking for:

[quote]If you are using a language that is not part of .NET, then you will
not be able to directly run the code in this SDK, but you can use it
as a guide to figure out which USB commands you need to send to your
device. You can then use WinUSB, libusb, or IOKit to send those
commands to your device.
Clearly I’m looking for a sample based on WinUSB.

Currently, I’m using the virtual serial port and it works fine but using this port you cannot - at least there is no documentation for it - do more than just basic function. You can’t setup the Jrk.

Any help appreciated.

Unfortunately, we do not have any C or C++ example code available for controlling the jrk, so you would need to convert the existing example codes to C/C++ or write your own. You should be able to browse the code for the jrk, which can be found under the Jrk folder in the SDK, to find the exact USB commands to use to change the its configuration parameters.

I am not familiar with Delphi, but it seems that Delphi 8 is .NET compliant. You could try integrating UsbWrapper (just like any other .NET assembly) into your C++ project before converting it into Delphi. The UsbWrapper DLL is basically just a wrapper that calls functions from the winusb.dll, but it also uses SetupAPI to find USB devices. Another option is to use libusb, which works on Windows and is usually much easier to use than WinUSB.

- Amanda

Translating C# code to Delphi is not a problem: those languages are very close. But calling a .NET assembly (UsbWrappe.dll) from Delphi would make a native application dependent on the .NET Framework and this is a bad idea.

Translating UsbWrapper to Delphi would be easy provided the source code is available. As you said, UsbWrapper is calling Windows API (WinUSB and Setup) and that can be directly done from Delphi.

Unfortunately UsbWrapper source code is not available, or is it ?

BTW: Delphi 8 is a very old product which is no more supported.
Why use Delphi today ? Because you can write native application for Windows, MAC OSX, Android (Phone, tablet) and iOS (iPhone and iPad). All that with same source code.


We do not release the source code for UsbWrapper. At this point it looks like you would need to make your own version of it in C/C++. You could either implement it using WinUSB and SetupAPI, or you could implement it with libusb. If you choose to use libusb, you can look at the source code of UsbWrapper_Linux in the Pololu USB SDK to get an idea of how to do that.

Also, thanks for clarifying about Delphi 8 being out-dated and the reason you are trying to avoid using the .NET Framework. Again, I am not familiar with Delphi so I did a quick search to see if Delphi was .NET compliant.

- Amanda