How can receive image data 5 MB from FX3 to PC with Win7 OS?

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

cross mob
Anonymous
Not applicable

I am using MT9P031 directly connected CYUSB3014. When i use Asynchronous transmission(BeginDataXfer,WaitForXfer,FinishDataXfer),When I transport image data less than 4MB,the image is good,but when i tansport image data more than 4MB,the image is appear in a few seconds later,and the image is splice. So I try to usb XferData to receive image data,is well done any size of image.but the speed is too low that not meet our needs. Who can provide some ideas.Think you.

add description:

Asynchronous transmission has a limit that tansfer size can‘t more than 4MB,also can meet this problem in streamer application,such as Total xfer length limited to 4Mbyte. If i inneed to transport 5MB image data form FX3 to PC, it has any method to make sure not loss image data. also i ever try to using XferData() to tansport the image data,but the sensor out 14 fps image and PC only can receive 7 fps,it not enough bandwidth to my application.if i still to use BeginDataXfer,WaitForXfer,FinishDataXfer,Can there be a solution? Looking forward to your reply.

0 Likes
17 Replies
Anonymous
Not applicable

I ever used double asynchronous transmission,such as

BeginDataXfer(buf1,len1),BeginDataXfer(buf2,len2),

WaitForXfer(),WaitForXfer(),

FinishDataXfer(len1),FinishDataXfer(len2).

but it still had bad image at beginning when image data more than 4MB,after a few seconds,the image data is receive well.the image is complete.

and i can sure that FX3 is transport an entire image.

0 Likes

Please refer to the streamer application source code on how to use the asynchronous APIs effectively.

0 Likes
Anonymous
Not applicable

The streamer application point that Total xfer length limited to 4Mbyte.

but I need to receive more than 4Mbyte image data at one time.

0 Likes

The limit for 4 MB is only for Win7. Which OS are you using?

Also, still you can get 4 MB in multiple transfers. Eventually, at the USB bus level, the transfers happen 1K bytes at at time.

0 Likes
Anonymous
Not applicable

Win7 64bit.

I do not understand what you mean ,still you can get 4 MB in multiple transfers. Eventually, at the USB bus level, the transfers happen 1K bytes at at time.

like

BeginDataXfer(buf1,len1),BeginDataXfer(buf2,len2),

WaitForXfer(),WaitForXfer(),

FinishDataXfer(len1),FinishDataXfer(len2).

0 Likes

Yes, what I meant is you can have 2 transfers of 2 MB each. Please refer to the streamer example on how to use asynchronous APIs.

0 Likes
Anonymous
Not applicable

pastedImage_0.png

I had used 2 transfers,the one transport 3MB,the other is transport the part data.

At begin,the receive data is wrong,than the red box is ture.

0 Likes
Anonymous
Not applicable

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

the part of code,at begin,pastedImage_3.pngalways fail,after a few transfers,is become well.

0 Likes

You do not need to have 2 separate arrays. You can have only one. Keep requesting for 3 MB data. Every alternate transfer will end up in a short packet with around 1MB data.

0 Likes
Anonymous
Not applicable

arrays mean both buffers and inovlap,contexts ?

or is only inovlap,contexts.

Can you give me a fake code,such as

BeginDataXfer(buf1,len1),BeginDataXfer(buf2,len2),

WaitForXfer(),WaitForXfer(),

FinishDataXfer(len1),FinishDataXfer(len2).

0 Likes

Both buffers and inovlap.contexts

len1 = 3MB;

for(i = 0; i < QueueSize; i++)

{

     BeginDataXfer(buf1,len1);

}

while(1)

{

     WaitForXfer();

     FinishDataXfer(buf1len1);

     BeginDataXfer(buf1,len1);

     i++;

     if(i == QueueSize)

          i=0;

}

Refer to the streamer source code for exact implementation.

0 Likes
Anonymous
Not applicable

Your thoughts do not seem to be the same to me. it mean that i want to transfer a image size of 5MB,that i should receive 3MB image data,and Immediately receive the remaining image data(2M).the image data would not wait for me to copy the data, you idea i can't figure out.

0 Likes

Each queue has a separate array. If your QueueSize is 2, you will have 2 different buffers. Check the pseudo code in my previous response. The inbuf1 is indexed with i where i varies from 0 to QueueSize-1

0 Likes
Anonymous
Not applicable

add description:

Asynchronous transmission has a limit that tansfer size can‘t more than 4MB,also can meet this problem in streamer application,such as Total xfer length limited to 4Mbyte. If i inneed to transport 5MB image data form FX3 to PC, it has any method to make sure not loss image data. also i ever try to using XferData() to tansport the image data,but the sensor out 14 fps image and PC only can receive 7 fps,it not enough bandwidth to my application.if i still to use BeginDataXfer,WaitForXfer,FinishDataXfer,Can there be a solution? Looking forward to your reply.

0 Likes

1) How many frames you want to capture and store in a file?

2) What is the problem that you are facing in streamer? if you are requesting for 4 MB data in every BeginDataXfer(), you will get every odd packets with 4 MB and even packets with 1 MB (assuming your image data size is 5 MB).

0 Likes
Anonymous
Not applicable

1)The Sensor is continuous to output image with speed 14 fps, and the PC just to receive the image data and copy to another memory and in another thread to display in monitor. not store in a file.

2) You mean that i could set QueueSize = 2, and index = 0 to receive 4MB data,index = 1 to receive 1MB data ,but when index = 1,the len in FinishDataXfer(buf1len1) still set to 4MB ?

0 Likes

When Index = 1, the len in the FinishDataXfer will return the number of bytes transferred. So, even if you request 4 MB in the BeginDataXfer for Index=1, you will get 1 MB of data back and the transfer will end. the len field in the FinishDataXfer() will return 1 MB.

0 Likes