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

USB superspeed peripherals Forum Discussions

rossi
Level 3
Level 3
25 sign-ins First solution authored 10 replies posted

Hi

I'm developing UVC 2.0 host firmware which receives mjpeg video stream from the webcam. The video is 640x480 30fps in mjpeg format.

When I analyze the stream received from the webcam, I found that SOI(Start of Image, 0xff 0xd8) and EOI(End of Image, 0xff 0xd9) does not match exactly.  When a SOI is found then there should be a matching EOI to complete a picture. But in my case it was not.  (See below)

b.png

As a result, when I played the stream received in the host firmware, video generated by VLC player resulted in broken images like below. (Camera is showing the ceiling of my office, btw)

vlc.png

I think this could be resulted from the bandwidth issue but I don't know what to tune at this moment. I tried to change DMA buffer size etc but ends up same results so far.

The host firmware handles mjpeg stream in manual mode (by dedicated receiving thread). I'm curious whether this is fast enough to handle the video(640x480 30fps mjpeg) or not.

Any comments will be highly appreciated.

 

Regards,

Rossi

0 Likes
1 Solution
rossi
Level 3
Level 3
25 sign-ins First solution authored 10 replies posted

Hi AliAsgar

Thank for your advice.

By the way, I solved the issue in another way. The dedicated thread was not very responsive so, I changed it in callback method which turned out to be lot more faster.

 

Regards,

Rossi

View solution in original post

0 Likes
5 Replies
AliAsgar
Moderator
Moderator
Moderator
250 solutions authored 750 replies posted 50 likes received

Hi Rossi,

Could you let us know which device (FX3 or CX3) is used for your application and the webcam?

640*480 @ 30 fps is well within the bandwidth. Hence there should be no bandwidth issues.

Could you share the modifications done to the default firmware for your application?

Also share the UART debug prints and wireshark traces when the issue is seen.

Best Regards,
AliAsgar

0 Likes
rossi
Level 3
Level 3
25 sign-ins First solution authored 10 replies posted

Hello AliAsgar

I'm using FX3. As your comment, yes, there should be no bandwidth issue. For your information, I attached the firmware(host.zip) and uart log(host full dump2.zip) which dumps all data received from the webcam to make sure the stream is valid or not. (As you can read in my previous report, non matching SOI, EOI issue can be find in the dump file) Dump is done in the following code. 

 

 

void
UvcRecvThread(uint32_t Value)
{
    CyU3PDebugPrint(4,"UvcRecvThread starts\r\n");
    for (;;)
    {
        ...
        if(status==CY_U3P_SUCCESS){
            //FULL DUMP received stream
            CyU3PDebugPrint (4, "[%d] ",prodXferCount);
            for(uint32_t i=0;i<prodXferCount;i++) CyU3PDebugPrint(4,"%x ",buffer[i]);
            CyU3PDebugPrint(4,"\n");
            ...
        }
    }
}

 

 

After the dump, I did soi,eoi comparisons in the attached pictures(soi_search.png, eoi_search.png).

Regards,

Rossi

0 Likes
rossi
Level 3
Level 3
25 sign-ins First solution authored 10 replies posted

Hi AliAsgar

Please find usb traffic capture file(host_with_issue.zip) bewtween webcam and host firmware.

Regards,

Rossi

0 Likes
AliAsgar
Moderator
Moderator
Moderator
250 solutions authored 750 replies posted 50 likes received

Hi Rossi,

Could you remove the :

"status = CyU3PUsbHostEpWaitForCompletion (glHostUvcEp, &epStatus, 10);"
and the debugPrints code at the end of the for loop in the UvcRecvThread and check if the issue is seen?
 
Best Regards,
AliAsgar
0 Likes
rossi
Level 3
Level 3
25 sign-ins First solution authored 10 replies posted

Hi AliAsgar

Thank for your advice.

By the way, I solved the issue in another way. The dedicated thread was not very responsive so, I changed it in callback method which turned out to be lot more faster.

 

Regards,

Rossi

0 Likes