4 Replies Latest reply on Aug 15, 2020 10:23 PM by RashiV_61

    FX3 frame out of sync

    AvKr_4734021

      Hey, I am using UVC_AN7579 example. everything works fine but sometimes i see frame out of sync. any idea why it happens?

        • 1. Re: FX3 frame out of sync
          RashiV_61

          Hi,

           

          - Please let us know more about the frame out of sync? What exactly happens when this issue is seen?

          -  Please confirm that you are using the default  (without any modifications)AN75779 firmware from this link https://www.cypress.com/documentation/application-notes/an75779-how-implement-image-sensor-interface-using-ez-usb-fx3-us…  . If not  let us know the changes that are made to the firmware.

          -  Please share the debug prints while streaming the video so that we can know if there are some failures while streaming.

           

          Regards,

          Rashi

          • 2. Re: FX3 frame out of sync
            AvKr_4734021

            Hi Rashi, thanks for the answer.

            the issue seen is fame lines out of sync, means even rows are ok,but in the odd rows one half is ok and the other half looks like is taken from the first columns.

            it happens very rarely and i wasn't able to take screenshot of this.

            I have made some modifications to the firmware in order to support the sensor i am using (5 mp monochrome sensor).

            Basically the changes i have made are to support 2592 x 1944 frame size. it's little bit hard to describe all the changes here, but any idea why this phenomenon can happen?

            • 3. Re: FX3 frame out of sync
              RashiV_61

              Hello,

               

              It will not be easy to debug the problem with the description you have given. We would need more details. To debug the problem can you share the debug prints which will be printed when the video stream is started.

              To know the frame size received by FX3 from the sensor we would need to know the PROD events and from CONS events we will know how much data is read by the host from the FX3. You can add two variables to track these events and later get these variable printed using CyU3PDebugPrint API and share the debug prints with us.

               

               

              uint32_t prod =0, cons =0;

              uint16_t fps =0;

               

              void

              CyFxUvcApplnDmaCallback (

                      CyU3PDmaMultiChannel *chHandle,

                      CyU3PDmaCbType_t      type,

                      CyU3PDmaCBInput_t    *input

                      )

              {

                  CyU3PDmaBuffer_t    dmaBuffer;

                  CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

               

                  if (type == CY_U3P_DMA_CB_PROD_EVENT)

                  {

                    prod++;

              ..............

              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

              //            {

              //                /* A partially filled buffer indicates the end of the ongoing video frame. */           

                          fps ++;

                         CyFxUVCAddHeader (dmaBuffer.buffer - CY_FX_UVC_MAX_HEADER, CY_FX_UVC_HEADER_EOF);

               

              }

              else if (type == CY_U3P_DMA_CB_CONS_EVENT)

                  {

                     cons++;

                      streamingStarted = CyTrue;

                      glCommitBufferFailureCount = 0;        /* Reset the counter after data is consumed by USB */

                  }

               

              Later print these variables in for{}

              void

              UVCAppEP0Thread_Entry (

                      uint32_t input)

              {

                  uint32_t eventMask = (CY_FX_UVC_VIDEO_CONTROL_REQUEST_EVENT | CY_FX_UVC_VIDEO_STREAM_REQUEST_EVENT);

                  uint32_t eventFlag;

               

               

                  for (;;)

                  {

                    CyU3PDebugPrint (4, "PROD_EVENT = %d, CONS_EVENT = %d, FPS = %d", prod,cons,fps);

              .....

              }

               

              - The default AN75779 firmware uses DMA buffer size of 16 KB. Please let me know the DMA buffer size in your firmware.

              - Also, let me know what is the frame rate that you have configured in the device descriptor 2592 x 1944 *FPS *no of bytes/pixel. Please let me know the no. of bytes per pixel and FPS.

               

               

              Regards,

              Rashi

               

              • 4. Re: FX3 frame out of sync
                RashiV_61

                Hello,

                 

                If the frame rate is not proper (i.e. not as per the sensor configuration), the possible reasons can be

                - The frame rate from the sensor can be varying or not as per sensor configuration. This can be checked by probing the FV, LV signal lines.  The other way to check that the data coming from the sensor is as expected to not can be done by checking the producer and consumer events in the firmware (As asked in my response 3). Below shown are the ways to calculate fps and frame size

                (Producer events * fully filled buffer + 1* partial buffer)  = Frame size

                No. of frames (frame end - partial buffer)/ 1 second = fps

                 

                -  Please check if Invalid sequence error/ commit buffer failure is seen as mentioned in this KBA Invalid Sequence Error in Multi-Channel Commit Buffer - KBA218830. The occurrence of this error reduces the frame rate.

                 

                - If the frame rate has reduced to almost half of what is expected, try increasing the V blanking period.

                - You can also try increasing the horizontal blanking (while maintaining vertical blanking >500us)

                 

                Regards,

                Rashi