cancel
Showing results for 
Search instead for 
Did you mean: 

USB Superspeed Peripherals

juhu_4653696
New Contributor

Hi,

During stress test, we found accidentally shows the error "DMA Reset Event: Commit buffer failure":

[2020-03-06 04:18:23] glFrameCount = 7784, glPacketCount=176 !

[2020-03-06 04:18:23] glFrameCount = 7785, glPacketCount=176 !

[2020-03-06 04:18:23] glFrameCount = 7786, glPacketCount=176 !

[2020-03-06 04:18:23] CyU3PDmaMultiChannelCommitBuffer Fail! status = 71 !

[2020-03-06 04:18:23] DMA Reset Event: Commit buffer failure

[2020-03-06 04:18:23] Application Stopped

[2020-03-06 04:18:23] Application Started

[2020-03-06 04:18:23] glFrameCount = 0, glPacketCount=198 !

[2020-03-06 04:18:23] glFrameCount = 1, glPacketCount=176 !

error status is CY_U3P_ERROR_INVALID_SEQUENCE.

when error occur, some image data will lose. It is not acceptable for us.

We use EZ-USB FX3 UVC cyusb3014, Please refer to the "AN75779 project. we do not do more modify.

I find many questions about "DMA Reset Event: Commit buffer failure" in forum, do you have any some solutions to resolve it?

Please kindly help me and thank you very much!

Jun

0 Likes
Reply
1 Solution
YashwantK_46
Moderator
Moderator

Hi Jun,

Please refer to the following KBA: Implementing Extension Unit Control in AN75779 Example Project - KBA219280

You can use it to implement the DMA reset mechanism in the firmware.

Can you please elaborate on what debugging are you referring to?
What kind of debugging do you want to do?

Regards,
Yashwant

View solution in original post

0 Likes
Reply
17 Replies
juhu_4653696
New Contributor

We use 1920*1200*2 pixel @20pfs or 1200*1200*2 pixel @30pfs setting. Please review dma setting below:

/* UVC Video Streaming Endpoint Packet Size */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)         /* 1024 Bytes */

/* UVC Video Streaming Endpoint Packet Count */

#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x10)          /* 16 packets (burst of 16) per DMA buffer. */

/* DMA buffer size used for video streaming. */

#define CY_FX_UVC_STREAM_BUF_SIZE       (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)  /* 16 KB */

/* Maximum video data that can be accommodated in one DMA buffer. */

#define CY_FX_UVC_BUF_FULL_SIZE         (CY_FX_UVC_STREAM_BUF_SIZE - 16)

/* Number of DMA buffers per GPIF DMA thread. */

#define CY_FX_UVC_STREAM_BUF_COUNT      (4)

0 Likes
Reply
juhu_4653696
New Contributor

Hi,

Anbody could give some suggestion?

BR,

Jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hello Jun,

Please refer to the following KBA: Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830


Also, please try the following:

1) Set CY_FX_UVC_STREAM_BUF_SIZE  (0x8000) // 32 KB instead of (0x8000 + 16)

Also changes need to be done in probe control setting This field should be set to more than or equal to the DMA buffer size

0x00, 0x40, 0x00, 0x00,     /* No. of bytes device can rx in single payload = 16 KB */ // This is when DMA buffer size is 16KB

2) Set this field to   0x00, 0x90, 0x00, 0x00,     /* No. of bytes device can rx in single payload = 36 KB */ As the DMA Buffer size id 32 KB

Please modify the firmware with above mentioned settings and try streaming. Please let me know the results

Regards,

Yashwant

0 Likes
Reply
juhu_4653696
New Contributor

Hi Yashwant,

Very appreciated for your reply!

I try to increase the STREAM_BUF_SIZE and dma buffer to 32k,but the issue is still exist. please review the change below :

--- a/board_fw/uvc_cam10/cyfxgpif2config.h

+++ b/board_fw/uvc_cam10/cyfxgpif2config.h

@@ -133,12 +133,12 @@ uint32_t CyFxGpifRegValue[]  = {

-    0x00003FEF,  /*  CY_U3P_PIB_GPIF_ADDR_COUNT_LIMIT */

+    0x00007FEF,  /*  CY_U3P_PIB_GPIF_ADDR_COUNT_LIMIT */

-    0x00003FEF,  /*  CY_U3P_PIB_GPIF_DATA_COUNT_LIMIT */

+    0x00007FEF,  /*  CY_U3P_PIB_GPIF_DATA_COUNT_LIMIT */

--- a/board_fw/uvc_cam10/uvc.c

+++ b/board_fw/uvc_cam10/uvc.c

@@ -162,7 +162,7 @@ uint8_t glProbeCtrl[CY_FX_UVC_MAX_PROBE_SETTING] = {

                                    streaming with adjustable compression parameters */

-    0x00, 0x40, 0x00, 0x00,      /* No. of bytes device can rx in single payload = 16 KB */

+    0x00, 0x80, 0x00, 0x00,      /* No. of bytes device can rx in single payload = 32 KB */

--- a/board_fw/uvc_cam10/uvc.h

+++ b/board_fw/uvc_cam10/uvc.h

@@ -35,7 +35,7 @@

/* Definitions to enable/disable special features in this UVC application. */

#define CY_FX_EP_BULK_VIDEO_PKT_SIZE    (0x400)         /* 1024 Bytes */

/* UVC Video Streaming Endpoint Packet Count */

-#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x10)          /* 16 packets (burst of 16) per DMA buffer. */

+#define CY_FX_EP_BULK_VIDEO_PKTS_COUNT  (0x20)          /* 32 packets (burst of 32) per DMA buffer. */

/* DMA buffer size used for video streaming. */

#define CY_FX_UVC_STREAM_BUF_SIZE     (CY_FX_EP_BULK_VIDEO_PKTS_COUNT * CY_FX_EP_BULK_VIDEO_PKT_SIZE)  /* 32 KB*/

/* Number of DMA buffers per GPIF DMA thread. */

-#define CY_FX_UVC_STREAM_BUF_COUNT      (4)

+#define CY_FX_UVC_STREAM_BUF_COUNT      (3)

And I try to set 48k,has the same result.

Do you have other idea for it?

By the way, Could you explain probable cause for "Commit buffer failure CY_U3P_ERROR_INVALID_SEQUENCE" ?

So i cant do some targeted test...

BR,

Jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hello Jun,


As mentioned in the KBA, "This error may occur if the UVC host application does not issue IN tokens fast enough to clear the DMA buffers."

This is the cause of the error and a possible method to solve the issue is also given.


Can you confirm if you have implemented the code snippet suggested in Step(2)?

Also, can you confirm your interface data bus width (8, 16, 24, 32-bit)?

Regards,

Yashwant

0 Likes
Reply
juhu_4653696
New Contributor

Hi Yashwant,

I have implemented the code snippet suggested in Step(2) and the data bus width is 8bit.

The issue still exist.

Thanks!

Jun

0 Likes
Reply
juhu_4653696
New Contributor

We use super speed usb 3.0 interface and only open one camera 1200*1200 yuyv mode.

The host is ubuntu16.04 ,system loading is light.

It look that doesn't matter with host application?

We use guvcview open camera , the issue still exist...

BR,

Jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hi Jun,

Can you try it with a windows host PC and check if the issue still exists?

The total frame size at the resolutions you mentioned is well under the USB 3.0 bandwidth.

Can you please share the findings with a different host PC and different OS?

Regards,

Yashwant

0 Likes
Reply
juhu_4653696
New Contributor

We found the data loss in windows.

Since we need use ubuntu16.04, so will test in linux. when test stress ,all cpu loading high, will drop some packets.

Thanks.

Jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hello Jun,

Can you please share your firmware so that i can review the modifications that you have made to the firmware?

Also, please share the USB traces in either of the operating systems using either Wireshark in Windows or Usbmon in Linux and share them with me.

I would need to review them to get to know about the issue better.

Regards,
Yashwant

0 Likes
Reply
juhu_4653696
New Contributor

Hi Yashwant,

We found usb packet data interlaced and never recovery. below is usbmon capture:

data_interlaced.png

The recevied time of last two usb packet were delayed in red color box(must be 18:19:06.651,but delay to 18:19:06.722).

The time "18:19:06.722" is next image start time(triggered by external signal interval 100ms)

The issue exists long time and nevel recovery until we restart power.

I think maybe some errors happy in cypress and not do dma reset.

Could you help to look it?

Sincerely,

Jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hello Jun.

Thank you for the traces.


1.) Do you see this issue randomly or does it happen at regular intervals?

2.)Can you please share your firmware so that I can review the changes that you made to the firmware?

Regards,

Yashwant

0 Likes
Reply
juhu_4653696
New Contributor

Hi,Yashwant,

This issue randomly happen,but never recovey.

Please review the code in attachment.

Thanks!

jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hello Jun,


Please program the device with the attached firmware that has the workaround mentioned in the KBA218830 that i pointed to in my earlier response.

And check if you see the issue of sequence error or not.


In the firmware that you provided, i did not see the workaround implemented. So, i added it to the firmware and changed the buffer size to 32KB and count to 3 and changed the payload size too.

Please change the DATA_COUNT_LIMIT and ADDR_COUNT_LIMIT values to the 0x00007FEF and try the firmware.

Regards,
Yashwant

0 Likes
Reply
juhu_4653696
New Contributor

Hi Yashwant,

Many thanks for your reply! The issue is still exist.

Could you tell me how to reset dma from the linux host? i want to reset dma from host when the issue happens.

Could you provide the linux debug tools or some ways to set the cypress chip?How can i debug the cypress chip from linux system?

Thanks!

Jun

0 Likes
Reply
YashwantK_46
Moderator
Moderator

Hi Jun,

Please refer to the following KBA: Implementing Extension Unit Control in AN75779 Example Project - KBA219280

You can use it to implement the DMA reset mechanism in the firmware.

Can you please elaborate on what debugging are you referring to?
What kind of debugging do you want to do?

Regards,
Yashwant

View solution in original post

0 Likes
Reply
juhu_4653696
New Contributor

Hi Yashwant,

Thank you very much!

jun

0 Likes
Reply