10 Replies Latest reply on Sep 30, 2020 4:25 AM by RashiV_61

    Stream is not working: Custom board OV9782 / CYUSB3064

    GrAU_4638336

      Hello,

       

      Few days ago I was asking questions regarding the debug interface through USB.

      Thread:Debug interface through USB for CX3 + Image sensor application

       

      From this, I was able to create my own firmware based on the example given.

      In the mean time, I created the sensor library and digged into the uvc descriptor.

      I can successfully talk to my sensor and I'm not getting any mipi error while setting it up.

       

      Since the board used is a custom one, I'm sadly not able to probe the Mipi lanes to make sure they are behaving correctly.

      However, I'm using the config given by the sensor manufacturer (with clock and fps modified), which should contain a correct setup.

      The objective here is to stream a |1280x800 30fps RAW10| and a |640x400 30fps RAW10| through an USB 2.1 HyperSpeed interface.

       

      I've tried to follow couple of threads available on the forum to fix my issue and get the stream working, without success.

      Since I'm completely new in this firmware development world, I'm probably missing something but I can't find out what..

       

      I've attached the project, without the sensor library, any comments are welcome!

       

      This would be my first implementation of an image sensor, you can't imagine how excited I will be if I could have a stream working!

       

      Thanks for your help,

       

      Greg

        • 1. Re: Stream is not working: Custom board OV9782 / CYUSB3064
          RashiV_61

          Hello Greg,

           

          To debug the problem we would need the debug prints when the video streaming starts or the host application is opened to view the stream.

          From the firmware, I found that debug prints are sent over USB socket through  CDC interface. So, can you share the debug prints after enabling the macro CX3_DEBUG_ENABLED. Please try printing the PROD and CONS events (glDmaDone) and the  glHitFV variables in the CyCx3AppThread_Entry (for{} loop)

           

          Please let me know if any queries on this

           

          Regards,

          Rashi

          • 2. Re: Stream is not working: Custom board OV9782 / CYUSB3064
            GrAU_4638336

            Hello Rashi,

             

            Thanks for your help!
            I've tried to activate CX3_DEBUG_ENABLED but it's making the cx3 to hang because of this part in CyCx3AppUSBSetupCB:

             

            #if CX3_DEBUG_ENABLED
                wLength  = ((setupdat1 & CY_U3P_USB_LENGTH_MASK)  >> CY_U3P_USB_LENGTH_POS);
                CyU3PDebugPrint(4, "\n\rbRType = 0x%x, bRequest = 0x%x, wValue = 0x%x, wIndex = 0x%x, wLength= 0x%x",
                        bRType, bRequest, wValue, wIndex, wLength);
            #endif
            

             

            So I've commented out this part.

             

            I've put debug prints in CONS_EVENT and PROD_EVENT, but it seems that these ones were never called.

            Below is the outputs I obtained while opening eCamViewer and changing resolution.

            I guess this is not what I should expect.

             

            Mipicsi Set PHY Delay status = 0x0
            crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0 //Before resolution config
            Writing OV9782 800p configuration done
            crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0 //After resolution config
            AplnStrt:SMState = 0x2
            Mipicsi Set PHY Delay status = 0x0
            crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0 //Before resolution config
            Writing OV9782 400p configuration done
            crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0 //After resolution config
            USB Setup CB:Call App stop is called
            
            APP STOP
            Writing OV9782 Sleep_Config size-10
            OV9782 Sleep_Config--
            AplnStop:SMState = 0x2
            AplnStrt:SMState = 0x2
            

             

            I had an App Stop called even if nothing was closed.
            Any thought on what I should do?

             

             

            Moreover a lot of the print statements are never sent. I'm guessing that this is due to some part of the CX3 not initialized yet, is that correct?

            Is there a way to fix this?

             

            Thanks,

             

            Greg

            • 3. Re: Stream is not working: Custom board OV9782 / CYUSB3064
              RashiV_61

              Hello Greg,

               

              Please send the complete debug log so that I can know if there is something being missed. In the debug prints you shared, i have not seen the prints like  "Setting MIPI interface" which are there in the firmware you shared.

              You can comment out this print as of now

              CyU3PDebugPrint(4, "\n\rbRType = 0x%x, bRequest = 0x%x, wValue = 0x%x, wIndex = 0x%x, wLength= 0x%x"bRType, bRequest, wValue, wIndex, wLength);

               

              As the start and stop GPIF state are same it seems the data is not received by the CX3.

              Please let me know if you have the test point on your board to probe the FV, LV, and PCLK and share the traces. Please refer Q10 of this KBA CX3 Hardware: Frequently Asked Questions - KBA91295 . From this we can confirm if the video data received by the MIPI receiver of CX3 is as expected.

               

              Also, share the snippets of CX3 MIPI Receiver Configuration Settings for me to review

               

              Regards,

              Rashi

              • 4. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                GrAU_4638336

                Hello Rashi,

                 

                Sorry for the delayed answer.

                For some reason, the debug logs you have seen are the entire logs available. I canno't explain why at this stage, but as I mentioned, I'm guessing that part of the CYUSB3064 is not initialized/ready when the outputs are sent. Is there anyway to fix that?

                 

                Sadly this test points are not currently available on my board. However FSIN/VSYNC of image sensor is linked to GPIO23 if this can help..

                 

                Thanks for your help,

                 

                Greg

                • 5. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                  RashiV_61

                  Hello Greg,

                   

                  As the endpoint related to the CDC interface (used for the debugging purpose)is configured after CyU3PConnectState API, so the debug prints before that won't be seen.

                  To check if the APIs before that pass successfully you can call CyU3PDeviceReset(CyFalse) in the case of the failures of API and check that device doesn't reset. If the device resets that means that particular API is not passing successfully.

                   

                  If all the API before CyU3PConnectState API passes and still the CY_U3P_DMA_CB_PROD_EVENT events are not seen then please check if the sensor settings and the CX3 MIPI receiver are the same. Please share the CX3 MIPI receiver configuration toll settings for us to check.

                   

                  Regards,

                  Rashi

                  • 6. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                    GrAU_4638336

                    Rashi,

                     

                    I've put CyU3PDeviceReset(CyFalse) in all the if(Failed) statements in the AppInit function.

                    None of them is making the device to reset. I'm guessing that everything is initialized correctly then.

                     

                    Below are some more information about the clocks:

                     

                    Configuration of the sensor's clocks

                    image (1).png

                     

                    Configuration of the sensor:

                    image.png

                     

                    CX3 Mipi receiver configuration tool:

                    Capture.PNG

                     

                    Hopefully this can help.

                    Thanks,

                     

                    Greg

                    • 7. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                      GrAU_4638336

                      I attached the last version of the code.

                      It has probably slightly changed since the first publication.

                      • 8. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                        RashiV_61

                        Hello Greg,

                         

                        The CX3 configuration tool settings seem fine as all the parameters are in range.

                        In the firmware you shared I see the debug prints are used inside the DMA callback.

                        We do not recommend to use blocking calls (like CyU3PDebugPrint()) in the callbacks. Please use global variables to track he CY_U3P_DMA_CB_PROD_EVENT and CY_U3P_DMA_CB_CONS_EVENT events and then later get those variable printed in CyCx3AppThread_Entry for(;;) loop.

                         

                        There are possibilities that the debug prints in the DMA callback do not print over UART. So, please try the above-mentioned suggestion and let me know if you get the CY_U3P_DMA_CB_PROD_EVENT when the host application is opened (CyCx3AppStart is called).

                        Also, try printing MIPI errors.

                         

                        Regards,

                        Rashi

                        • 9. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                          GrAU_4638336

                          Hi Rashi,

                           

                          I can confirm, the PROD and CONS Event are never called.

                          I've put a boolean variable in both of them to see if it's called at the some point and it is never called.

                          Does that mean that no data are received on the mipi lanes?

                          Should I try to scratch the silkscreen of the mipi lanes on one of the board to prob them?

                           

                          Mipi Errors are still giving 0 for all the parameters when a camera resolution is called.

                           

                          However I can see an AplnStr:SmState=0x2, is that an issue?

                           

                          I also don't understand why AppStop is called when I'm changing the resolution used.

                           

                          See logs:

                           

                          Mipi sleep
                          Mipicsi Set PHY Delay status = 0x0
                          crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0
                          Writing OV9782 800p configuration done
                          crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0
                          AplnStrt:SMState = 0x2
                          Mipicsi Set PHY Delay status = 0x0
                          crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0
                          Writing OV9782 400p configuration done
                          crcErrCnt:0, ctlErrCnt:0, eidErrCnt:0, frmErrCnt: 0
                          USB Setup CB:Call App stop is called
                          
                          APP STOP
                          Writing OV9782 Sleep_Config size-10
                          OV9782 Sleep_Config--
                          AplnStop:SMState = 0x2
                          AplnStrt:SMState = 0x2
                          

                           

                          Thanks,

                           

                          Greg

                          • 10. Re: Stream is not working: Custom board OV9782 / CYUSB3064
                            RashiV_61

                            Hello Greg,

                             

                            Does that mean that no data are received on the mipi lanes?

                            If the producer events are not seen that means the data is not being written to the DMA buffer. It seems that either the sensor is not giving the output or if the sensor s giving out the output the sensor settings and the CX3 MIPI receiver settings are not in sync.

                            Yes, you can try probing the MIPI clock and data lane and check if the sensor outputs the clock and data. Please check the MIPI clock frequency

                             

                             

                            However I can see an AplnStr:SmState=0x2, is that an issue?

                            >> This shows that the GPIF state machine is in state 0x02 which is the wait state. The GPIF state machine transitions to the next state only when the FV signal s high that is when frame data is being transmitted.

                            As AplnStop:SMState = 0x2 i.e the state doesn't transition to another sate which means that frame data is not being transferred.

                             

                             

                            When the resolution is changed on the fly, CX3_USB_UVC_SET_CUR_REQ request is sent by the host to set the new resolution by configuring the sensor.

                            From your firmware

                               /* Set Commit Control and Start Streaming*/

                                    if (wValue == CX3_APP_VS_COMMIT_CONTROL)      // SET_CUR COMMIT request

                                    {

                                        CyCx3AppImageSensorSetVideoResolution (glCommitCtrl[3]);      // Set the sensor with new settings

                             

                                        if (glIsApplnActive)

                                        {

                                            CyU3PDebugPrint (4, "\n\rUSB Setup CB:Call AppSTOP1");

                                            CyCx3AppStop();                                      // If the streaming is going on we need to stop the streaming with old resolution and restart the resolution with new resolution after resetting the DMA pipe

                                        }

                             

                                        CyCx3AppStart();                                       // started streaming with new resolution

                                    }

                             

                             

                             

                            Regards,

                            Rashi