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.

RTOS/AM5728: TI-RTOS: Use External Camera Sensor API to Drive AR0132

Part Number: AM5728

Tool/software: TI-RTOS

Hi

I used External Camera Sensor API to drive ar0132 at TI-RTOS project. But there were some wrong when debug into Fvid2_create function, the whole initial function is pasted bellow:

int cr_vin2a_initial_bsp(Fvid2_Handle *fvid2handle)
{
// Typicall API calling sequence for video decoder in context of video capture application would be like below
//
// Fvid2_create() - create the sensor driver instance and take the sensor to standby
// IOCTL_BSP_VID_SENSOR_GET_CHIP_ID - check if device is active
// IOCTL_BSP_VID_SENSOR_GET_FEATURES - To get the sensor information and support
// IOCTL_BSP_VID_SENSOR_SET_CONFIG - setup the device for a particular mode
// Fvid2_start() - Start sensor
// Fvid2_stop() - Take sensor to standby
// Fvid2_delete() - delete sensor driver device
// Delete the capture driver
 int rtn =0;
 Fvid2_Handle fvid2Handle;
 Bsp_VidSensorCreateParams crtParams;
 Bsp_VidSensorConfigRegs crtParamsCfgReg;
 Bsp_VidSensorCreateStatus crtStatus;
 Bsp_VidSensorChipIdParams chipidParams;
 Bsp_VidSensorChipIdStatus chipidStatus;
 Bsp_VidSensorFeatures features;
 Bsp_VidSensorConfigParams cfgParams;

 crtParams.deviceI2cAddr[0] = 0x10;
 crtParams.deviceI2cInstId = 4;//IC5
 crtParams.deviceResetGpio[0] = BSP_VID_SENSOR_GPIO_NONE;
 crtParams.numDevicesAtPort = 1;
 crtParams.numSensorCfg = 1;
 crtParams.sensorCfg = &crtParamsCfgReg;
 crtParamsCfgReg.regAddr = 0x3140;
 crtParamsCfgReg.regMask = 0xFFFF;
 crtParamsCfgReg.regValue = 0x0001;
 chipidStatus.chipId = 0;
 chipidStatus.chipRevision = 0;
 chipidStatus.firmwareVersion = 0;
 fvid2Handle = Fvid2_create( FVID2_VID_SENSOR_APT_AR0132_DRV,
 0,
 &crtParams,
 &crtStatus,
 NULL);
 fvid2handle = &fvid2Handle;
 chipidParams.deviceNum = 1;
 Fvid2_control( fvid2Handle,
 IOCTL_BSP_VID_SENSOR_GET_CHIP_ID,
 &chipidParams,
 &chipidStatus);
 Fvid2_control( fvid2Handle,
 IOCTL_BSP_VID_SENSOR_GET_FEATURES,
 &features,
 NULL);
 cfgParams.bpp = FVID2_BPP_BITS12;
 cfgParams.dataformat = FVID2_DF_RAW12;
 cfgParams.fps = FVID2_FPS_5;
 cfgParams.height = 720;
 cfgParams.width = 1280;
 cfgParams.standard = FVID2_STD_AUTO_DETECT;
 cfgParams.videoIfWidth = FVID2_VIFW_12BIT;
 Fvid2_control( fvid2Handle,
 IOCTL_BSP_VID_SENSOR_SET_CONFIG,
 &cfgParams,
 NULL);
 rtn = Fvid2_start(fvid2Handle,NULL);
 return rtn;
}

Could anyone help me to find the mistakes?
I know there are some examples in pdk,but it's pretty complex cause so many stream and channels are used in the example. But I just want to drive only AR0132(mono mode) in my project.
  • The RTOS team have been notified. They will respond here.
  • Errors occurs when debug to Fvid2_create() :
    errors:

    No source available for "do_AngelSWI(int, void *)

    CortexA15_0: Unhandled ADP_Stopped exception 0x20023;

    related disammbly codes:

    do_AngelSWI():
    8001f79c: 159F501C ldrne r5, [pc, #0x1c]
    8001f7a0: E1A00004 mov r0, r4
    8001f7a4: E1A01005 mov r1, r5
    8001f7a8: EF123456 svc #0x123456
    8001f7ac: E1A04000 mov r4, r0
    8001f7b0: E1A00004 mov r0, r4
    8001f7b4: E8BD4030 pop {r4, r5, lr}
    8001f7b8: E12FFF1E bx lr
    8001f7bc: 00020023 andeq r0, r2, r3, lsr #32
    8001f7c0: 00020026 andeq r0, r2, r6, lsr #32
    8001f7c4: 00000000 andeq r0, r0, r0

    all the codes pasted below:
    ------------------------my codes start-------------------------
    typedef struct
    {Fvid2_Handle fvid2Handle;
    Bsp_VidSensorCreateParams crtParams;

    Bsp_VidSensorConfigRegs crtParamsCfgReg;
    Bsp_VidSensorCreateStatus crtStatus;

    Bsp_VidSensorChipIdParams chipidParams;
    Bsp_VidSensorChipIdStatus chipidStatus;

    Bsp_VidSensorFeatures features;
    Bsp_VidSensorConfigParams cfgParams;
    }appVps;

    VpsDriver appVps;
    int main(void)
    {
    /* Call board init functions */
    Board_initGPIO();

    #if defined(idkAM574x) || defined(idkAM572x) || defined(idkAM571x)
    AppGPIOInit();
    #endif
    cr_vin2a_initial_bsp(&appVps);
    /* Start BIOS */
    BIOS_start();
    return (0);
    }

    int cr_vin2a_initial_bsp(VpsDriver *vpsInit)
    {
    int rtn =0;
    Bsp_VidSensorCreateParams *pCrtParams;
    Bsp_VidSensorCreateStatus *pCrtStatus;
    Bsp_VidSensorChipIdParams *pChipIdParams;
    Bsp_VidSensorChipIdStatus *pChipIdStatus;
    Bsp_VidSensorFeatures *pFeatures;
    Bsp_VidSensorConfigParams *pCfgParams;

    pCrtParams = &vpsInit->crtParams;
    pCrtParams->deviceI2cAddr[0] = 0x10;
    pCrtParams->deviceI2cInstId = 4;//IC5
    pCrtParams->deviceResetGpio[0] = BSP_VID_SENSOR_GPIO_NONE;
    pCrtParams->numDevicesAtPort = 1;
    pCrtParams->numSensorCfg = 1;
    pCrtParams->sensorCfg = &vpsInit->crtParamsCfgReg;
    pCrtParams->sensorCfg->regAddr = 0x3140;
    pCrtParams->sensorCfg->regMask = 0xFFFF;
    pCrtParams->sensorCfg->regValue = 0x0001;

    pCrtStatus = &vpsInit->crtStatus;

    vpsInit->fvid2Handle = Fvid2_create( FVID2_VID_SENSOR_APT_AR0132_DRV,
    VPS_CAPT_VIP_MAKE_INST_ID(VPS_VIP1,VPS_VIP_S1,VPS_VIP_PORTA),
    pCrtParams,
    pCrtStatus,
    NULL);
    pChipIdParams = &vpsInit->chipidParams;
    pChipIdParams->deviceNum = 1;
    pChipIdStatus = &vpsInit->chipidStatus;
    Fvid2_control( vpsInit->fvid2Handle,
    IOCTL_BSP_VID_SENSOR_GET_CHIP_ID,
    pChipIdParams,
    pChipIdStatus);

    pFeatures = &vpsInit->features;
    Fvid2_control( vpsInit->fvid2Handle,
    IOCTL_BSP_VID_SENSOR_GET_FEATURES,
    pFeatures,
    NULL);

    pCfgParams = &vpsInit->cfgParams;
    pCfgParams->bpp = FVID2_BPP_BITS12;
    pCfgParams->dataformat = FVID2_DF_RAW12;
    pCfgParams->fps = FVID2_FPS_5;
    pCfgParams->height = 720;
    pCfgParams->width = 1280;
    pCfgParams->standard = FVID2_STD_AUTO_DETECT;
    pCfgParams->videoIfWidth = FVID2_VIFW_12BIT;

    Fvid2_control( vpsInit->fvid2Handle,
    IOCTL_BSP_VID_SENSOR_SET_CONFIG,
    pCfgParams,
    NULL);

    rtn = Fvid2_start(vpsInit->fvid2Handle,NULL);

    return rtn;
    }
    ------------------------my codes over-------------------------
  • Hi,

    Please try to use the latest Processor SDK RTOS 5.0 release for this effort. Also, do you use TI AM571/2/4x IDK or AM572x GP EVM or your customized board for this integration?

    Have you tried the existing VIP capture or VPS loopback examples to understand the callflow?

    There are some training document under: pdk_am57xx_1_0_11\packages\ti\drv\vps\docs\training, at least:
    FVID2_init
    –Initializes the drivers and the hardware. Should be called before calling any of the FVID2 functions

    VPS is a very complicated driver, you may need to step/look through the existing work cases before porting a different camera sensor.

    Regards, Eric
  • Thanks for reply. Following you advice I added FVID2_init before FVID2_create and some problems are solved. But the Fvid2_Handle is still NULL after Fvid2_create functions. I have some questions about VPS: 1. I haven't find any FVID2_init in the example "vps_loopbackExample_idkAM572x_armExampleProject" offered within PDK(pdk_am57xx_1_0_11), are you team sure that it can be run successfully on IDKAM572x? 2. In the html "C:/ti/pdk_am57xx_1_0_11/packages/ti/drv/vps/docs/doxygen/html/group___b_s_p___d_r_v___d_e_v_i_c_e___v_i_d___s_e_n_s_o_r___a_p_i.html", one table below the line "Creating the driver - Fvid2_create()" shows how to use Fvid2_create(), the second parameter "instanceId" is set to 0,but how do the driver know which port does my AR0132 connects to?The fifth parameter "cbParams" is set to NULL, is that means i can't use the frame callback function when the drvId is set to FVID2_VID_SENSOR_APT_AR0132_DRV ? 3.Is there any examples for EVMAM572x?
  • Hi,

    Q1. This is called deep inside: main---------->LpbkApp_init--------->BspUtils_appDefaultInit-------------->Fvid2_init

    Q2/Q3: There is VPS loopback examples on AM572x GP EVM, just no CCS project. We have CCS project for VPS loopback for IDK EVM only. You have two approaches to test GP EVM:
    1) from the top level, use "make vps", this will build the VPS test application, including the loopback for GP EVM
    2) See the software-dl.ti.com/.../Device_Drivers.html, topic How to create a CCS project other than VPS loopback example? You can try to create a CCS project for this.

    Regards, Eric
  • Thank you.I created a loopback example for evmAm572x and it works.I will study this loopback project and created my own project which AR0135 sensor is used.
  • Part Number: AM5728

    Tool/software: TI-RTOS

    Hi I created an loopback example for my evmAM572x board and it works. And I wrote my own vin2a initial function with Fvid2_init inside firstly, The problem is that I got fvid2Handle null after Fvid2_create, but fvid2Handle is returned successfully when I put my function after LpbkApp_init(appObj) in the loopback project.(with Fvid2_init is commented cause i know Fvid2_init is already contained in the LpbkApp_init->BspUtils_appDefaultInit). Question 1. Is there any other functions (except from Fvid2_init) that must be added before Fvid2_create? Quextion 2. The function BspUtils_appDefaultInit in 'ti\drv\vps\examples\utility\src\bsputils_app.c' contains VpsInitParams_init and Vps_init.Is these what I need before Fvid2_create? And where are these 2 function declared?
  • Now i found vps_init and added VpsInitParams_init and vps_init after fvid2_init. But error occurs when run to vps_init: No source available for "do_AngelSWI(int, void *).
    My project is copied from rtos teplate a15 and initialization order list as follows:
    --------------------------------------------------------------

    main()
    {
    Int32 retVal = BSP_SOK;
    Vps_InitParams vpsInitPrms;

    Board_initCfg boardCfg;
    int status;
    System_atexit(appExitFunction);
    boardCfg =
    #ifndef SBL_BOOT
    BOARD_INIT_PINMUX_CONFIG |
    //BOARD_INIT_MODULE_CLOCK |
    #endif
    BOARD_INIT_UART_STDIO;
    status = Board_init(boardCfg);
    if (status != BOARD_SOK)
    {
    appPrint("\n Init Board: ERROR.\n");
    }
    else
    {
    appPrint("\n Init Board: OK.\n");
    }
    //unfolding peripheralInit
    UART_init();
    I2C_init();
    GPIO_init();
    MCSPI_init();
    retVal = Fvid2_init(NULL);
    VpsInitParams_init(&vpsInitPrms);
    vpsInitPrms.irqParams.vipIrqNum[0U] = CSL_INTC_EVENTID_VIP1INT0;
    vpsInitPrms.irqParams.vpeIrqNum = CSL_INTC_EVENTID_VPEINT0;
    retVal = Vps_init(&vpsInitPrms);

    //my vin2a initial function unfolding
    Fvid2_create
    ..................
    //
    appTasksCreate();
    BIOS_start();
    return (0);
    }
    ///////////////main code over//////////

    Now the problem is that an error occurs at Vps_init: No source available for "do_AngelSWI(int, void *).
    Is there any mistake and where?
  • Hi,

    I traced the function calls before:

     

    LpbkApp_init

    BspUtils_appDefaultInit

    BspCommonInitParams_init(empty func)

     

     

     

     

     

     

     

    Bsp_commonInit

    BspUtils_init (empty func)

     

     

     

     

     

     

    BspBoardInitParams_init (empty func)

     

     

     

     

     

     

     

    Bsp_boardInit

    Bsp_boardAm572xInit

    Board_init with PINMUX and module_clock, no UART

     

     

     

     

     

    BspPlatformInitParams_init

     

     

     

     

     

     

     

    Bsp_platformInit

    Bsp_platformTda2xxInit

    Bsp_platformTda2xxXbarConfig

    Bsp_platformTda2xxEnableMcSPI1

    Bsp_platformTda2xxEnableI2C5

     

     

     

     

     

     

    Bsp_platformTda2xxGetCpuRev

     

     

     

     

     

     

     

    Bsp_platformTda2xxGetPackageType

     

     

     

     

     

     

    Fvid2_init

     

     

     

     

     

     

     

    VpsInitParams_init

     

     

     

     

     

     

     

    Vps_init

    vpsInitTda2xxPlatData (define VIP/slice/port instance)

     

     

     

     

     

     

     

    VpsLib_init

    VpsDrv_ctrlInit

    Vps_captInit

    Vps_dispInit

    VpsHal_init

    VpsHal_open

    Vps_commonInit

    Vps_captVipCoreInit

    Vps_dispCoreInit

    VpsHal_vpdmaOpen

     

     

     

     

     

    Bsp_boardGetI2cData

     

     

     

     

     

     

     

    I2C_init

     

     

     

     

     

     

     

    BspDeviceInitParams_init

     

     

     

     

     

     

     

    Bsp_deviceInit

     

     

     

     

     

     

     

    BspUtils_memInit

     

     

     

     

     

     

     

    BspUtils_prfInit

     

     

     

     

     

     

     

    BspUtils_appInit

     

     

     

     

     

     

     

    BspOsal_Init

     

     

     

     

     

     

     

    Bsp_platformPrintInfo

     

     

     

     

     

     

     

    Bsp_boardPrintInfo

     

     

     

     

     

     

    Fvid2_create

     

     

     

     

     

     

    You may check if anything missing in your call steps.

    Another thing is debug RTOS, see topic: 

    Regards, Eric

  • Thanks a lot!
    I succeed drving my sensor and captured frames using Fvid2 layer.
    But!!!
    I found that Fvid2_init will not succeed unless PRCMs of VIP1/2/3 and DSS are all enabled.
    What if only vin2a is used in my product? Obviously enabling VIP1/3 and DSS will increase the power consumption. So can i disabled other vip slices and dss after fvid_init?