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.

TDA2PXEVM: Configuring CSI2 registers for a specific data rate

Part Number: TDA2PXEVM
Other Parts Discussed in Thread: DS90UB954-Q1EVM

Hello all,

I am using the TDA2PXEVM together with the DS90UB954-Q1EVM and I have problems getting the setup to run with a CSI2 data rate of 800Mbps. Everything works fine for 400 Mbps, I am able to capture data and write it to the memory using the WRDMA of the CAL. The implementation is bare-metal. I am executing the CSI2 PHY Link initialization as per TRMv1.0, chapter 10.4.5.3. When PHY REG0/DS90UB954 are configured for a data rate of 800Mbps, then the STOPSTATE (point 2f of the init sequence) won't be reached and as a consequence the RESET_DONE of CAL_CSI2_COMPLEXIO_CFG will not be completed.

I am unsure if I configured the timings in REG0, REG1 of the PHY registers correctly:

For THS_TERM:

From the TRM: “Programmed value = floor(20 ns/DDR_CLK), where DDR_CLK is the period of the CSI-2 I/O lane rate. Default value: 4 (for 400 MHz).”

The default value is correct for a value of DDR_CLK=5ns (just looking at integer values), which would correspond to 200MHz. See questions at the end of the post.

 

For THS_SETTLE:

From the TRM: “Programmed value = floor(105 ns/DDR_CLK) + 4, where DDR_CLK is the period of the CSI-2 I/O lane rate. Default value: 39 (for 400 MHz).”

For the default value of 39, DDR_CLK would need to be between 3 and 3.0882, which corresponds to a value of around 333.3 MHz. See questions at the end of the post.

 

For TCLK_SETTLE:

From the TRM: “Programmed value = max[3, ceil(155 ns/CTRLCLK period) –1] Default value: 14 (for 96 MHz)”

The calculation is straight forward, though in the PDK the value is calculated by the following formula: “temp = (((Float32)260U / (Float32)DPHY_FUNCTIONAL_CLK_PERIOD) - (Float32)2U);”

This would mean a value of 22 instead of 14. See questions at the end of the post.

The calculation for TCLK_TERM is also different from what it is in the TRM, but in this case, both calculations lead to the same result.

 

For TCLK_DIV:

From the TRM: “Divide factor for CTRLCLK for CLKMISS detector Programmed value = ceil (15ns/CTRLCLK Period) – 1 Default value: 1 (for 96 MHz)

CLKMISS detection time = (5*TCLK_DIV+1)*(CTRLCLK period) < 60ns

Note: Only the CTRLCLK frequencies that satisfy above relationship are allowed. Typically, 96MHz will be used at CTRLCLK.”

Though with the default value of 1, the CLKMISS detection time is 62.5ns. See questions at the end of the post.

What was tested:

  • Using either the period of the data rate or actual clock (half of data rate) for the calculations of THS_TERM, THS_SETTLE. I have been informed via E-Mail, that the data rate shall be used for these calculation. For a data rate of 800 MBit/s, the following values are calculated:
  • Using period of data rate (1.25ns) for calculation Using period of clock(2.5ns) for calculation
    THS_TERM floor(20ns/1.25ns) = 16 floor(20ns/2.5ns) = 8
    THS_SETTLE floor(105ns/1.25ns)+4=84+4=88 floor(105ns/2.5ns)+4=42+4=46
  • Using the PDK's calculation of TCLK_SETTLE, which leads to a value of 22 instead of 14, in combination with both the above values.
  • Otherwise, standard values for TCLK_DIV(1) and TCLK_TERM(0) are used, for the standard control clock of 96MHz.
  • Monitoring the CSI2 clock lane with an oscilloscope, output is 400MHz, which is expected for a data rate of 800Mbit/s.

Questions:

  • Are there any other registers that have to be reprogrammed due to change in CSI2 data rate other than REG0 of the CSI2 PHY registers?
  • To double check: Is it correct to use the period of the data rate for the calculations of THS_TERM, THS_SETTLE?
  • For TCLK_SETTLE, TCLK_TERM: Should the calculations from the TRM or from the PDK be used?
  • Is it ok for TCLK_DIV to not fullfill the "CLKMISS detection time <60ns" requirement with the aforementioned calculation?

Notes:

  • File used from PDK (01_10_00_08) to compare the calculations: vpshal_calCsi2Tda2px.c
  • Calculations for the above 5 parameters is the same in TRM(Nov17) for TDA2PX and TRM(June18) for TDA3

Thank you,

Regards,

Tobias

  • Hi Tobias,

    The PDK CAL driver/receiver is been able to receive CSI2 streams from multiple sources (sensors / CSI2 HUB) with varying data rates (400, 800, 1600 Mbps).

    On the questions
    1. Yes, programming REG 0 should suffice
    2. To the best of my knowledge, THS_TERM and THS_SETTLE calculations seems correct. (The TRM might require an update, i will check on that)
    3. Please use the calculations provided in PDK
    4. I have not used TCLK_DIV, i have requested one of expert to comment on that (but the expert is on travel, please expect delay in response)

    Regards,
    Sujith
  • Hi Sujith,

    Thank you for getting back so quick!

    Today I tested some more with 800Mbit/s and found out, that I sometimes have try to initialize the PHY more often than once with the routine of the TRM, before the initialization exits successfully. I have not found consistent behavior yet. I am using either the period of the MIPI data rate (1.25ns) or the clock (2.5ns) for the calculation of THS_TERM and THS_SETTLE. Both appear to work and it mostly takes two tries to initialize the PHY. I have also tried to take different values in between 1.25ns and 2.5ns, and some also appear to work (mostly 2nd try).

    My sequence is:

    1. Configure the DS90UB954, but do not output any data yet
    2. CSI2 Init sequence on TDA2PX
      1. CAL Software reset
      2. PHY init sequence 1 to 2e of TRM
      3. Start MIPI output from DS90UB954
      4. Continue PHY init sequence of TRM
      5. Repeat until sequence finishes successfully. turn off DS90UB954 output.The Initialization sequence always times out, because the STOP_STATE cannot be reached
    3. Other CAL CSI2 settings (contexts, write DMA etc.)
    4. Start DS90UB954 output again
    5. Observe received data

    My main problem is, that there seems to be no consistency with how I initialize the CSI2 PHY, other than that it takes 2 tries most of the time. The values for THS_SETTLE and THS_TERM can be calculated quite differently, yet it takes two tries and data can be received afterwards. For 400Mbit/s it always works first try and I use the period of the data rate (2.5ns) for calculations there.


    Do you have any idea why there are these problems during initialization of the part? I'd like to achieve reproducable and consistent behavior during the initialization.

    Kind regards,

    Tobias

    Edit: Change wrong value in nano seconds in one of the brackets

  • Tobias,

    The equations listed in the latest TRM and implemented in the current software are the same.  DDRCLK used in THS_SETTLE and THS_TERM calculation represents the data rate clock period, as a result 2.5 ns should be used for 800 Mbps operation.  There was an update made on these two equations that caused the current disparities between the calculation results and the default values at 400 MHz.  When the TRM equations were updated for better margin across frequencies, default values --- calculated using the old equation --- were already hard-coded to these register fields and were thus not updated in conjunction.  Nonetheless, both sets of values will work for 400 MHz operation.

    For proper CSI2 operation, CLK has to be disabled on DS90UB954 before CAL PHY is powered up completely.

    Best Regards,

    Shiou Mei

  • Hi Shiou Mei,

    Thank you for clarifying the calculations. I will use the value of 2.5ns for the calculations @800Mbps (400MHz clock) now. These result in THS_TERM = 8 and THS_SETTLE = 46.

    Shiou Mei Huang said:
    For proper CSI2 operation, CLK has to be disabled on DS90UB954 before CAL PHY is powered up completely.

    This means I have powered on the CSI clock too early in the sequence. I changed it to this: 

    1. Configure the DS90UB954, but do not output any data yet
    2. CSI2 Init sequence on TDA2PX
      1. CAL Software reset
      2. Complete PHY init sequence of TRM
      3. Turn on MIPI output of DS90UB954 briefly
      4. Wait for CAL_CSI2_COMPLEXIO_CFG, bit RESET_DONE for reset completed. (MIPI clk has to be present for this according to TRM).
      5. Turn off MIPI output of DS90UB954

    3. Other CAL CSI2 settings (contexts, write DMA etc.)
    4. Start DS90UB954 output again
    5. Observe received data

    This way, the PHY gets initialized properly every time. Thank you for your help!

    Kind regards,

    Tobias