9 Replies Latest reply on Feb 16, 2020 9:59 PM by JayakrishnaT_76

    CX3 interfacing for MIPI yuv device

    JeCh_4640591

      Hi All.

       

      I am new to CX3 RDK to make MIPI to USB device using ov5640.

      I am trying to interface ov5640 with CX3 chip.

      After imported the demo project of cycx_uvc_ov5640, I succeeded on compilation and running from RAM.

      And the CX3 device could be detected as the camera device named as "cx3-uvc" in Windows Device Manager List.

      However the camera preview does not work since the error comes from the below code. CyU3PMipicsiGpifLoad().

       

      /* Configure the Fixed Function GPIF on the CX3 to use a 16 bit bus, and

           * a DMA Buffer of size CX3_APP_DATA_BUF_SIZE

           */

          status = CyU3PMipicsiGpifLoad(CY_U3P_MIPICSI_BUS_16, CX3_APP_DATA_BUF_SIZE);

          if (status != CY_U3P_SUCCESS)

          {

              CyU3PDebugPrint (4, "\n\rAppInit:MipicsiGpifLoad Err = 0x%x", status);

              CyCx3AppErrorHandler(status);

          }

       

       

      The function returns the 0x46. (e.g. AppInit:MipicsiGpifLoad Err = 0x46).

      0x46 means that the operation requested is not supported in current mode.

      I don't know why it comes out.

      Could anyone help me to figure out this problem?

      I am using Denebola RDK board with OV5640 sensor.

       

      Thanks

      Best Regards,

      JK Cha

        • 1. Re: CX3 interfacing for MIPI yuv device
          JayakrishnaT_76

          Hello,

           

          According to my understanding,

          1. You are using Denebola RDK.

          2. You are using the example project in the following path and not made any changes to it.

          C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\cx3_examples\cycx3_uvc_ov5640

          Please let me know if I'm wrong.

           

          Please let me know what is the state of PMODE pins. Also, please share a snapshot of the control center application after plugging in the board without downloading the firmware.

           

          Best Regards,

          Jayakrishna

          • 2. Re: CX3 interfacing for MIPI yuv device
            JeCh_4640591

            Hi Jayakrishna

            Thanks for your reply

             

            Yes, your understanding is correct.

            I set PMODE pins to '1,1,float' for USB boot(RAM) mode, And a snapshot of USB Control Center is attached.

             

            BTW. Could you please tell me what could be expected behavior when all of PMODE pins are float which means no specific boot mode is selected in case the dip switch is broken?

             

            controlcenter2.png

             

             

            Thanks a lot.

             

            Sincerely yours

            Best Regards,

            JK Cha

            • 3. Re: CX3 interfacing for MIPI yuv device
              JayakrishnaT_76

              Hello,

               

              Please confirm by 11x what exactly did you meant? Is it PMODE[2:0] = 11x or PMODE[0:2] = 11x?

               

              Regarding your question, if all the PMODE pins are floating, then the bootloader will run but the device wont be enumerated properly. So you wont be able to download the firmware to the device.

               

              Best Regards,

              Jayakrishna

              • 4. Re: CX3 interfacing for MIPI yuv device
                JeCh_4640591

                Hi Jayakrishna

                I found the PMODE pin had the float state due to H/W problem. After fixed the PMODE[0:2] pin state to '1,1,float' of USB Boot mode, the problem above is fixed. There's no error in CyCx3AppInit().

                However the camera preview does still not work showing the log below in next steps.

                 

                     <\n><\r>EnterSuspendMode Status =  0x0, Wakeup reason = 0x8<\n><\r>EnterSuspendMode Status =  0x0, Wakeup reason = 0x8

                 

                And the CX3 does not get DMA_RESET_EVENT as log shown, hence CyCx3AppStart() is not called. And glMipiActive flag couol not be true.

                I can't figure out the reason why glIsAppInActive and glMipiActive are true.

                 

                status = CyU3PEventGet (&glCx3Event, evMask, CYU3P_EVENT_OR_CLEAR, &eventFlag, CYU3P_WAIT_FOREVER);

                        if (status == CY_U3P_SUCCESS)

                        {

                        CyU3PDebugPrint (4, "CY_U3P_SUCCESS\r\n");

                            if (eventFlag & CX3_DMA_RESET_EVENT)

                            {

                            CyU3PDebugPrint (4, "CX3_DMA_RESET_EVENT\r\n");

                                /* Frame timed out. Abort and start streaming again. */

                                if (glIsApplnActive)

                                {

                                CyU3PDebugPrint (4, "glIsApplnActive\r\n");

                                    CyCx3AppStop();

                                }

                            CyU3PDebugPrint (4, "CyCx3AppStart\r\n");

                                CyCx3AppStart();

                 

                #ifdef RESET_TIMER_ENABLE

                                CyU3PTimerStop (&Cx3ResetTimer);

                                CyU3PTimerModify (&Cx3ResetTimer, TIMER_PERIOD, 0);

                #endif

                            }

                            /* Handle Suspend Event*/

                            if (eventFlag & CX3_USB_SUSP_EVENT_FLAG)

                            {

                            CyU3PDebugPrint (4, "CX3_USB_SUSP_EVENT_FLAG\r\n");

                                /* Place CX3 in Low Power Suspend mode, with USB bus activity as the wakeup source. */

                                CyU3PMipicsiSleep();

                                CyCx3_ImageSensor_Sleep();

                             

                                status = CyU3PSysEnterSuspendMode (CY_U3P_SYS_USB_BUS_ACTVTY_WAKEUP_SRC, 0, &wakeReason);

                                CyU3PDebugPrint (4, "\n\rEnterSuspendMode Status =  0x%x, Wakeup reason = 0x%x", status, wakeReason);

                                if (glMipiActive)

                                {

                                CyU3PDebugPrint (4, "glMipiActive\r\n");

                                    CyU3PMipicsiWakeup();

                                    CyCx3_ImageSensor_Wakeup();

                                }

                            }

                        }

                • 5. Re: CX3 interfacing for MIPI yuv device
                  JayakrishnaT_76

                  Hello,

                   

                  Please use Z11 setting for PMODE[2:0]. CX3 supports boot options that are mentioned in Table 2 (in Page 8) of the following document.

                  https://www.cypress.com/file/133591/download

                  If you are using any other boot option other than these, then there are chances that you get errors in CyU3PMipicsiGpifLoad().

                  Please let me know which host application you are using for streaming the video.

                   

                  Best Regards,

                  Jayakrishna

                  • 6. Re: CX3 interfacing for MIPI yuv device
                    JeCh_4640591

                    Hi

                     

                    Let me clarify below.

                    I am setting PMODE[0:2] to 'ON, ON, Float' for USB Boot mode as you told.

                    And I run Windows 10 Camera App (built-in), and AMCap and VLC player,

                    But e-CAM View does not work for me. I can see its connected status and fps information only from e-CAM Veiw. It worked once only.

                    • 7. Re: CX3 interfacing for MIPI yuv device
                      JayakrishnaT_76

                      Hello,

                       

                      After setting PMODE[2:0] = Z11, please download the firmware image to CX3 RAM. Now, you can see the device being enumerated as CX3 UVC in device manager. Next, open the host application and select the resolution. Please refer to the following snapshots to understand how this is done using AMCap.

                       

                      1. From the devices dropdown, select CX3-UVC

                       

                      2. From the Options drop down, select Video Capture Pin

                       

                      3. From the dialog box that pops up, select the supported resolution, press Apply and hit OK.

                       

                       

                      This will stream the video in the desired resolution and frame rate.

                       

                      Best Regards,

                      Jayakrishna

                      • 8. Re: CX3 interfacing for MIPI yuv device
                        JeCh_4640591

                        Hi Jayakrishna.

                         

                        I did the same setup as you told above. But the same problem is still observed.

                        The device is detected as 'CX3-UVC', but no preview frame is obtained. and the possible resolution is availble from 640x480.

                         

                        BTW, the device is always recognized as SUPER_SPEED even I connected into USB2.0 connector.

                        The problem comes from the same as below. glIsApplnActive & glMipiActive flag are not set to "TRUE".

                        Can you please tell me why the DMA

                         

                        status = CyU3PEventGet (&glCx3Event, evMask, CYU3P_EVENT_OR_CLEAR, &eventFlag, CYU3P_WAIT_FOREVER);

                                if (status == CY_U3P_SUCCESS)

                                {

                                CyU3PDebugPrint (4, "CY_U3P_SUCCESS\r\n");

                                    if (eventFlag & CX3_DMA_RESET_EVENT)

                                    {

                                    CyU3PDebugPrint (4, "CX3_DMA_RESET_EVENT\r\n");

                                        /* Frame timed out. Abort and start streaming again. */

                                        if (glIsApplnActive)

                                        {

                                        CyU3PDebugPrint (4, "glIsApplnActive\r\n");

                                            CyCx3AppStop();

                                        }

                                    CyU3PDebugPrint (4, "CyCx3AppStart\r\n");

                                        CyCx3AppStart();

                         

                        #ifdef RESET_TIMER_ENABLE

                                        CyU3PTimerStop (&Cx3ResetTimer);

                                        CyU3PTimerModify (&Cx3ResetTimer, TIMER_PERIOD, 0);

                        #endif

                                    }

                                    /* Handle Suspend Event*/

                                    if (eventFlag & CX3_USB_SUSP_EVENT_FLAG)

                                    {

                                    CyU3PDebugPrint (4, "CX3_USB_SUSP_EVENT_FLAG\r\n");

                                        /* Place CX3 in Low Power Suspend mode, with USB bus activity as the wakeup source. */

                                        CyU3PMipicsiSleep();

                                        CyCx3_ImageSensor_Sleep();

                                   

                                        status = CyU3PSysEnterSuspendMode (CY_U3P_SYS_USB_BUS_ACTVTY_WAKEUP_SRC, 0, &wakeReason);

                                        CyU3PDebugPrint (4, "\n\rEnterSuspendMode Status =  0x%x, Wakeup reason = 0x%x", status, wakeReason);

                                        if (glMipiActive)

                                        {

                                        CyU3PDebugPrint (4, "glMipiActive\r\n");

                                            CyU3PMipicsiWakeup();

                                            CyCx3_ImageSensor_Wakeup();

                                        }

                                    }

                                }

                         

                        FYI, After fixed PMODE pin issue, I could check RAM and SPI FLash download operations are OK, But I2C EEPROM mode is still not work.

                        • 9. Re: CX3 interfacing for MIPI yuv device
                          JayakrishnaT_76

                          Hello,

                           

                          The flags glIsApplnActive & glMipiActive are set to true when CyCx3AppStart() is called. This function will be called once you open the host application. Please share the complete UART debug logs so that I can understand the situation better.

                           

                          Regarding I2C boot, you need to set the PMODE pins to Z11 initially. Then in control center application, go to Program->FX3->I2C EEPROM and select the firmware image. The programming of EEPROM will take some time. After the control center shows programming of I2C EEPROM succeeded, you should change the PMODE[2:0] to F1F. Then press on the reset switch. This will make CX3 to boot the firmware from the EEPROM. I followed the same steps on the Denebola RDK and found that it was working fine. Please try this and let me know the result.

                           

                          Best Regards,

                          Jayakrishna