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

USB superspeed peripherals Forum Discussions

zjjnsst
Level 3
Level 3
50 sign-ins 5 questions asked 25 sign-ins
通过代码可以看出判断一帧结束的条件是生产者生产了一个没被全填满的dmabuffer
            if (dmaBuffer.count == CY_FX_UVC_BUF_FULL_SIZE)
            {
                /* A full buffer indicates there is more data to go in this video frame. */
                CyFxUVCAddHeader (dmaBuffer.buffer - CY_FX_UVC_MAX_HEADER, CY_FX_UVC_HEADER_FRAME);
            }
            else if (dmaBuffer.count < CY_FX_UVC_BUF_FULL_SIZE)
            {
                /* A partially filled buffer indicates the end of the ongoing video frame. */
                CyFxUVCAddHeader (dmaBuffer.buffer - CY_FX_UVC_MAX_HEADER, CY_FX_UVC_HEADER_EOF);
            }
但是根据gpif状态机的框图可以看出一帧结束时是有可能正好填满一个dmabuffer的,那代码里的判断是不是有误呢
 
我感觉是我忽略了什么东西,希望能告知
 
非常感谢
0 Likes
1 Solution
Roy_Liu
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 5 questions asked

Hello,

-如果DMA缓冲区在帧端已满,则不会丢失。它将被发送到USB主机,但帧结束的UVC标头不会添加到此缓冲区。在这种情况下,UVC主机应用程序将无法识别帧端点。

-要了解帧的结束位置,需要DMA缓冲区部分填充。在固件中,当DMA缓冲区未满时,我们为帧结束添加UVC头。

请告诉我帧分辨率/帧大小 (h_resol * v_resol * bits/pixel) ,以便我们建议DMA缓冲区大小,以便帧以部分DMA缓冲区结束。

 

- If the DMA buffer is full at the frame end, then it will not be lost. It will be sent to USB host but the UVC header for frame end will not be added to this buffer. In this case the UVC host application will not be able to identify the frame end.
- To understand where the frame ends, there is a need that DMA buffer is partially filled. In the firmware, when the DMA buffer is not full we add UVC header for frame end.
Please let me know the frame resolution/frame size (h_resol * v_resol * bits/pixel) for us to suggest a DMA buffer size so that the frame ends with partial DMA buffer.

Roy Liu

View solution in original post

0 Likes
4 Replies
Roy_Liu
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 5 questions asked

Hello,

是的,当DMA缓冲区已满(帧结束时),AN75779中的GPIF状态机会INTR_CPU,但这将不允许固件检测帧结束,因此不会添加帧结束UVC头。

如果DMA通道在手动模式下使用(FX3中添加了UVC头),建议视频帧应以部分DMA缓冲结束。

Hello,
Yes, the GPIF state machine in AN75779 has INTR_CPU when the DMA buffer is full (when frame ends) but this will not allow the firmware to detect the frame end and hence the frame end UVC header will not be added.
If the DMA channel is used in Manual mode ( UVC header added in FX3), it is suggested that the video frame should end with partial DMA buffer.

Roy Liu
0 Likes

我们是用了手动的dma通道,您的意思是这些情况下的帧会丢失或者错误的显示吗?

problem.png

如您说的:“如果DMA通道在手动模式下使用(FX3中添加了UVC头),建议视频帧应以部分DMA缓冲结束。

那我们怎么做到让所有视频帧都以部分DMA缓冲结束呢?总是会有一些帧以满缓冲区结束的吧

 

0 Likes
Roy_Liu
Moderator
Moderator
Moderator
1000 replies posted 500 solutions authored 5 questions asked

Hello,

-如果DMA缓冲区在帧端已满,则不会丢失。它将被发送到USB主机,但帧结束的UVC标头不会添加到此缓冲区。在这种情况下,UVC主机应用程序将无法识别帧端点。

-要了解帧的结束位置,需要DMA缓冲区部分填充。在固件中,当DMA缓冲区未满时,我们为帧结束添加UVC头。

请告诉我帧分辨率/帧大小 (h_resol * v_resol * bits/pixel) ,以便我们建议DMA缓冲区大小,以便帧以部分DMA缓冲区结束。

 

- If the DMA buffer is full at the frame end, then it will not be lost. It will be sent to USB host but the UVC header for frame end will not be added to this buffer. In this case the UVC host application will not be able to identify the frame end.
- To understand where the frame ends, there is a need that DMA buffer is partially filled. In the firmware, when the DMA buffer is not full we add UVC header for frame end.
Please let me know the frame resolution/frame size (h_resol * v_resol * bits/pixel) for us to suggest a DMA buffer size so that the frame ends with partial DMA buffer.

Roy Liu
0 Likes
Eddyi
Level 3
Level 3
25 sign-ins 10 replies posted 10 likes given

这里就是你得计算好你的DMA buffer size不能被一帧的大小整除。DMA buffer size需要调整的一般就是这种情况。

0 Likes