Writing a PC app to talk to a Wixel app over USB

David,

This thread is very interesting to me, and I’ll briefly explain why. skip to the next paragraph if this is boring. You likely know from my many posts over the past 2 years, that I’ve been working on a product which eventually will require me to either implement my own CC2511F32 based module, or work out a special deal with Polulu. Along those lines, you’ll recall that with your help, i learned to programmatically store configuration data in some reserved upper flash memory of the CPU. This led to my being able to offer many programmable options to a user, via buttons that already existed on the product. But you know how that goes… with the power to store so many options, it eventually gets to the point where it would be nice to expose the USB port to an end user, and furnish them a PC based program for configuration. That way, a user could use a nice GUI for the ever growing setup.

So the question is, is it possible to write a PC app to talk to the running application (not the bootloader) in a wixel through its USB port, without the user needing to load in a proprietary Pololu based driver? Again, I understand the boot loader is proprietary, but I’m just talking about communication with a running app, as is done now, as if i were talking to a serial port from the PC based app. If this is possible, how can I learn the steps? I guess what I’m looking to he here is create a plug-n-play interface to implement a USB simulated serial port as you have done. Or maybe this already happens and I needn’t do anything? If I can do this, then when I finally migrate from the wixel to my own CC2511F32 based board or module, my GUI based user configuration app will have already been done and tested. Perhaps code already exists in the library to offer me all the tools I’d need?

Hello, PeterPan.

It sounds like you want to make a PC application to talk to the USB interface of the Wixel app you are writing without needing to use any Pololu drivers.

I moved your post to its own thread, since the original thread you posted on is a discussion about writing drivers to talk to the Wixel’s USB port from an embedded host (PIC32). Since you are talking about using a PC instead of an embedded host, you will have sophisticated drivers available that take care of the low-level USB details I was talking about in that other thread.

Why do you want to avoid using Pololu drivers? If you have a Wixel app that makes a virtual COM port using the usb_cdc_acm library, the only two drivers files you would need are pololu.cat and wixel_serial.inf. Those files are only needed for Windows users; Linux and Mac OS X users can just use drivers that come with their operating system.

If you want to avoid Pololu drivers, one approach would be to continue using the virtual COM port interface but to modify your app to use a different USB vendor ID and product ID. You would need to pay for your own vendor ID from the USB Implementers Forum or perhaps apply for a product ID from OpenMoko. By the way, I haven’t investigated the second option to see how legitimate it is, and they only do it for open source products. To support Windows users you would also need to write an INF file similar to wixel_serial.inf but with your own vendor ID and product ID. To support users of Windows 8, you will need to purchase a code signing certificate and sign the driver, or at least tell the users how to modify their operating system to disable driver signature enforcement.

You might consider moving away from the virtual COM port interface and just using a native USB interface consisting of custom control transfers to do everything. (That’s what the Wixel bootloader does.) One benefit is that you won’t need to write or sign your own driver for Windows if you do what is described in the article How to install WinUSB.sys without a custom INF?. I think the user experience will be better because they won’t have to worry about selecting the right COM port or any of the other troubles that are associated with COM ports. However, this will probably make it harder for you to write your PC software and you would have to redo all of your app’s existing USB code.

–David

WOW! As usual, I’ve been so buried in making my product as useful as possible (major product creep since I started!), that I hadn’t even considered any of these logistics. Its actually surprising because there are all these formalities. But what you say certainly makes good sense, if it avoids having to jump through so many hoops, and more expenses I don’t need! The serial port number issue I thought i had solved about a year back, when I discovered how to substitute my own structures at run time, so that all wixels always looked like the same product ID and serial port. But I certainly don’t want to buy all these registrations if I don’t have to!

Also, the only reason i wanted to get away from pololu drivers is because sooner or later, if a test market phase goes well, I’ll eventually have to come up with my own version of the wixel module. (that is, unless Pololu would be open to a business discussion to furnish them, but that will be a private future discussion. ). But if I do eventually “roll my own” module, I figured Pololu would not appreciate my furnishing my own customers any of your drivers. Otherwise I wouldn’t care where the drivers came from.

Still, based on what you’ve said, I suppose a native USB methodology would be best. I never attempted it before, and I’m not even sure if I’ve ever seen it in the SDKs that came with my MS Visual Studio. maybe there is an API for doing this in there somewhere. But if its possible, I’d sure appreciate any pointers to get started. I’m sure plenty examples for the PC side are out there, and if there are some native USB examples in the Wixel libraries, I’ll be in business!

I do think the native USB way is nicer if you can overcome the coding challenges.

For Windows, I recommend using the WinUSB driver. The most straightforward way to access it would be to write a C or C++ program that uses functions from SetupAPI and WinUSB to connect to your device. All of these components are part of Windows.

There are third-party projects out there that might allow you to use the libusb API to talk to the device. The libusb API is much easier than SetupAPI/WinUSB and will let you more easily port your program to other operating systems. The three options to consider would be libusb, libusbK and libusb-win32, but I would probably rule out the last one because it is old.

If you do try to make it work without an INF file, beware that we have not used this technique for any Pololu products so we can’t say how well it works. It was first introduced in Windows 8, and earlier versions of Windows will need to get some particular Windows update in order to use it. Also, you won’t be able to get the name of your product to show up in the Device Manager on those earlier versions of Windows.

For the firmware side, you will need to remove the usb_cdc_acm library from your app and read the documentation of the “usb” library.

–David

Hi PeterPen,

It’s very simple to make own driver for Wixel (or any other controller with USB option). All of you need is download Visual Studio,DDK and Samples.
I wrote that driver and GUI application in one week (first time))). I hav modified usb and usb_cdc_acm libraries, so I has only two Bulk Endpoints (IN and OUT). You can modify VID and PID for any values, but they always must be same on the Wixel and in the Driver’s .inf.
For example, take a look on my first Driver, Exe and .wxl http://www.voland.su/files/Wixel%20Driver%20and%20Exe%20sample.rar.
You can using this driver for writing you own applications.

Thanks Voland. It sounds very promising and helpful. I tried to run the program but I just got the “invalid win32 app” warning. If you don’t mind, could you send me a private message somehow with an email address, in case I’m hopelessly confused? The last version of Visual Studio I installed is 2008, on a 32 bit win-XP (sr3) machine, so I hope its up to the task. If there’s no way to send me a private message, go to elfintechnologies.com, and click the contact form in the menu. Maybe you can share the source code and I can compile a 32 bit version to test.

You can see why I had hoped for a simple way to do this with the USB simulated serial port path Pololu took. There’s no mystery about serial port programming on both WINDOWS and on the Pollux side. I’d be very tempted to just use some pins on the wixel to implement my own serial port. But how many PCs have serial ports anymore.

:wink:

Hi PeterPen,

I’m sorry, I wasn’t warning you, but I compilled my app for Win7 x64 platform.
So, you can compile app by Visual Studio for any other versions of Win.

Good luck!