This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: Using OV5640 Camera in TI-RTOS with VIP

Part Number: AM5728

Hi,

I want to make OV5640 Camera Operate with TI-RTOS using VIP subsytem.

Inspecting the TI-RTOS SDK, I found that there is an example for each of:

1- Capturing from Camera using VIP (pdk_am57xx_1_0_16/packages/ti/drv/vps/examples/vip/captureVip)

2- Capturing from Camera using VIP and Displaying it (pdk_am57xx_1_0_16/packages/ti/drv/vps/examples/loopback)

But none of these examples work with OV5640.

Inspecting the loopback example, I found that the most similar Camera to OV5640 is OV2659 which is already supported in TI_RTOS SDK.

Question: Is that similarity correct? (I could not find OV2659 datasheet, I would be thankful to give me its link if it's publicly available)

Inspecting Loopback example, I guess that to add support for OV5640 so that I can show its captured data on dispaly using Loopback example, I must add an OV5640 driver in (pdk_am57xx_1_0_16/packages/ti/drv/vps/src/devices) which must be compatible with FVID2 and finally add an entry for it in Loopback example.

Question: Is my guess right Or I need to do more things?

Question: are there any OV5640 camera driver developed for TI-RTOS?

Thanks in advance

  • Hello, 

    I looked up sensor devices on OV website, and noticed OV2659 was replaced with OV2680. I also did not find the OV5640, but OV5645 seems to be close. It seems that OV2680 is using 1 lane, while the OV5645 is using 2 lanes. 

    So the first thing you need to do is to customize the video capture driver so you can capture properly. Please give a try with the following user guide:

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Foundational_Components/Kernel/Kernel_Drivers/Camera/CAL.html

    There are also some troubleshooting utils to confirm if the device tree binding is successful or not; upon success, you shall be able to capture to a file as instructed. 

    Then you can retry the FVID2 based loopback example. I suspect most effort will be on getting the capture driver customized.  

    Regards

    Jian

  • I will move the ticket to closed please reopen if you run into additional issues. 

  • Hello,

    I developed an OV5640 driver which is FVID2-compatible to be able to integrate it with loopback example available in TI RTOS SDK... Now I can get the video but the colors are somehow not good ... the attachment is the picture taken by cellphone from IDKAM572x screen. What setting is wrong that the output is like this?? I changed many settings but none of them worked:

    OV5640 Setting set by I2C:

    {0x4300,  0x32, 0},  //YUV 422, UYVY
    {0x501f,  0x00, 0},  //YUV 422

    UserApplication Settings in loopback example:

            /* captStandard */
            FVID2_STD_720P_60,
            /* dispStandard */
            {
                FVID2_STD_CUSTOM,
            },

            FVID2_VIFM_SCH_DS_HSYNC_VSYNC,           /* captVideoIfMode */
            FVID2_VIFW_8BIT,                         /* captVideoIfWidth */
            FVID2_SF_PROGRESSIVE,                    /* captScanFormat */
            FVID2_DF_YUV422I_UYVY,                   /* captInDataFmt */           
            FVID2_DF_YUV422I_UYVY,                   /* captOutDataFmt */
            LPBK_APP_SC_DISABLE_ALL,                 /* captScEnable */
            1280U,                                   /* captInWidth */
            720U,                                    /* captInHeight */
            1280U,                                   /* captOutWidth */
            720U,                                    /* captOutHeight */

            1280U,                                   /* dispInWidth */
            720U,                                    /* dispInHeight */
            LPBK_APP_USE_LCD_WIDTH,                  /* Target width */
            LPBK_APP_USE_LCD_HEIGHT,                 /* Target Height */

    Thanks

  • good to hear that you can see the live loopback is working with your sensor device.

    seems chroma format get mixed up. can you check if both CAL and DSS is using YUV422 packed format of UYVY as the driver's native format?

    if no issues, can you try just capture to a file, use the yavta utility as example in Section 3.3.4.5.6.2 on:

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Foundational_Components/Kernel/Kernel_Drivers/Camera/CAL.html

    if you can capture to a file, then use an offline YUV viewer to verify if you seeing the same issue or a real image. 

    thanks

    Jian

  • Hi,

    I used the captureVip example available in TI RTOS SDK to capture a video and store it in SD card... using Vooya, i.e. offline YUV viewer, the result is still the same with bad output color... I guess this means the problem is either with camera configurations or the VIP configurations ... Am I right?

    back to previous scenario, In loopback example, I'm using the changes in attachment for my test:

    ***ov5640Settings.txt: it contains instructions sent to camera via I2C to configure 720P-YUY422-UYVY ... more specifically

    {0x4300,  0x32, 0},  //YUV 422, UYVY
    {0x501f,  0x00, 0},  //YUV 422

    ***Changes_in_loopback_main.c: it adds an entry to loopback_main.c for my test

    ***Changes_in_loopback_test.c: my changes to loopback_test.c ... specified by MY_CHANGES comment in file

    one important thing is that when I enable test pattern on ov5640, I get the pattern right with no bad output color ... test pattern picture taken by my cellphone from IDKAM572x screen is in attachment

        {0x503d, 0x82, 0},  //test pattern
        {0x4741,  0x00, 0}, //test pattern

    Question: what could be the problem base on my changes that make the output not having good colors?? I tried many things but none of them worked ...

    I guess answering my question will help other TI users to integrate a new camera with TI RTOS SDK

    Thanks in advance ...4743.attachment.zip

  • Hi,

    Any idea about my latest post?

    the test pattern colors are correct i.e. back, green and etc bars BUT the video has the same issue

  • To your earlier question:

       >I guess this means the problem is either with camera configurations or the VIP configurations ... Am I right?

    yes. We can focus on getting the capture in the right format. Could you share the captured YUV files, for both the live video and sensor-generated test pattern?  Also can you share you DTS file and kernel log?

    thanks

    Jian

  • Hi,

    I'm doing my tests on TI-RTOS, Not Linux, so I don't use device tree.

    Here is the memory dump of the first frame for test pattern... I have only send you the first line of the frame in attachment

    And here is the picture taken by my cellphone from IDKAM572X screen (as you can see colors are shown properly):

    My settings for camera and Loopback example was YUV422-UYVY 720P (1280*720) and the test pattern has 8 bars (black, red, blue, ...., white) of equal size, so each bar would be 1280/8=160 pixels ... as YUV422 uses 2 bytes for each pixel, so each bar would be 160*2=320 bytes of data ... as you can see in the attached file, each bars data is also 320bytes (I have annotated it in file) .... It shows that when I ask camera to send me test pattern data, It sends it correctly and RTOS Loopback example shows it properly as well, But when I ask the camera to send a live video, It will send me frames of like the one I sent you previously (you said the problem might be chroma mixed)

    Base on my tests, I guess that the camera is not configured properly to send me videos of YUV422-UYVY 720P at 60fps

    Searching Internet for OV5640 documents, I found some not very good document with some reference settings that none of them fixed the issue... I also tried some reference settings from Linux drivers which did not fix the issue

    Question: Do you have any tested register reference settings or good document for OV5640 that I can use to test whether the issue is with camera configuration or not?

    For the first try, I want the OV5640 register configurations to work like these settings:

     {
            "OV5640            -> VIP2_S1_PORTB (720P@60FPS)  -> UYVY422      -> DSS Video1 -> DPI1 LCD",
            1U,                                         /* numCaptHandles */
            1U,                                         /* numDispHandles */
            /* captInstId[] */
            {
                VPS_CAPT_VIP_MAKE_INST_ID(VPS_VIP2, VPS_VIP_S1, VPS_VIP_PORTB),
            },
            /* dispInstId[] */
            {
                VPS_DISP_INST_DSS_VID1
            },
    
            /* decDrvId[] */
            {
                FVID2_VID_SENSOR_OV5640_DRV,
            },
            /* encDrvId[] */
            {
                FVID2_LCD_CTRL_DRV,
            },
            /* vencId */
            {
                VPS_DCTRL_DSS_VENC_LCD1
            },
            FALSE,                                      /* isSdVenc */
            /* captStandard */
            FVID2_STD_720P_60,
    
            /* dispStandard */
            {
                FVID2_STD_CUSTOM,
            },
    
            FVID2_VIFM_SCH_DS_HSYNC_VSYNC,           /* captVideoIfMode */
            FVID2_VIFW_8BIT,                         /* captVideoIfWidth */
    
            FVID2_SF_PROGRESSIVE,                    /* captScanFormat */
            FVID2_DF_YUV422I_UYVY,                        /* captInDataFmt */
            FVID2_DF_YUV422I_UYVY,                   /* captOutDataFmt */ //Mehran Memarnejad
    
            LPBK_APP_SC_DISABLE_ALL,                 /* captScEnable */
            1280U,                                   /* captInWidth */
            720U,                                    /* captInHeight */
            1280U,                                   /* captOutWidth */
            720U,                                    /* captOutHeight */
    
            1280U,                                   /* dispInWidth */
            720U,                                    /* dispInHeight */
    
            LPBK_APP_USE_LCD_WIDTH,                  /* Target width */
            LPBK_APP_USE_LCD_HEIGHT,                 /* Target Height */
    
            LPBK_APP_RUN_COUNT,                      /* runCount */
            BSP_BOARD_MODE_VIDEO_8BIT,               /* captBoardMode */
            BSP_BOARD_MODE_DEFAULT,                  /* dispBoardMode */
            /* boardId */
            (BSP_BOARD_UNKNOWN | BSP_BOARD_IDK_AM57XX)
        },

    Thanks

    Attachment: memory dump of first line of first frame for test pattern captured by using Code composer memory save:

    3223.fisrtFrame_firstLine_testPattern_data_from_memoryDump.txt
    1651 9 81700000 0 1e8480 0
    //OV5640 Camera was set to generate YUV422-UYVY 720P
    //Here is the first line of the first frame for test pattern
    //Bar1
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80
    DF80DF80DF80DF80  
    
    DB85DF55DF80DF80
    
    //Bar2
    D19FD100D19BD400  
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    D19FD100D19FD100
    
    CE13C300D19FD100
    
    //Bar3
    C500C593C800C94B
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    C600C693C600C693
    
    C100C64DC600C693
    
    //Bar4
    9600960096009900
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    9600960096009600
    
    820FC30896009600
    
    //Bar5
    4DDF4DDF47DF16DF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    4EDF4EDF4EDF4EDF
    
    4ADF4EDF4EDF4EDF
    
    //Bar6
    1EDF1E4C1EDF4391
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    1EDF1E4C1EDF1E4C
    
    03D1149D1EDF1E4C
    
    //Bar7
    135E13DF165A18DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    134013DF134013DF
    
    104313DF134013DF
    
    //Bar8
    04800480045B0889
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    0480048004800480
    
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    1010101010101010
    
    //Now the second Line comes with the same data as first line

  • Hi,

    There was a problem with cables ... fixed