2 Replies Latest reply on Sep 10, 2010 9:16 AM by userc_39005
      • 1. Re: Cy7C6013:CyAPI:how to get endpoints after loading .hex file

        Hi everyone.


        I'm using CyUSB driver and CyAPI library with Visual Studio 2005.


        I'm using the example from C:\Program Files\Cypress\Cypress Suite USB 3.4.2\CyAPI\examples\FxEEPROM to load my hex file to eeprom. It is loaded( i see new VID/PID,endpoints in USBview program).The problem is that i can't get updated endpoints info from API lib.device->EndPointCount(); get's the same as before loading the .hex file.


        I decided to Close device and Open it again.The code is as follows:




         device = new CCyUSBDevice();
            int endpointcount = device->EndPointCount();
            cendp = device->ControlEndPt;
            endpointcount = device->EndPointCount();
                MessageBox(0,L"second open error",L"error",MB_OK);
            cendp = device->ControlEndPt;
            if(cendp ==0)
                MessageBox(0,L"invalid endpoint",L"error",MB_OK);
            endpointcount = device->EndPointCount();
            delete device;




        The first time i run this code the errors:


        "first open error"


        "second open error"


        "invalid endpoint"




        The second time (the device is not disconnected) there is only "first open error" error.


        What is wrong with this code?Is there anyway to get endpoints after loading hex without close/open commands?


        Thanks in advance.

        • 2. Re: Cy7C6013:CyAPI:how to get endpoints after loading .hex file

          I also noticed that when i run the code in debug and step over after close/open i see new values of endpoints when put breakpoint on the last :endpointcount = device->EndPointCount(); sometimes i get 1 sometimes 0.