- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
------------------------------------CODE-------------------------------------------------
device = new CCyUSBDevice();
int endpointcount = device->EndPointCount();
cendp = device->ControlEndPt;
LoadHexFile(L"USB20.hex");
endpointcount = device->EndPointCount();
device->Close();
if(device->Open(0)==false)
{
MessageBox(0,L"firsterror",L"error",MB_OK);
device->Reset();
if(device->Open(0)==false)
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;
-------------------------------------ENDCODE-------------------------------------------
The first time i run this code the errors:
"first open error"
"second open error"
"invalid endpoint"
comes.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.