7 Replies Latest reply on Feb 4, 2020 2:22 AM by PhMi_4136011 Branched from an earlier discussion.

    Setup MIPI connection between CX3 and OV2740

    PhMi_4136011

      Hi Rashi,

      we did some progress since the last message:

       

      Fixed Cx3 Configuration utility -> language english needed.

       

      HSYNC and a VSYNC signals are available now for approximately 3-5 seconds (oscilloscope pictures attached)

       

      Therefore we edited the CyCx3AppImageSensorSetVideoResolution function (added CyU3PMipicsiReset(CY_U3P_CSI_HARD_RST); CyU3PMipicsiInit(); CyU3PMipicsiSetIntfParams (&null_RAW10_1080P, CyFalse); CyU3PMipicsiSetPhyTimeDelay (1,10); CyU3PMipicsiWakeup(); CyU3PMipicsiSetSensorControl (CY_U3P_CSI_IO_XRES, CyTrue); before the single streaming register was set)

       

      Currently the USB frame request stopps within the state machine either in State 5 or 7. There seems to be a Problem with the !FV Signal. Is this a configuration error with the number of lines/ blank lines ? I attached our current code.

       

      Debugg messages for state machine problem:

      KOLJA: CyCx3AppImageSensorSetVideoResolution started.

      KOLJA:     USB SuperSpeed chosen.

      KOLJA:     resolutionIndex set to: 1

      KOLJA:     switch case 0x01 (1080p) chosen.

      Kolja: Hard Reset

      Set the MIPI interface parameters

      KOLJA:     null_RAW10_1080P config loaded.

      KOLJA: PHY Delay successfully set to (1,10).

      KOLJA: Configuring 1080P Stream.

              Register 0x0100 (Streaming:1): 0

      KOLJA: Activated Camera (Streaming).

              Register 0x0100 (Streaming:1): 1

      KOLJA: Finished configuring 1080P Stream.

      KOLJA: MIPI Configuration on CX3:

              dataFormat: 1

              numDataLanes: 2

              pllPrd: 2

              pllFbd: 89

              pllFrs: 1

              csiRxClkDiv: 1

              parClkDiv: 1

              mClkCtl: 0

              mClkRefDiv: 2

              hResolution:-0

      KOLJA: Whole: 20201

      AplnStrt:SMState = 0x2

      KOLJA: Wake up call.

      KOLJA: MIPI Active.

      USB-Request: bRType = 0x2, bRequest = 0x1, wValue = 0x0, wIndex = 0x83, wLength= 0x0

      AplnStop:SMState = 0x7

      USB-Request: bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA    - Video Control Request

      USB-Request: bRType = 0xA1

       

       

      Kind regards,

      Philipp and Kolja

        • 1. Re:  Setup MIPI connection between CX3 and OV2740
          PhMi_4136011

          Hi,

          We also switched the Mipi bus to 16 bit and changed Fifo delays several times... still the same Problems within the state machine.

          Do we got a problem with fixed gpif blocks (8/16/24 bit) and the RAW10 bit format? like discribed in here https://community.cypress.com/docs/DOC-16964 .

          • 2. Re:  Setup MIPI connection between CX3 and OV2740
            PhMi_4136011

            hi,

            based on a different mipi receiver configuration and the generated code from the configurator, we did some progress. The frames in format RAW 10 seem to pass the state machine, as the following debug messages show:

             

            KOLJA: OV2740_RAW10_1080P initially loaded.

            KOLJA: PHY Delay successfully set to 0x08.

            KOLJA: Sensor reseted.

            Sensor Initialization

            Writing Configuration Settings:

            Register = 0x103: Value = 0x1

            .

            .

            .

             

            EnterSuspendMode Status =  0x0, Wakeup reason = 0x8

            Writing Configuration Settings:

            Register = 0x100: Value = 0x1

            Prod = 113 Cons = 113  Prtl_Sz = 35120 Frm_Cnt = 1 Frm_Sz = 4195328 B

            Prod = 113 Cons = 113  Prtl_Sz = 35120 Frm_Cnt = 2 Frm_Sz = 4195328 B

            Prod = 113 Cons = 113  Prtl_Sz = 35120 Frm_Cnt = 3 Frm_Sz = 4195328 B

            .

            .

            Prod = 113 Cons = 113  Prtl_Sz = 35120 Frm_Cnt = 29 Frm_Sz = 4195328 B

            Prod = 113 Cons = 113  Prtl_Sz = 35120 Frm_Cnt = 30 Frm_Sz = 4195328 B

            TimeDiff = 1007 ms FPS = 29

            .

            .

            1. Is the state machine working correctly now?

            The frame size seems to be correct since the sensor uses 8 H_blank and V_blank pixels -> 1928*1088*2 = 4195328.

             

            Problem: We still have a black screen and can't stream a Video signal in e-cam-viewer, guvcviewer etc.( because of the 10 bit Raw format?). We tried all edits in the cyfxuvcdscr.c like explained in:

             

            Streaming RAW10 Format Input Data to 16/24-bit Output Format in CX3 MIPI CSI-2 - KBA224387

            Re: CX3 configuration for OV5680 RAW10 format

             

            We could recognise the format changes to YUV2 in e-cam-viewer and guvcviewer, but didnt receive a single frame.

            2. Which Method would be the best to convert the Raw format to any uncompressed format like YUVY? Since we process the image data in python, we can convert them later on.

            • 3. Re:  Setup MIPI connection between CX3 and OV2740
              PhMi_4136011

              hi,

              by changing the GUID to YUY2 0X59,0X55,0X59,0X32 we were able to receive a single image (green one because of the raw format) with ubuntu 18.04 and guvcview. The stream stops immediately after one image and the cx3 board needs to be unpluged to reproduce an image, reset doesnt work. Additionally the images cant be streamed to windows (e-cam-viewer etc.).

               

              1. What could be the cause for the Linux - Windows difference?

              2. Why does the image stream crash immediately?

              • 4. Re:  Setup MIPI connection between CX3 and OV2740
                RashiV_61

                Hello Phillip,

                 

                Apologies for the late reply.

                 

                - The zip file you shared in previous response cannot be extracted. Can you send it in .rar format.

                - The RAW data sent through CX3 cannot be viewed using UVC host application like Amcap or e cam view.(you might see greenish color on the screen).

                - Can you let me know which windows version are you working on. Also probe the USB lines using wireshark and share the .pcap file.

                - Please confirm that you are using the default files generated by CX3 configuration utility as mentioned in this KBA Steps to Setup up MIPI CSI Camera Solution with CX3 – KBA225748

                - Also share the snippet of CX3 configuration tool (for checking the settings)

                 

                Regards,

                Rashi

                • 5. Re:  Setup MIPI connection between CX3 and OV2740
                  PhMi_4136011

                  hi,

                  we are working on Win10 (17763) and Ubuntu 18.04.  We are now using the default files generated by the configuration utility and edited the some functions in uvc.c (CyCx3UvcAppImageSensorSetVideoResolution) and in imagesensor.c (SENSOR_BaseConfigurationSettings, SENSOR_1080PConfigurationSettings) and added SensorReset function for GPIO reset. They are all marked with "@kolja".

                   

                  Additionally we uncommented:

                  #define SENSOR_DEBUG

                  #define CX3_DEBUG_ENABLED 1

                  #define RESET_TIMER_ENABLE 1

                  #define PRINT_FRAME_INFO

                   

                  As you said: - The RAW data sent through CX3 cannot be viewed using UVC host application like Amcap or e cam view.(you might see greenish color on the screen)

                  Windows is not displaying a green image, Ubuntu does.

                   

                  Wireshark:

                  I started capturing the USB-Devices and the plugged in the Camera and started streaming.

                   

                  Edit: I double checked Steps to Setup up MIPI CSI Camera Solution with CX3 – KBA225748  and realised we forgot to define CyCx3_ImageSensor_Sleep(), CyCx3_ImageSensor_Wakeup().

                  therefore i added

                  SENSOR_WriteConfigurationSettings_Reg8(SENSOR_WakeUpConfigurationSettings, configSize); with {0x0100, 0x01}

                  and

                  SENSOR_WriteConfigurationSettings_Reg8(SENSOR_SleepUpConfigurationSettings, configSize); with {0x0100, 0x00}

                   

                  We have still the same Problem.

                  • 6. Re:  Setup MIPI connection between CX3 and OV2740
                    RashiV_61

                    Hello Philipp,

                     

                    The CX3 configuration utility settings seems fine.

                    The frame size Frm_Sz = 4195328 B, as mentioned in previous response, doesn't match the frame size mentioned in the configuration utility settings.

                    According to you settings the frame size is 1920*1080*2(16 bits/pixel due to padding) = 4147200. You can refer this KBA for the calculation and difference between packing an padding.  Streaming RAW10 Format Input Data to 16/24-bit Output Format in CX3 MIPI CSI-2 - KBA224387

                    So, to check whether the data is coming proper or not, please probe the FV, LV and PCLK lines to know the time period of all the three. Please refer Q10 of this KBA CX3 Hardware: Frequently Asked Questions - KBA91295

                    Also share the debug prints you get when you start the application.

                     

                    Regards,

                    Rashi

                    • 7. Re:  Setup MIPI connection between CX3 and OV2740
                      PhMi_4136011

                      Hi Rashi,

                      Thanks for the fast replay. The stream is now wokring.

                      I changed the Pixels to 1928x1088, since The Framesize of the sensor seems 1928*1088*2(16 bits/pixel due to padding) = 4195328.

                       

                      I am now working on the raw conversion. I will close this Thread if the image isnt green any more.

                       

                      Thanks again!