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.

DM385: ISS camera restart after Resizer overflow failed.

Part Number: DM385
Other Parts Discussed in Thread: SYSCONFIG

Hi!

I have a cutom board running IPNC RDK 3.8.0.

The sensor we are using is AR0330.

When we are running camera + streaming everything ok. When adding linux program with lcd graphics soon we are getting resizer overflow.

I saw a lot of threads about overflow. This post is not about overflow removal(PBBPR=0xFFFF20 helps me to solve it).

There is camera restart try in the code. When overflow happens, ISS is disabled, reseted and should be started again.

But code is differs for sensors with parallel interface and CSI2 sensors.

Generally, the same code is used for regular startup and for startup after overflow.

- During regular startup sensor streaming is started (Iss_Ar0330EnableStreaming();) in a special place to complete csi2_wait_phy_reset() (just before it).

- When overflow happens ISS is reseted and this code is running again. Iss_Ar0330EnableStreaming() function enabling streaming but doesn't setup other registers. So at overflow moment sensor is still running and this function changes nothing.

- Sensor is running and no neccessary data/clock lane changes are happened and csi2_wait_phy_reset() just hangs.

- Moreover, during restart after overflow, function Iss_Ar0330EnableStreaming() is called form critical section (Task_disable() is called in Iss_captResetAndRestart()), and inside Iss_Ar0330EnableStreaming()  we have Task_sleep(200), which can't be called from critical section.

It seems that this code was not tested with CSI2 sensor.

To avoid code hang and complete csi2_wait_phy_reset() during restart I'd added Iss_Ar0330StopStreaming function and removed Task_sleep() with long loop.

It allowed me to complete csi2_wait_phy_reset() but camera capture not resumed at this point, and I don't know what to do next..

Could IPNC team help me to get stable camera restart?

Thank You.

  • Hi,

    For IPNC development questions we recommend you contact our partner:

    e2e.ti.com/.../660418

    Thank you
    Cesar
  • Hi,

    we  had the same problem. It seems, there are a lot of bugs there:

    1. The ISP reset in Iss_captResetAndRestart() doesn't work.  I implemented it exactly  according to the manual. With this implementation the ISP reset will be done :

        /*Set  ISP5_SYSCONFIG.STANDBYMODE = 2 (smart standby) - bits 4..5*/
        isp_regs->ISP5_SYSCONFIG  &= 0xFFFFFFCF;
        isp_regs->ISP5_SYSCONFIG  |= 0x2;

        /*Set ISP5_CTRL.MSTANDBY to 1. - bit 24*/
        isp_regs->ISP5_CTRL |= 0x1000000;

        /*Poll for ISP5_CTRL.MSTANDBY_WAIT = 1. - bit 20*/
        while ((isp_regs->ISP5_CTRL & 0x100000) == 0);

        /*Then, the soft reset can be applied (ISP5_SYSCONFIG.SOFTRESET = 1).*/
        isp_regs->ISP5_SYSCONFIG |= 0x2;

        /*wait until reset is done*/
        while ((isp_regs->ISP5_SYSCONFIG & 0x2) != 0);

    2. in issDrvRawToYuvConfig() one line is commented out:

        // pIssCsi2Config.timing_io = &csi2TimingDefaultParams;

     it means, that this timing_io pointer is undefined( random value) , because pIssCsi2Config is defined as local variable on stack. And it leads to unexpected behaviour in csi2_config().

    But it will also not work, if you comment it in again. because of chain of bugs.

    To have it short: i got it running by commenting out following block in csi2_config():

    #if 0   /*EKR: comment this block out. It didn't work anyway:    csi2_config_timing() didn't work because of invalid timing_io structure,
             and following functions don't work, because csi2_config_timing() returned always CSI2_FAILURE*/


        /* Configuration of CSI2 timing register */
        if (retval != CSI2_FAILURE)
            retval = csi2_config_timing(device_num, (aConfig->timing_io));

        /* Find out the number of contexts supported by the module in H/W and
         * ensure oen does not exceed this limit */
        number_of_contexts =
            CSI2_FEXT(csi2_regs->CSI2_GNQ, CSI2_GNQ_NBCONTEXTS_SHIFT,
                      CSI2_GNQ_NBCONTEXTS_MASK);

        /* Setting the context info */

        regval = (uint32) aConfig->context_set_flag;

        for (ctr_context = 0; ctr_context < number_of_contexts; ctr_context++)
        {
            /* Find out whether the context is to be configured */

            on_off = (CSI2_CONTROL_FEATURE_BIT_T) (regval & (0x00000001));
            regval = regval >> 1;

            if (on_off == CSI2_ENABLED_BIT && retval != CSI2_FAILURE)
                retval =
                    csi2_config_context(device_num, ctr_context,
                                        aConfig->ctx_cfg_ptr_array[ctr_context]);
        }

        /* configuring the global interrupts for CSI2, Complex i/o and Context
         * interrupts */
        regval = (uint32) aConfig->csi2_irq_enable;

        for (ctr_global_irq = 0; ctr_global_irq < MAX_CSI2_GLOBAL_INTERRUPTS;
             ctr_global_irq++)
        {
            /* Find out whether the context is to be configured */
            on_off = (CSI2_CONTROL_FEATURE_BIT_T) (regval & (0x00000001));
            regval = regval >> 1;

            if ((on_off == CSI2_ENABLED_BIT) && (retval != CSI2_FAILURE))
                retval =
                    csi2_config_global_interrupt(device_num,
                                                 (CSI2_GLOBAL_INTERRUPT_ID_T)
                                                 ctr_global_irq, on_off);

        }
    #endif

    Best regards,

    Eduard

  • Thanks, Eduard!

    I will try it soon .
  • Eduard,

    I'd made changes but this doesn't help me.

    issdrv_captureApi.c:
    ..........
    /* Reset the ISP h/w */

    #if 0 //original variant
    isp_regs->ISP5_SYSCONFIG |= 0x2;
    for (delay = 0u; delay < ISS_CAPT_RESET_DELAY; delay ++);
    while (isp_regs->ISP5_SYSCONFIG & 0x2 == 0x1);
    #endif
    #if 1
    /*Set ISP5_SYSCONFIG.STANDBYMODE = 2 (smart standby) - bits 4..5*/
    isp_regs->ISP5_SYSCONFIG &= 0xFFFFFFCF;
    isp_regs->ISP5_SYSCONFIG |= 0x2;

    /*Set ISP5_CTRL.MSTANDBY to 1. - bit 24*/
    isp_regs->ISP5_CTRL |= 0x1000000;

    /*Poll for ISP5_CTRL.MSTANDBY_WAIT = 1. - bit 20*/
    while ((isp_regs->ISP5_CTRL & 0x100000) == 0);

    /*Then, the soft reset can be applied (ISP5_SYSCONFIG.SOFTRESET = 1).*/
    isp_regs->ISP5_SYSCONFIG |= 0x2;

    /*wait until reset is done*/
    while ((isp_regs->ISP5_SYSCONFIG & 0x2) != 0);
    #endif
    Iss_reInit(NULL);


    Also, commented code in csi2.c that was skipped due to csi2_config_timing retval

    May be You did some other changes?

    Thanks.
  • Eduard, I found some other missed code.

    In Iss_captStart is some MIPI specific code, that are missed in Iss_captResetAndRestart.

    #ifdef USE_MIPI_MODE
    isif_reg->CGAMMAWD = 0x7708;
    iss_regs->ISS_CTRL &= ~0x0000000C;//select CSI2 or parallel
    csi2A_regs->CSI2_CTRL |= 0x00000800;
    isp_regs ->ISP5_CTRL |= 0x00C00000;
    #endif

    So, parallel interface was set by default after ISS reset.
    With this addition capturing/streaming is restarted successful, but only once.

    After second overflow, capture statistics keep going but in network stream I see looping picture(~5-10 frames)..

    To check overflow reaction I am forcing overflow by setting RESIZER fract div t0 0xD000.
    devmem2 0x5C010414 w 0x0000D000

    After second overflow no more overflows by changing fract.div happened.. Something gots broken..

  • Hi Dmitry,

    i have this missed code in my version of Iss_captresetAndRestart. I did some more changes in issdrv_captureApi.c. I suggest you write me your email and i'll send you my version of issdrv_captureApi.c.

    regards,

    Eduard

  • Eduard,

    sorry for delay.

    my email: bodnya.d@gmail.com

    Thank You.