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: Averaging when multiple illumination channels are used

Part Number: OPT3101

Hello Alex,

We are using a custom board based on the OPT3101 IC in which the three illumination channels are used. The SDK is being used to calibrate the board and also to measure. The num_sub_frames and num_avg_sub_frames are configured to be 4096. The tx sequence defined is TX0-TX1-TX2-TX0-TX1-TX2. When the TESTING_LIVE_VIEW is run, the three LEDs light up when it is their turn but only data from one LED is shown in the terminal until there are approximately 30 samples obtained. At this point another channel starts showing measurements and the same happens with the third channel when 80 samples are obtained. We would like to understand the OPT3101 behavior when three illumination channels are being used because now our sensor does not respond to new targets until more or less 30 measurements are taken (taking into account that the time between sample and sample is 0,98 seconds). 

Best regards,

Olga

  • Hi Olga,

    At 4096 subframes device will take 4096/4Hz = ~1 second per frame. Each channel is time multiplexed so the device will take data on ch0, 1, and then 2. However, we should expect each channel to refresh about every 3 seconds rather than the 30 seconds you are seeing. I am not sure why this would be. Have you used the configurator tool to generate the config file for device in the SDK? If so can you share a screenshot of this config?

    Best,

    Alex 

  • Hi Alex,

    I use the configurator tool to generate the configuration file. The screenshot is attached below:

    Thanks!

    Olga

  • Hi Olga,

    Will check this and get back this week on this.

    Best,

    Alex

  • Hi Alex, 

    Thanks!

    Best regards,

    Olga

  • Hi Olga,

    I do not see any issues in your configuration here so not sure why you are seeing these longer times. Using the EVM and the EVM GUI are you able to replicate this issue?

    Best,

    Alex

  • Hi Alex, 

    With the EVM GUI I am not able to configure 3 tx channels so I can not replicate this issue. 

    Best,

    Olga

  • Hi Olga,

    If you place your board into single channel mode do you still see the issue?

    Best,

    Alex

  • Hi Alex,

    When I configure my board to single channel mode I don't observe this behavior. 

    Best,

    Olga

  • Hi Olga,

    Can you dump all registers from the device and send to me as text file to check? Also you are supplying a clock input to the device for frequency correction?

    Best,

    Alex

  • Hi Alex,

    I attach the text file below. I am supplying a clock input to the device of 125 kHz. 

    Best,

    Olga

    OPT3101_configuration.cpp
    
    void OPT3101::device::initialize(void) {
    	
    	this->reg.tg_ovl_window_start = 7000; // //Overload flab observation window
    	this->reg.en_temp_conv = 1; // //Enables the internal
    
    	this->reg.clip_mode_fc = 1; // //Enables Clip mode for Frequency correction
    	this->reg.clip_mode_temp = 0; // //Disables Clip mode for Temp coff phase correction
    	this->reg.clip_mode_offset = 0; // //Disables Clip mode for phase offset correction
    	this->reg.iq_read_data_sel = 3; // //Enables 16 bit frame counter
    	this->reg.iamb_max_sel = 5; // //Sets maximum ambient support
    
    	this->reg.en_temp_corr = 0; // //Enables Temperature Correction
    
    	this->reg.gpio1_obuf_en = 1; // //Enabled output buffer on GPIO1 pin
    	this->reg.gpo1_mux_sel = 2; 	    // //select dig_gpo_0 on gpio1
    	this->reg.dig_gpo_sel0 = 9; 	// //Select Data Ready on dig_gpo_0
    
    	this->reg.en_cont_fcalib = 1; // //Enables continuous frequency calibration
    	this->reg.start_freq_calib = 1; // //Starts the frequency calibration block
    	this->reg.en_floop = 1; // //Enables the frequency correction loop
    	this->reg.en_auto_freq_count = 1; // //Enables automatic frequency count
    	this->reg.en_freq_corr = 1; // //Enables digital frequency correction
    	this->reg.sys_clk_divider = 8;  // //Divider for system clock
    	this->reg.ref_count_limit = 20480; // //Counter limit
    	this->reg.gpio2_obuf_en = 0; // //Disables output buffer on GPIO2
    	this->reg.gpio2_ibuf_en = 1; // //Enables ref clock input of GPIO2
    
    
    #ifdef AVG512
    	this->reg.num_sub_frames = 511; // //Sub frames count
    	this->reg.num_avg_sub_frames = 511; // //Average frames count
    	this->reg.xtalk_filt_time_const = 1; // //Crosstalk filter time constant
    	this->reg.tg_seq_int_start = 9850; // //Sequence Start
    	this->reg.tg_seq_int_end = 9858; // //Sequence End
    	this->reg.tg_seq_int_mask_start = 511; // //Same as AvgFrame Count
    	this->reg.tg_seq_int_mask_end = 511; // //Same as AvgFrame Count
    #endif	
    
    #ifdef AVG4096
    	this->reg.num_sub_frames = 4095; // //Sub frames count
    	this->reg.num_avg_sub_frames = 4095; // //Average frames count
    	this->reg.xtalk_filt_time_const = 0; // //Crosstalk filter time constant
    	this->reg.tg_seq_int_start = 9850; // //Sequence Start
    	this->reg.tg_seq_int_end = 9858; // //Sequence End
    	this->reg.tg_seq_int_mask_start = 4095; // //Same as AvgFrame Count
    	this->reg.tg_seq_int_mask_end = 4095; // //Same as AvgFrame Count
    #endif
    
    	this->reg.hdr_thr_high = 25500; // //High Threshold
    	this->reg.hdr_thr_low = 10650;
    	
    	this->reg.en_adaptive_hdr = 1;
    
    	this->reg.illum_dac_h_tx0 = 18; // //High Current settings [100.8mA:5.6mA X 18]
    	this->reg.illum_scale_h_tx0 = 0; // //Illum scale for H [100.8mA:5.6mA X 18]
    	this->reg.illum_dac_l_tx0 = 13; // //High Current settings [054.6mA:4.2mA X 13]
    	this->reg.illum_scale_l_tx0 = 1; // //Illum scale for H [054.6mA:4.2mA X 13]
    
    	this->reg.illum_dac_h_tx1 = 18; // //High Current settings [100.8mA:5.6mA X 18]		//NEW
    	this->reg.illum_scale_h_tx1 = 0; // //Illum scale for H [100.8mA:5.6mA X 18]		//NEW
    	this->reg.illum_dac_l_tx1 = 13; // //High Current settings [054.6mA:4.2mA X 13]		//NEW
    	this->reg.illum_scale_l_tx1 = 1; // //Illum scale for H [054.6mA:4.2mA X 13]		//NEW
    
    	this->reg.illum_dac_h_tx2 = 18; // //High Current settings [100.8mA:5.6mA X 18]		//NEW
    	this->reg.illum_scale_h_tx2 = 0; // //Illum scale for H [100.8mA:5.6mA X 18]		//NEW
    	this->reg.illum_dac_l_tx2 = 13; // //High Current settings [054.6mA:4.2mA X 13]		//NEW
    	this->reg.illum_scale_l_tx2 = 1; // //Illum scale for H [054.6mA:4.2mA X 13]		//NEW
    
    
    
    	this->reg.tx_seq_reg = 2340; // //Setting TX Switching order
    	this->reg.en_tx_switch = 1; // //Enable TX Switching order
    
    	this->reg.tg_en = 1; // //Enables Timing Generator
    
    
    #ifdef AVG512
    	this->configurationFlags_xtalkFilterTau = 1; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_monoshotMode = false; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_xtalkSettlingOneTauInMilliSeconds = 256; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_xtalkSettlingOneTauInDataReadyCounts = 2; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_frameTimeInMilliSeconds = 128; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_avgFrameCountExponentOfTwo = 9; // //This is not a register but a settings flag for the SDK
    #endif 	
    
    #ifdef AVG4096
    	this->configurationFlags_xtalkFilterTau = 0; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_monoshotMode = false; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_xtalkSettlingOneTauInMilliSeconds = 1024; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_xtalkSettlingOneTauInDataReadyCounts = 1; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_frameTimeInMilliSeconds = 1024; // //This is not a register but a settings flag for the SDK
    	this->configurationFlags_avgFrameCountExponentOfTwo = 12; // //This is not a register but a settings flag for the SDK
    #endif
    }
    
    OPT3101::device::device(void) :
    	configurationFlags_isTXChannelActive{true,true,true}, // MODIF
    	configurationFlags_isRegisterSetActive{true,true} {}
    	
    	
    

  • Hi Olga,

    Checking these settings.

    Best,

    Alex

  • Hi Alex, 

    Have you seen something interesting in the settings? 

    Thanks!

    Olga

  • Hi Olga,

    Apologies for the delay. We will provide a response here tomorrow.

    Best,
    Alex

  • Hi Olga,

    We have had some delay here. Will provide a response within next two days.

    Best,

    Alex

  • Hi Olga,

    It seems that I have managed to replicate a similar behavior to what you have described in the first post. I need to check this further to confirm this. Can you try starting the device at the fastest frame rate and then updating the frame rate register to your desired value and check the results? Also, have you looked at the behavior at different frame rates? Does the problem persist and if so, how does it behave?

    Thank you,

    Brent Elliott

  • Hi Brent,

    I have checked your questions:

    • Can you try starting the device at the fastest frame rate and then updating the frame rate register to your desired value and check the results?

    I am measuring using the SDK and the frame rate cannot be changed once the program is running. The problem persists with this test. 

    • Also, have you looked at the behavior at different frame rates? Does the problem persist and if so, how does it behave?

    I have looked the behavior at 2048 (num_avg_sub_frames) and the problem persists. It seems that the sensor does the average for each sample during aproximately 15 samples for TX0, and then starts measuring with TX1 repeating the operation (the same with TX2). In other words, there is only one channel updating its values during 15 samples while the other two channels maintain the previous values. When there is a distance change to detect, only 1 channel updates its value at real time. The next channel updates its measurement after 15 samples, which are more or less 25 seconds.  

  • Hi Olga,

    I have looked through the SDK and found that there is a timing issue in the capture function in OPT3101device_Functions.cpp. To fix this you will need to comment the line that says "host->sleep(((dev->configurationFlags_frameTimeInMilliSeconds)<<1));". This line was introducing an extra waiting period which caused the data capture to occur only when one channel is updating. Since this code is time based and not interrupt based, the channels will not update in order 100% of the time, so you may notice a channel being skipped every 40 samples or so.

    Let me know if you have any other questions.

    Thank you,

    Brent Elliott

  • Hi Brent,

    Thank you very much, this has solved the issue. 

    Best regards,

    Olga