Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Device count is returned as 0 with device connected

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



Device count is returned as 0 with device connected
Moderator:
RSKV

Post Reply
Follow this topic



Device count is returned as 0 with device connected

notytony posted on 20 Jul 2011 6:14 PM PST
Member
5 Forum Posts

Hi,

I am using CyAPI.lib for my c++ application.I have connected a device which is linked to a renamed version of CyUSB.sys file.The api call to get device count returns 0. But i am able to detect the same device with a c# application having linked to CyUSB.dll.

 

Please provide your inputs on this scenario.

 

Thanks!




Re: Device count is returned as 0 with device connected

aasi posted on 21 Jul 2011 05:37 AM PST
Cypress Employee
1090 Forum Posts

Are you changing the DriverGUID using the inf file, If so are you passing this parameter when you open the handle??

Please attach your inf file here, I would like to take a look at it.

Regards,

Anand



Re: Device count is returned as 0 with device connected

notytony posted on 21 Jul 2011 09:04 AM PST
Member
5 Forum Posts

Please find the inf file i am using attached in this post



Re: Device count is returned as 0 with device connected

notytony posted on 21 Jul 2011 09:08 AM PST
Member
5 Forum Posts


Re: Device count is returned as 0 with device connected

notytony posted on 21 Jul 2011 10:22 AM PST
Member
5 Forum Posts

Yeah when i changed the guiid it worked.Also, where can i find the documentation for performing i2c communication using this cypress chip?



Re: Device count is returned as 0 with device connected

aasi posted on 21 Jul 2011 10:59 AM PST
Cypress Employee
1090 Forum Posts

http://www.cypress.com/?rID=34485

One of these vendor commands demonstrates using vendor command, communication to EEPROM through I2C. You should find this helpful.

Regards,

Anand



Re: Device count is returned as 0 with device connected

alan88 posted on 20 Jun 2012 12:52 PM PST
Member
6 Forum Posts

I have a VC 2010 program that experiences the same problem.  However, it is extremely intermittent.  I suspect a threading issue with the DeviceCount method.  I have several threads and they call DeviceCount under certain conditions.  I'm going to put a critical section around the method and see if that solves the problem. 

Are there any known threading issues with the CyApi library?

 



Re: Device count is returned as 0 with device connected

alan88 posted on 22 Jun 2012 11:48 AM PST
Member
6 Forum Posts

I put a critical section around the DeviceCount and so far have not seen a count of zero returned by the method.  There may be a threading problem with DeviceCount.  I will continue testing for a few more days to verify the fix works, then a few days more without the fix to verify the failure re-occurs.

Does the library use any Windows synchronization methods?  I know that the Windows Global Mutex is unreliable on a multicore processor.  We previously used a Global Mutex to synchronize multiprocess read/write to  NI GPIB devices.  On a multicore processor, the mutex was granted to the wrong process roughly once every 4 hours when under a heavy i/o load.   We have had to implement our own version of a Global Mutex using InterlockedCompareExchange on shared memory.

 



Re: Device count is returned as 0 with device connected

alan88 posted on 26 Jun 2012 09:54 AM PST
Member
6 Forum Posts

The DeviceCount method failed when the critical section around the method was removed.  Looks like it is not thread safe. 



Re: Device count is returned as 0 with device connected

aasi posted on 28 Jun 2012 11:44 PM PST
Cypress Employee
1090 Forum Posts

Hi Alan,

Thanks for posting the details here. Please create a tech support case (MyAccount -> MyCases). We would prefer one of our engineers analyzing the exact root cause of the issue and fix it in the library so that we ensure it is thread safe and help everyone.

Thanks,

Anand






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: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20