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

cross mob

FX3: Error in CyU3PDmaMultiChannelCommitBuffer: code 71 - KBA218830

lock attach
Attachments are accessible only for community members.

FX3: Error in CyU3PDmaMultiChannelCommitBuffer: code 71 - KBA218830

ChaitanyaV_61
Employee
Employee
50 questions asked 25 likes received 25 sign-ins

Version: *A

Translation - Japanese: マルチチャネルコミットバッファでの無効なシーケンスエラー - KBA218830 - Community Translated (JA)

The Error in CyU3PDmaMultiChannelCommitBuffer: code 71 message may be displayed on a UART terminal when streaming video through FX3. This error does not occur in FX3 SDK versions 1.3.5 and later, and if CyU3PDmaMultiChannelGetBuffer()succeeds before CyU3PDmaMultiChannelCommitBuffer() is called.

This message may be displayed when there is a DMA buffer overflow because of the CY_U3P_ERROR_INVALID_SEQUENCE error. This error may occur if the UVC host application does not issue IN tokens fast enough to clear the DMA buffers. See “Scenario 2” in KBA231382 for details.

  1. Do the following to prevent all the DMA buffers from being filled up, as mentioned in KBA231382:
    1. Increase the DMA buffer size so that FX3 can hold data for a longer duration
    2. Configure horizontal blanking of the image sensor as high as possible (this leads to reduced vertical blanking, consequently maintaining the same frame rate). While doing this, ensure that vertical blanking does not go below ~350 µs.
  2. If the above change does not help, configure the ISOC endpoint for video transfers instead of the BULK endpoint. See KBA231897.
  3. If the error still occurs, use the following recovery procedure (in firmware using FX3 SDK version < 1.3.5). See the latest revision of the AN75779 firmware (which already includes the below recovery procedure).
    1. Set a flag (say, commit_buffer_failure) in the CyFxUvcApplnDmaCallback() function when CyU3PDmaMultiChannelCommitBuffer() fails to return CY_U3P_SUCCESS.

      Note: In AN75779 firmware an event is used instead of flag variable. The event, if set in DMA callback, is cleared in the for(;;) loop and the functions CyFxUvcApplnStop(), CyFxUvcApplnStart() are called to recover from the error. See the below code snippet which includes the steps done in CyFxUvcApplnStop() and CyFxUvcApplnStart().

    2. In the for(;;) loop of the UVCAppThread_Entry() function, check if this flag is set. If yes, implement the following code snippet to reset the DMA channel and restart the GPIF II state machine:

      if (commit_buffer_failure == 1)

      {
            commit_buffer_failure = 0;

            /* Stop the GPIF state machine to stop data transfers through FX3 */

            CyU3PGpifDisable (CyFalse);
            streamingStarted = CyFalse;

            /* Place the Endpoint in NAK mode before cleaning up the pipe. */

            apiRetStatus = CyU3PUsbSetEpNak (CY_FX_EP_BULK_VIDEO, CyTrue);

            if (apiRetStatus != CY_U3P_SUCCESS)

            {
                  CyU3PDebugPrint (4, "\r EP_NAK=%d\n", apiRetStatus);

            }

            /* Reset the DMA channel and flush the endpoint pipe. */
            apiRetStatus = CyU3PDmaMultiChannelReset (&glChHandleUVCStream);
            if (apiRetStatus != CY_U3P_SUCCESS)
            {
                  CyU3PDebugPrint (4, "\r DMA_RESET=%d\n", apiRetStatus);
            }
            apiRetStatus = CyU3PUsbFlushEp (CY_FX_EP_BULK_VIDEO);
            if(apiRetStatus != CY_U3P_SUCCESS)
            {
                  CyU3PDebugPrint (4, "\r EP_FLUSH=%d\n", apiRetStatus);
            }
            apiRetStatus = CyU3PDmaMultiChannelSetXfer (&glChHandleUVCStream, 0, 0);
            if (apiRetStatus != CY_U3P_SUCCESS)
            {
                  CyU3PDebugPrint (4, "\r DMA_XFER  = %d\n", apiRetStatus);
            }
            apiRetStatus = CyU3PUsbSetEpNak (CY_FX_EP_BULK_VIDEO, CyFalse);
            if(apiRetStatus != CY_U3P_SUCCESS)
            {
                  CyU3PDebugPrint (4, "\r EP_ACK=%d\n", apiRetStatus);
            }
            apiRetStatus = CyU3PGpifSMStart (START_SCK0, ALPHA_START_SCK0);
            if (apiRetStatus != CY_U3P_SUCCESS)
            {
                  CyU3PDebugPrint (4, "CyU3PGpifSMStart  = %d\n", apiRetStatus);
            }
            apiRetStatus = CyU3PGpifSMSwitch (257, 0, 257, 0, 2);
            if (apiRetStatus != CY_U3P_SUCCESS)
            {
                  CyU3PDebugPrint (4, "CyU3PGpifSMSwitch  = %d\n", apiRetStatus);
            }
            streamingStarted = CyTrue;
      }

Attachments
0 Likes
1524 Views