4 Replies Latest reply on Jul 3, 2019 12:11 AM by YatheeshK_36

    identifying more than one CY7C65211 in Windows' USB tree (Windows Device ID)

    dacuc_1521966

      I have designed a new product that uses the CY7C65211 USB-Serial interface.  Some users will connect more than one of my products to their computer, so I need to identify the Windows Device ID of each of the CY7C65211.  The SCB0 interface provided in Cypress's example code (SDK) does not identify the associated Windows Device ID.  How can the Windows Device ID be determined using Cypress's code for the CY7C65211?

        • 1. Re: identifying more than one CY7C65211 in Windows' USB tree (Windows Device ID)
          NoriakiT_91

          You can specify the COM port number from "Device Manager" application.

          After connecting ONE USB-Serial device please find a a COM port from the "Port (COM and LPT)" you want to specify the COM port number in the "Device Manager" application window.

          GS004150.png

          In my case, USB-UART of KitProg is used for the explanation.  Sorry my PC installs a Japanese version of

          Windows 10.

          When double-click on the device, a property dialogue opens.

          GS004151.png

          Click the "Detail Configuration" button on the "Port Setting" tab.

          GS004153a.png

          In the detail settings dialogue, you can explicitly specify the COM port number from the drop down list.

          GS004154.png

          Now the device is recognized as a new COM port.

           

          Regards,

          Noriaki

          • 2. Re: identifying more than one CY7C65211 in Windows' USB tree (Windows Device ID)
            YatheeshK_36

            Hello Damon,

             

            You can use windows APIs to get device instance path. Alternatively, u can set up a serial number to each part using the USB serial Configuration Utility and accessing the part by comparing the serial number.

             

            Best Regards,

            Yatheesh

            • 3. Re: identifying more than one CY7C65211 in Windows' USB tree (Windows Device ID)
              dacuc_1521966

              Thanks for the additional reply.  However, my question is still unanswered as needed.  Let me explain further.

               

              The product I produce has a CY7C65211 USB-Serial chip interfacing with the customer's computer (USB connection).  Some customers will need to use multiples of my product.  In other words, some customers will need to connect 2, or 3, or 4 (probably not more) of my USB products to one computer.  As a result, the host computer will sense that 2, or 3, or 4 Cypress USB-Serial devices are connected simultaneously.  Our software needs to identify the exact devices connected ... by their Windows Device Instance ID.  As shown in the most recent reply from Yatheesh above, Cypress's software obviously knows that info;  it is the "Windows device instanced ID" at the bottom of the screenshot of the Cypress USB-Serial config utility's MFG interface.  I want to get exactly that info programmatically, by calling Cypress's code to retrieve the "Windows device instance ID" for each of the 1, or 2, or 3, or 4 (or more?) devices that are simultaneously in use (simultaneously connected to the host computer as a result of multiple instances of my product being connected via USB to the host computer).  Our software already retrieves the Windows Device ID for all connected USB devices, but we are looking for the "matching link" information that will tell us explicitly that "Windows device Instance ID" __XYZ___ matches to __EACH__  SCB0 block (#1, or #2, or #3, or #4, etc). that is found by calling Cypress's API functions.  Forgive me for being too wordy, but let me restate this one more way:  A current example is that our code finds multiple USB-Serial devices connected to the computer.  Our code then calls Windows API functions and determines the Windows Device ID for those multiple interfaces.  Now, we need to get the same info from Cypress's code so we can then associate ... with certainty ... which Cypress SCB0 block (Cypress software handle) is the one that matches each of the multiple devices that we found by calling Windows functions.  By matching the Device ID returned by calling Windows functions with the Device ID returned by calling Cypress's code, we can then know with certainty which of the multiple Cypress "handles" will be used to control which of the multiple products connected to the host computer.

              • 4. Re: identifying more than one CY7C65211 in Windows' USB tree (Windows Device ID)
                YatheeshK_36

                Hello Damon,

                 

                Please use the below function which takes in the cypress device number as argument, just like the CyGetDeviceInfo API and gets the device instance path of the device using windows API.

                 

                 

                 

                CHAR devicePath[256];

                GUID DrvGuid;

                SP_DEVINFO_DATA devInfoData;

                SP_DEVICE_INTERFACE_DATA  devInterfaceData;

                PSP_INTERFACE_DEVICE_DETAIL_DATA functionClassDeviceData;

                SP_INTERFACE_DEVICE_DETAIL_DATA tmpInterfaceDeviceDetailData;

                ULONG requiredLength = 0;

                CHAR        DevPath[256] = "";

                HANDLE hdevice;

                 

                //function

                void GetDeivePath(UCHAR devicenum)

                {

                GUID CYUSBDRV_GUID = { 0xae18aa60, 0x7f6a, 0x11d4, 0x97, 0xdd, 0x0, 0x1, 0x2, 0x29, 0xb9, 0x59 };

                DrvGuid = CYUSBDRV_GUID;

                SP_DEVINFO_DATA devInfoData;

                SP_DEVICE_INTERFACE_DATA  devInterfaceData;

                PSP_INTERFACE_DEVICE_DETAIL_DATA functionClassDeviceData;

                SP_INTERFACE_DEVICE_DETAIL_DATA tmpInterfaceDeviceDetailData;

                 

                 

                ULONG requiredLength = 0;

                int deviceNumber = devicenum;

                 

                 

                HANDLE hFile;

                 

                 

                HDEVINFO hwDeviceInfo = SetupDiGetClassDevs((LPGUID)& DrvGuid,

                NULL,

                NULL,

                DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);

                 

                 

                if (hwDeviceInfo != INVALID_HANDLE_VALUE) {

                devInterfaceData.cbSize = sizeof(devInterfaceData);

                 

                 

                if (SetupDiEnumDeviceInterfaces(hwDeviceInfo, 0, (LPGUID)& DrvGuid,

                deviceNumber, &devInterfaceData)) {

                //Allocate a function class device data structure to receive the goods about this

                // particular device.

                SetupDiGetInterfaceDeviceDetail(hwDeviceInfo, &devInterfaceData, NULL, 0,

                &requiredLength, NULL);

                 

                 

                ULONG predictedLength = requiredLength;

                 

                 

                functionClassDeviceData = (PSP_INTERFACE_DEVICE_DETAIL_DATA)malloc(predictedLength);

                functionClassDeviceData->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);

                devInfoData.cbSize = sizeof(devInfoData);

                //Retrieve the information from Plug and Play */

                if (SetupDiGetInterfaceDeviceDetail(hwDeviceInfo,

                &devInterfaceData,

                functionClassDeviceData,

                predictedLength,

                &requiredLength,

                &devInfoData)) {

                 

                 

                /* NOTE : x64 packing issue ,requiredLength return 5byte size of the (SP_INTERFACE_DEVICE_DETAIL_DATA) and functionClassDeviceData needed sizeof functionClassDeviceData 8byte */

                int pathLen = requiredLength - (sizeof(tmpInterfaceDeviceDetailData.cbSize) + sizeof(tmpInterfaceDeviceDetailData.DevicePath));

                //int pathLen = requiredLength - functionClassDeviceData->cbSize;

                 

                 

                memcpy(DevPath, functionClassDeviceData->DevicePath, pathLen);

                DevPath[pathLen] = 0;

                printf("%s\n", DevPath);

                }

                }

                }

                SetupDiDestroyDeviceInfoList(hwDeviceInfo);

                }

                 

                 

                Best Regards,

                Yatheesh