Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > CyUSB.NET with custom GUID

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



CyUSB.NET with custom GUID
Moderator:
RSKV

Post Reply
Follow this topic



CyUSB.NET with custom GUID

IainC posted on 11 Dec 2011 7:27 AM PST
Member
2 Forum Posts

I'm very new to CyUSB so please bear with me if this is a silly mistake.

I am currently using a Saxo-Q from KNJN and it uses a FX2 for programming and communicating with the FPGA.

My question is setting up CyUSB with a custom driver GUID in VC#. I suppose my question is a follow on to this one:

https://secure.cypress.com/?app=forum&id=167&rID=51640

in C# I have not been able to get the code supplied in Introduction to CuUSB.dll Based Application using C# (https://secure.cypress.com/?rID=12974). I've read the I have looked at the source code for CyControlCentre and see the following lines:

 

//Set the customer class GUID(vendor specific) and Driver Guid(vendor specific) 
//CyConst.SetCustomerGUID("{CDBF8987-75F1-468e-8217-97197F88F773}", "{C955D74D-0430-44f2-B120-276D94492D2D}");
CyConst.SetClassGuid("{CDBF8987-75F1-468e-8217-97197F88F773}");

Looking at the .inf for CyUSB.sys that comes with SuiteUSB 3.4.7.000, I can see that the relevant GUIDs are:

ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
CYUSB.GUID="{AE18AA60-7F6A-11d4-97DD-00010229B959}"

Comparing this with .inf that came with the FPGA:
 

ClassGUID={36FC9E60-C465-11CF-8056-444553540000}
HKR,,DriverGUID,,"{0EFA2C93-0C7B-454F-9403-D638F6C37E65}"

My reasoning is then that in order to use the sample code, I need to add the line:

CyConst.SetCustomerGUID("{36FC9E60-C465-11CF-8056-444553540000}", "{0EFA2C93-0C7B-454F-9403-D638F6C37E65}"); 

However, my program still seems to be detect the FPGA. I know that the driver for the FPGA works, as I can program it over USB using the program supplied with the FPGA. If I set the FPGA to use the default driver that comes with SuiteUSB then my program works fine, however I then cannot program the FPGA using the program supplied by the board manufacturer (presumably as it is looking for a device attached to the driver with a different GUID). There does not seem to be any documentation for CyConst.SetCustomerGUID. I only found it through the CyControlCentre example. Seems like a pretty important function to not be documented!

Any help would be really appreciated!

Cheers,

Iain


Here is my C# code:

 

using CyUSB;
//FPGA CLASS GUID       {36FC9E60-C465-11CF-8056-444553540000}
//FPGA DRIVER GUID      {0EFA2C93-0C7B-454F-9403-D638F6C37E65}
//CYPRESS CLASS GUID    {36FC9E60-C465-11CF-8056-444553540000}
//CYPRESS DRIVER GUID   {AE18AA60-7F6A-11d4-97DD-00010229B959}

namespace testCs
{
    public partial class Form1 : Form
    {
        USBDeviceList usbDevices;
        CyUSBDevice myDevice;

        public Form1()
        {
            InitializeComponent();
            CyConst.SetCustomerGUID("{36FC9E60-C465-11CF-8056-444553540000}", "{0EFA2C93-0C7B-454F-9403-D638F6C37E65}");
            usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB | CyConst.DEVICES_HID | CyConst.DEVICES_MSC);
            usbDevices.DeviceAttached += new EventHandler(usbDevices_DeviceAttached);
            usbDevices.DeviceRemoved += new EventHandler(usbDevices_DeviceRemoved);
            // Get the first device having VendorID == 0x04B4 and ProductID == 0x8613
            myDevice = usbDevices[0x04B4, 0x8613] as CyUSBDevice;
        }

        void usbDevices_DeviceAttached(object sender, EventArgs e)
        {
            //Add code to handle Device arrival 
            Text = "Device Attached";
        }

        void usbDevices_DeviceRemoved(object sender, EventArgs e)
        {
            //Add code to handle Device removal
            Text = "Device Removed";
        }
    }
}

 

 


I can change the GUID using the C++ lib, using an example supplied with the Saxo-Q, but I would be much more comfortable using C#. Some sample (working) C++ code for a windows form application for changing the GUID is below:

 

CCyUSBDevice *USBDevice;
GUID *GUID_KNJN_FX2;

 

Form1(void)
{
InitializeComponent();
static GUID test={0x0EFA2C93, 0x0C7B, 0x454F, 0x94, 0x03, 0xD6, 0x38, 0xF6, 0xC3, 0x7E, 0x65};
GUID_KNJN_FX2=&test;
USBDevice =new CCyUSBDevice((HANDLE)this->Handle,*GUID_KNJN_FX2,true);
for(int i=0; i<100; i++) // blink the LEDs for a few seconds
{
LONG len = 1;
USBDevice->EndPoints[3]->XferData((PUCHAR)&i, len); // send one byte (the value of i) to FIFO2
Sleep(50);
}
}

 

 




Re: CyUSB.NET with custom GUID

IainC posted on 11 Dec 2011 07:30 AM PST
Member
2 Forum Posts

 Sorry for the horrible formatting. Not what it looked like in the edit window and there was no preview option that I could see and now I can't even delete or edit it.



Re: CyUSB.NET with custom GUID

PRJI posted on 13 Dec 2011 06:27 AM PST
Cypress Employee
333 Forum Posts

 

Hi

                  I need to clarify my understanding before responding to your post. From your post what I understood is you are developing an host application using CyAPIs but using a custom GUID, Am I correct???






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20