cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

liuzhengxiang
New Contributor II

Cx3 has a camera, and other devices can preview images by UVC connection . The customer want to add the time stamp on the image.Can cx3 realize this function?Or is there a corresponding interface?

0 Likes
1 Solution
YiZ_31
Moderator
Moderator

你想怎么让这个时间戳显示出来?这就是播放器的功能问题了,读数据然后显示。

View solution in original post

0 Likes
8 Replies
JayakrishnaT_76
Moderator
Moderator

Hello,

In UVC firmware, for every payload sent, 12 byte header is added. In that there is a 4 byte field dwPresentationTime. Please check if you can utilize this.

Please check below thread:

https://community.cypress.com/t5/USB-Superspeed-Peripherals/CX3-Utilizing-the-UVC-PTS-Presentation-T...

Best Regards,
Jayakrishna
0 Likes
liuzhengxiang
New Contributor II

请问:/* UVC Header */
static uint8_t glUVCHeader[CX3_APP_HEADER_LENGTH] =
{
0x0C, /* Header Length */
0x8C, /* Bit field header field */
0x00,0x00,0x00,0x00, /* Presentation time stamp field */
0x00,0x00,0x00,0x00,0x00,0x00 /* Source clock reference field */
};

CyU3PGetTime()这个函数获取到的

uint32_t tickCount = CyU3PGetTime() ; 
uint32_t second = tickCount / 1000 ;
uint32_t ms = tickCount % 1000 ;

请问0x00,0x00,0x00,0x00, /* Presentation time stamp field */这四个字节从左往右分别是按小时,分,秒,毫秒来填充吗?

0 Likes
liuzhengxiang
New Contributor II

我加日志看了,发现CyCx3AppDmaCallback函数一直在调用

CyCx3AppAddHeader ((dmaBuffer.buffer - CX3_APP_PROD_HEADER), CX3_APP_HEADER_FRAME);,我随便填充一些值到0x00,0x00,0x00,0x00, /* Presentation time stamp field */这个几个变量里,打开camera后预览没有时间出来呀?

0 Likes
YiZ_31
Moderator
Moderator

你可以用wireshark抓包看一下数据吗?这个包头是肯定会添加到数据上面的,否则无法识别图像。

 

0 Likes
liuzhengxiang
New Contributor II
 

 

此函数一直调用,但是图像没有时间显示。Wireshark抓的包,没有看到uvc数据包。usb1.pcapng这个文件有保留

CyCx3AppAddHeader (
uint8_t *buffer_p, /* Buffer pointer */
uint8_t frameInd /* EOF or normal frame indication */
)
{
uint32_t tickCount1 = CyU3PGetTime() ;
uint32_t TotalSecond1 = tickCount1 / 1000 ;
uint8_t hours1 = 0;
uint8_t mimute1 = 0;
uint8_t second1 = 0;

if(TotalSecond1 <60)
{
second1 = TotalSecond1;
}
else if(TotalSecond1 < 3600)
{
mimute1 = TotalSecond1/60;
second1 = TotalSecond1%60;
}
else
{
hours1 = TotalSecond1/3600;
mimute1 = (TotalSecond1%3600)/60;
second1 = (TotalSecond1%3600)%60; ;
}
glUVCHeader[2] = hours1;
glUVCHeader[3] = mimute1;
glUVCHeader[4] = second1;
//glUVCHeader[5] = second1;
/* Copy header to buffer */
LOG("CyCx3AppAddHeader");
CyU3PMemCopy (buffer_p, (uint8_t *)glUVCHeader, CX3_APP_HEADER_LENGTH);

/* Check if last packet of the frame. */
if (frameInd == CX3_APP_HEADER_EOF)
{
/* Modify UVC header to toggle Frame ID */
glUVCHeader[1] ^= CX3_APP_HEADER_FRAME_ID;

/* Indicate End of Frame in the buffer */
buffer_p[1] |= CX3_APP_HEADER_EOF;
}
}

 

0 Likes
liuzhengxiang
New Contributor II

用分析抓包工具可以看到时间戳数据是实时更新的。说明设置有效了。但是咨询一下,这个时间戳为啥不与图像一起显示出来?

 

0 Likes
YiZ_31
Moderator
Moderator

你想怎么让这个时间戳显示出来?这就是播放器的功能问题了,读数据然后显示。

View solution in original post

0 Likes
liuzhengxiang
New Contributor II

了解,那这个问题就可以关闭了。

0 Likes