GHI Electronics NETMF SDK 2015 R1 Pre-Release 2

@ John - Are you saying the USB Device code as in the code share project works for you? - Just the Device Manager reports a USB Device is present, I’ll worry about the host side stuff later.

@ John - I just tried the G400-D (v1.2) in the same G400HDR and USB Client DP hardware setup. The device manager message changed to Unknown Device, but when back to the other G400-D module and device manager now reports Unknown Device.
Same configuration.error on the COM1 output in both cases, plus I deploy over USB so that seems to work as expected.

@ John - I just output the usbcontroller.status and it is zero - but not sure what port state that would be.

@ PHITEK - We have not tried the codeshare. Did you follow the steps in the linked blog post? Looking over it briefly, it seems you need to create an INF for Windows: https://guruce.com/blogpost/communicating-with-your-microframework-application-over-usb

@ John - No I did not try that but that is the host side code and as I mentioned I want to move away from signing an INF file by using WMI to finding a USB Vendor and USB Product Id, specifically the sample code that can do this, this keeps all the code in User Mode and no device drivers to install.

How to install WinUSB without a INF file:
http://blogs.msdn.com/b/usbcoreblog/archive/2012/09/26/how-to-install-winusb-sys-without-a-custom-inf.aspx

Here is some sample code that I have tested and works very well, painless.
http://janaxelson.com/winusb.htm
See the Explore USB with WinUSB link

But since the USB Device does not get discovered by Device Manager, and Host side code is not going to help in my opinion.

I could provide my exact code (the USB.cs file) but it is just populated with COM1 output statements at various points of interest in program flow.
The other change is the USB Vendor and Product ID to match what GHI NETMF Interface reports for Hardware Ids.
The other project USBClient can be deleted this will simply what is to be built to one project in the solution.

For completeness these are the code changes to the original code share USB Device project:
Program.cs
public static SerialPort Port1 = new SerialPort(“COM1”); // X7 Connector


Port1.BaudRate = 38400;
Port1.Parity = Parity.None;
Port1.StopBits = StopBits.One;
Port1.DataBits = 8;
Port1.Handshake = Handshake.None;
Port1.ReadTimeout = 2;
Port1.Open();

USB.cs
private const int USB_Vendor_ID = 0x1B9F;
private const int USB_Product_ID = 0x0102;
private const int USB_Revision = 0x200;

// Create the device descriptor
Configuration.DeviceDescriptor device = new Configuration.DeviceDescriptor(USB_Vendor_ID, USB_Product_ID, USB_Revision);


public static void Init()
{
// serial port debuging support
System.Text.Encoding _enc = System.Text.Encoding.UTF8;
byte[] msg = new byte[1024];


catch (Exception)
{
msg = _enc.GetBytes("G400-D USB stream could not be created - configuration.error is " + usbController.ConfigurationError.ToString() + “\r\n”);
USBDevice.Program.Port1.Write(msg, 0, msg.Length);
msg = _enc.GetBytes("G400-D USB stream could not be created - controller state is " + usbController.Status + “\r\n”);
USBDevice.Program.Port1.Write(msg, 0, msg.Length);
Debug.Print("USB stream could not be created, error " + usbController.ConfigurationError.ToString());
return;
}

Hence I would expect some USB device to show up in Device Manger on connecting the G400-D to the Windows system, nothing more at this point.

Sorry to be such a pain but this is a window of opportunity again here to use C# for my whole instrument. Thanks for the help so far.

@ John - You where quite right in challenging the code share project.

The call to ConfigureUSBController(usbController) should be pass by reference not value.

Unfortunately this now just throws and exception on usbStream.ReadTimeout or changing the order the usbStream.WriteTimeout.

I will continue some more debugging to see what else I can find. I will post something to the code share discussion thread to sum up what I have found todate.

@ Chakotay - When you’re viewing a forum such as https://www.ghielectronics.com/community/forum/board?id=1, you can click Start New Topic in the upper left.

@ PHITEK - If you still cannot get it to work after you debug the issue, create a new thread and post a small as possible example that shows the issue. We’ll run that code and see if we can find anything.

@ John - Sounds good, if further help is needed I will provide a drop in replacement USB.cs file for the code share project which has the USB Client project deleted from the solution.

Just to re-state my issue - Why does Windows Device Manager report a failure to get device descriptors - hence no Windows application code is involved yet.

Also was looking at the GHI RawDevice and RawStream in the GHI.USB.Client assembly, this looks very similar to the SPOT.Hardware.USB assembly. Do you have a preference for which assembly I target?

Thanks for your support on this matter.

@ PHITEK - Any number of things could cause a failure to get device descriptors, bad cable, damaged hardware, or bugs in the firmware. GHI.Usb.Client uses the Microsoft.SPOT.Usb functionality internally. It just provides a wrapper essentially to make it a bit easier to work with.