How to use FX3 CYAPI.lib implement receive two image sensor data at same times ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I used FX3 to receive image sensor data, use BULK mode. Without FPGA and frame buffer.

   

one app call FX3 CYAPI.lib to receive one image sensor data is ok.

   

but when I connect two same FX3 device to PC, and call another app to receive image sensor data, the two device is not work normal, and I can not get any image of two image sensor data.

   

when I open device I call USBDevice->Open(devNum);

   

devNum is use to identify FX3 device, Control transfer is ok, but BULK transfer not ok.

   

Because BULK Transfer data rate is High and real time.

   

 

   

But When I change two FX3 device to UVC Mode, open two e-CAMView program, can receive two image sensor data at same time. But in UVC mode driver is windows built-in, not cyusb3.sys.

   

 

   

So I want to know, the problem is cyusb3.sys is not support two high bandwidth realtime device?

   

or I use CYAPI.lib have same problem?

   

 

   

source code is below: 

   

inOvLap[0].hEvent = CreateEvent(NULL, false, false, L"CYUSB_IN0");

   

inOvLap[1].hEvent = CreateEvent(NULL, false, false, L"CYUSB_IN1");

   

 

   

inContext[0] = USBDevice->BulkInEndPt->BeginDataXfer(&buffer0, 24*1024*160, &inOvLap[0]);

   

inContext[1] = USBDevice->BulkInEndPt->BeginDataXfer(&buffer1, 24*1024*160, &inOvLap[1]);

   

 

   

while(1) {

   

if(USBDevice->BulkInEndPt->WaitForXfer(&inOvLap[0], 2000)) {

   

USBDevice->BulkInEndPt->FinishDataXfer(&buffer0, bufLen, &inOvLap[0], inContext[0]);

   

inContext[0] = USBDevice->BulkInEndPt->BeginDataXfer(&buffer0, 24*1024*160, &inOvLap[0]);

   

} else {

   

USBDevice->BulkInEndPt->Abort();

   

USBDevice->BulkInEndPt->FinishDataXfer(&buffer0, bufLen, &inOvLap[0], inContext[0]);

   

inContext[0] = USBDevice->BulkInEndPt->BeginDataXfer(&buffer0, 24*1024*160, &inOvLap[0]);

   

}

   

 

   

if(USBDevice->BulkInEndPt->WaitForXfer(&inOvLap[1], 2000)) {

   

USBDevice->BulkInEndPt->FinishDataXfer(&buffer1, bufLen1, &inOvLap[1], inContext[1]);

   

inContext[1] = USBDevice->BulkInEndPt->BeginDataXfer(&buffer1, 24*1024*160, &inOvLap[1]);

   

} else {

   

USBDevice->BulkInEndPt->Abort();

   

USBDevice->BulkInEndPt->FinishDataXfer(&24*1024*160, bufLen1, &inOvLap[1], inContext[1]);

   

inContext[1] = USBDevice->BulkInEndPt->BeginDataXfer(&24*1024*160, 24*1024*160, &inOvLap[1]);

   

}

   

}

   

 

   

USBDevice->BulkInEndPt->Abort();

   

USBDevice->BulkInEndPt->Reset();

0 Likes
2 Replies
Anonymous
Not applicable

 Hi,

   

In your source code, can you use two different threads one for getting data from each sensor.

   

Regards,

   

-Madhu

0 Likes
Anonymous
Not applicable

Thanks Madhu Sudhan.

   

 I build FX3 CYAPI.lib and these source code into a windows dll.  these source code is in a thread, and my program use the dll to receive data from image sensor.

   

so when I open two program and begin to receive data from image sensor. at this time it have two threads to call FX3 CYAPI.lib.

   

but I still can not receive two image sensor data at same times.

   

Is there some problem in this method?

0 Likes