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

USB superspeed peripherals Forum Discussions

ZhYa_2401356
Level 2
Level 2

I use the demo of cyfxuvc_an75779, I get data from CyFxUvcApplnDmaCallback and submit it to the host, but sometimes the data submitted for one frame is incomplete, and there is data loss in one frame of data. What causes this?

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

In your response 2, I found that you tested the project with GUVCView on an Ubuntu virtual machine. As of now, we will debug this issue with Windows OS. Also, please make use of Bulk endpoint and not Isochronous endpoint for the debugging. That is, use the default example modified for streaming 1080p@30 fps in Windows OS.

From your previous responses, I found that you are seeing Commit Buffer failures while you stream the video data. So, please refer to the following KBA and let me know the result.

Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830

Please change the DMA buffer size to 32KB for streaming the video data. In addition to this, change the RX payload size field in glProbeCtrl from 0x00, 0x40, 0x00, 0x00 (16KB) to 0x00, 0x80, 0x00, 0x00 (32KB).

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna

View solution in original post

0 Likes
21 Replies
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please let me know if you are using the default example project that comes along with AN75779 or have you done any modifications on it. Are you able to get the video properly using the UVC host application? Please let me know how did you confirm that there was data loss? Also, is this data loss happening for all frames or is it like for some frames?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

Hello,

I only added 1080P descriptor, serial port and MCU communication commands to set the resolution of the lens. The GPIF bus is 32-bit, CY_U3P_PIB_GPIF_ADDR_COUNT_LIMIT and CY_U3P_PIB_GPIF_DATA_COUNT_LIMIT have been changed to 4091 (0x00000FFB). No other changes have been made. I tested with GUVCView on an Ubuntu virtual machine. I use glDmaDone counted YUV 1080P30 to transmit 254 times to transmit a complete frame of data. But sometimes a frame of data is transmitted less than 254 times, and video display is abnormal. Not all frames are incomplete, and some frames are incomplete.

0 Likes
ZhYa_2401356
Level 2
Level 2

I changed to synchronous transmission, and the phenomenon of data loss will improve! But when I transmit 1080P60, the host can't output video!

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please let me know if you are able to see the video stream properly on host application. Are you getting a blank screen on the host application or are you seeing any video preview?Please share the USB traces so that we can understand how much data is actually sent to the host?

Please let me know if you are seeing the same behaviour with the default setting that is to stream 720p video.

Also, what exactly did you mean by synchronous transmission in your response 3?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

cyfxuvc_an75779 is bulk transmission by default, I modified it for ISO synchronous transmission.

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please let me know if you are getting any errors printed using the serial port when you try to stream 1080p at 60 fps using Isochronous transmission.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

when I stream 1080p at 60 fps using Isochronous transmission. There are only any "DMA Reset Event: Commit buffer failure" messages. And I see a blank screen. When data is lost, the log is also printed. I use wiresshark to save the file, but the file is too large, more than 1G!

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Which OS do you want to use? Is it Windows or is it Linux?

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

I use the Ubuntu(Linux) OS, but I stream 1080p at 60 fps using Isochronous transmission  on Window, I also see a blank screen.

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

In your response 2, I found that you tested the project with GUVCView on an Ubuntu virtual machine. As of now, we will debug this issue with Windows OS. Also, please make use of Bulk endpoint and not Isochronous endpoint for the debugging. That is, use the default example modified for streaming 1080p@30 fps in Windows OS.

From your previous responses, I found that you are seeing Commit Buffer failures while you stream the video data. So, please refer to the following KBA and let me know the result.

Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830

Please change the DMA buffer size to 32KB for streaming the video data. In addition to this, change the RX payload size field in glProbeCtrl from 0x00, 0x40, 0x00, 0x00 (16KB) to 0x00, 0x80, 0x00, 0x00 (32KB).

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

Hello,

I tested 1080P30 on Windows in bulk transfer mode and the video was normal. But I tested on Linux virtual machine and Apple computer, sometimes the video is abnormal. I have tested under 16K, 24K, 32K, 48K conditions, and this problem has always existed. Is it possible that the data coming from the front end is unstable or a computer compatibility issue? Now I can't locate the problem.

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please confirm that always you are getting commit buffer failures when you see the abnormal behaviour. Also, please check what exactly is the error code that you get when the API CyU3PDmaMultiChannelCommitBuffer fails. This can be obtained by checking the status variable in the statement

status = CyU3PDmaMultiChannelCommitBuffer (chHandle, (dmaBuffer.count + CY_FX_UVC_MAX_HEADER), 0);

If the status is success, then do not do anything. But if the status if not success, then store the status variable in a global variable and print the value of global variable in the infinite for loop. By this way, we can understand what exactly was the cause of failure.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

Hello,

CyU3PDmaMultiChannelCommitBuffer  return 0x47.

When this error occurs, the cyfxuvc_an75779 demo has performed the corresponding operation as described in KBA218830. But when this error occurred, the video was already abnormal. So avoid this error!

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please let me know the following:

1. While changing the DMA buffer size, did you change the Data and address counters in GPIF State Machine. The counts are to be modified based on the formula given in the following snapshot.

pastedImage_0.png

2. I understood that you were trying to stream the video using a virtual linux machine. Please try streaming the video using a linux PC because we have found some issues with virtual machines.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

Hello,

I have modified the count value based on this formula. I also had this problem with testing on an MAC OS computer.

0 Likes
ZhYa_2401356
Level 2
Level 2

Hello,

Is there a way to know if the DMA is full?

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please check the snapshot below:

pastedImage_0.png

Inside this, the check dmaBuffer.count == CY_FX_UVC_BUF_FULL_SIZE indicates that there is a full buffer and the else condition indicates that there is a partial buffer. Please let me know if this is what you wanted in response 18.

Also, from the KBA KBA218830, error code 71 (0x47) may occur when the host application does not issue IN tokens fast enough to clear the buffers. As you were able to stream the data properly using UVC applications on Windows, there can be chances that the problem is caused by the host applications in Linux and Mac OS.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

Hello,

I used the same application to test the cameras of other manufacturers, and also used the CYUSB3014 solution. The video displayed by their devices is normal. So it has little to do with the application.

0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

Please confirm you are using the latest example project of AN75779 dated 10/30/2017 in the following link:

https://www.cypress.com/documentation/application-notes/an75779-how-implement-image-sensor-interface...

Also, please share the UART debug logs obtained by making the suggestions mentioned in the KBA218830 in the firmware for Windows and Linux.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
JayakrishnaT_76
Moderator
Moderator First question asked 1000 replies posted 750 replies posted
Moderator

Hello,

In addition to my previous response, please let me know what is the value of g1DmaDone that you get when you see the abnormal behaviour.

Best Regards,

Jayakrishna

Best Regards,
Jayakrishna
0 Likes
ZhYa_2401356
Level 2
Level 2

I print the value of glDmaDone through the serial port

0 Likes