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.

OPT3101: Different datarate takes different time until DATA_RDY trigerred.

Part Number: OPT3101

I have a question about the behavior of the OPT3101 measurement.
When I start measurement, I write the necessary settings to the registers and enable TG_EN and EN_TX_CLKB.
It may take a little time from the start of measurement until data ready, but there is a difference between the behavior when the data rate is set to 10Hz (NUM_SUB_FRAMES=399) and 100Hz (NUM_SUB_FRAMES=39). In the case of 100Hz, it takes about 0.9 seconds more than in the case of 10Hz from the starting trigger until the data is ready.
For example, if you measure for 10 seconds at 100 Hz, you will lose 0.9 seconds of data and receive only 910 data when you expected to receive 1,000 data. But if you measure for 10 seconds at 10 Hz, you will receive 100 data which is exactly the expected amount. Of course, the timing of the start of the measurement may need to be discussed, but before we get there, it would be appreciated if you could give me some idea or explanation of this phenomenon.

Data ready trigger timing, datasheet P.15

  • Hello Moses,

    This is not expected results.  Are you able to share the data taken?

    Rahland

  • Here is the data.

    100Hz data:
    https://drive.google.com/file/d/10VdV534tDV7M8tFKSn4-vw02C9H7Nrx7/view?usp=share_link

    10Hz data:
    https://drive.google.com/file/d/10QIC3D_MDuvD3jQMcrDmgh1llWeuUtOF/view?usp=share_link

    I took data for around 10 secs by pushing start and stop button manually.
    The 10Hz log has 104 data and the 100Hz log has only 994 data.
    I hope the data helps.

    For confirmation, this is the Python coce of register setting.
    (please ignore the function calls, just look at the setting value)

    averageFrames = 2**average_exp # This is the number of frames that will be averaged before data ready is generated. Ex: 2**8 means device would run at 2000/2**8=7.8125 samples/second in HDR Mode
    waitTime = averageFrames*1.0/2000  # This is time between data ready signals. 
    xtalkFilterTau = int(math.ceil(10 - math.log2(averageFrames))) # This is the crosstalk filter time constant
    
    hdrThresholdH = int(27000)
    hdrThresholdL = int(hdrThresholdH/4.8-500.0)
    
    refFreq = ref_clk #Reference CLK frequency from MSP430
    sysClkDiv = int(round(math.log2(40.0e6/refFreq))) # Find the CLK divider value
    refCount = int(1.0*2**14 * (40.0e6/2**sysClkDiv/refFreq))
    
    speedOfLight = 299792458000  # mm/Second
    
    # Disable timer generator when setting
    self.sen_ctrl.set_value('TG_EN',                0)
    
    # Enable TX0 to use current setting from other TX channel
    self.sen_ctrl.set_value('EN_TX1_ON_TX0',        1)
    self.sen_ctrl.set_value('EN_TX2_ON_TX0',        0)
    
    # Set HDR threshold
    self.sen_ctrl.set_value('HDR_THR_HIGH',         hdrThresholdH)
    self.sen_ctrl.set_value('HDR_THR_LOW',          hdrThresholdL)
    
    # Set compare reg (datasheet P.28)
    self.sen_ctrl.set_value('COMPARE_REG1',         hdrThresholdH + 1000)
    self.sen_ctrl.set_value('COMPARE_REG2',         hdrThresholdL - 1000)
    self.sen_ctrl.set_value('MUX_SEL_COMPIN',       0)
    
    # Set command code for super HDR mode (datasheet P.29)
    self.sen_ctrl.set_value('COMMAND0',             0x108)
    self.sen_ctrl.set_value('COMMAND1',             0xB02)
    self.sen_ctrl.set_value('COMMAND2',             0x100)
    self.sen_ctrl.set_value('COMMAND3',             0xC00)
    
    # Set sequence code for super HDR mode (datasheet P.29)
    self.sen_ctrl.set_value('TG_SEQ_INT_START',     9850)
    self.sen_ctrl.set_value('TG_SEQ_INT_END',       9858)
    self.sen_ctrl.set_value('TG_OVL_WINDOW_START',  7000)
    
    # Set sub-frame and average count
    NUM_AVG_SUB_FRAMES = averageFrames - 1
    self.sen_ctrl.set_value('NUM_SUB_FRAMES',       NUM_AVG_SUB_FRAMES)
    self.sen_ctrl.set_value('NUM_AVG_SUB_FRAMES',   NUM_AVG_SUB_FRAMES)
    
    # Set int mask (datasheet P.28)
    self.sen_ctrl.set_value('TG_SEQ_INT_MASK_START',NUM_AVG_SUB_FRAMES)
    self.sen_ctrl.set_value('TG_SEQ_INT_MASK_END',  NUM_AVG_SUB_FRAMES)
    
    # Set I2C
    self.sen_ctrl.set_value('I2C_EN',               1)
    
    # Set external temperature sensor
    self.sen_ctrl.set_value('TSENS_SLAVE1',         0x48)
    self.sen_ctrl.set_value('EN_TILLUM_READ',       1)
    self.sen_ctrl.set_value('TEMP_AVG_ILLUM',       0)
    self.sen_ctrl.set_value('I2C_HOST_EN',          1)
    self.sen_ctrl.set_value('I2C_NUM_TRAN',         0)
    self.sen_ctrl.set_value('I2C_RW',               1)
    self.sen_ctrl.set_value('I2C_NUM_BYTES_TRAN1',  1)
    self.sen_ctrl.set_value('FRAME_VD_TRIG',        1)
    self.sen_ctrl.set_value('CONFIG_TILLUM_MSB',    8)
    self.sen_ctrl.set_value('EN_TILLUM_12B',        1)
    self.sen_ctrl.set_value('EN_TEMP_CONV',         1)
    
    # Set data ready interrupt GPIO
    self.sen_ctrl.set_value('GPIO1_OBUF_EN',        1)
    self.sen_ctrl.set_value('GPO1_MUX_SEL',         2)
    self.sen_ctrl.set_value('DIG_GPO_SEL0',         9)
    
    # Set xtalk
    self.sen_ctrl.set_value('IQ_READ_DATA_SEL',     3)
    self.sen_ctrl.set_value('XTALK_FILT_TIME_CONST',xtalkFilterTau)
    self.sen_ctrl.set_value('USE_XTALK_REG_ILLUM',  1)
    
    # Set clip mode
    self.sen_ctrl.set_value('CLIP_MODE_FC',         1)
    
    # Set HDR mode
    self.sen_ctrl.set_value('EN_SEQUENCER',         1)
    self.sen_ctrl.set_value('EN_PROCESSOR_VALUES',  1)
    self.sen_ctrl.set_value('EN_ADAPTIVE_HDR',      1)
    self.sen_ctrl.set_value('SEL_TX_CH',            1)
    self.sen_ctrl.set_value('SEL_HDR_MODE',         1)
    
    # Set external clock input GPIO
    self.sen_ctrl.set_value('GPIO2_IBUF_EN',        1)
    self.sen_ctrl.set_value('GPIO2_OBUF_EN',        1)
    
    # Set frequency calibration
    self.sen_ctrl.set_value('EN_CONT_FCALIB',       1)
    self.sen_ctrl.set_value('EN_FREQ_CORR',         1)
    self.sen_ctrl.set_value('EN_FLOOP',             1)
    self.sen_ctrl.set_value('EN_AUTO_FREQ_COUNT',   1)
    self.sen_ctrl.set_value('SYS_CLK_DIVIDER',      sysClkDiv)
    self.sen_ctrl.set_value('REF_COUNT_LIMIT',      refCount)
    self.sen_ctrl.set_value('START_FREQ_CALIB',     1)
    
    # Enable timer generator
    self.sen_ctrl.set_value('TG_EN',                1)
    

    I think wrong register settting might also cause this issue.

  • Hi Moses,

    Can you share a scope plot showing this delay? 

    Can you also share some details on your application and use case?

    Best,

    Alex

  • Currently it is difficult to get plots with an oscilloscope, so I will try to get them at a later date.
    The configuration diagram is as follows.

    The application scenario is road water level monitoring. It will be tested outdoor, but I'm currently evaluating the sensor in office.

    It has wires from Raspberry Pi Zero to extension board with length around 10cm.

    Hope this helps.

  • Hi Moses,

    Ok, I will wait for your scope plots to be able to check this further

    Best,

    Alex