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: Configure SuperHDR with Monoshot mode

Part Number: OPT3101

Hello TI team

I have a question about configuration when I use OPT3101 in SuperHDR plus monoshot mode I have incorrect behavior, it fires continuously, sending me interruptions without activating the monoshot_bit bit and the emitter led remains on

I perform the configuration from the OPT3101 Configurator Tool software
I attach the code

void OPT3101::device::initialize(void){
	// List of registers to initialize OPT3101 device after power-up

	this->reg.force_en_slave = 1; // //Since I2C Master bus is floating this register needs to be set to enable device to respond

	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 = 0; // //Sets maximum ambient support
	this->reg.en_temp_corr = 1; // //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.monoshot_mode=3; // //Sets monoshot mode
	this->reg.dis_glb_pd_refsys=1; // Disables deep sleep PWRDN for blocks
	//this->reg.dis_glb_pd_temp_sens=1;
	//this->reg.dis_glb_pd_illum_drv=1
	//this->reg.dis_glb_pd_afe=1;
	//this->reg.dis_glb_pd_afe_dac=1;
	this->reg.dis_glb_pd_amb_dac=1;
	this->reg.dis_glb_pd_amb_adc=1;
	this->reg.dis_glb_pd_osc=1;
	//this->reg.dis_glb_pd_i2chost_osc=1;
	this->reg.MONOSHOT_NUMFRAME=2; // //Sets number of frames to me measured per trigger
	this->reg.powerup_delay=159; // //Power-up delay for every monoshot trigger

	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

	this->reg.command0 = 0x108; // //Set Channel 1
	this->reg.command1 = 0xB02; // //COMP1.
	this->reg.command2 = 0x100; // //Set Channel 0
	this->reg.command3 = 0xC00; // //COMP1_INV
	this->reg.compare_reg1 = 26000; // //ThresholdH
	this->reg.compare_reg2 = 4312; // //ThresholdH
	this->reg.mux_sel_compin = 0; // //Selects Amplitude for Comparison
	this->reg.en_tx1_on_tx0 = 1; // //Setting TX1 register and connect to TX0

	this->reg.en_processor_values = 1; // //Enables processor values
	this->reg.en_sequencer = 1; // //Enables the Sequencer
	this->reg.hdr_thr_high = 25500; // //High Threshold
	this->reg.hdr_thr_low = 4812; // //Low Threshold
	this->reg.en_adaptive_hdr = 1; // //Enables adaptive HDR feature

	this->reg.illum_dac_h_tx0 = 2; // //High Current settings [011.2mA:5.6mA X 02]
	this->reg.illum_scale_h_tx0 = 0; // //Illum scale for H [011.2mA:5.6mA X 02]

	this->reg.illum_dac_l_tx0 = 1; // //High Current settings [002.8mA:2.8mA X 01]
	this->reg.illum_scale_l_tx0 = 2; // //Illum scale for H [002.8mA:2.8mA X 01]

	this->reg.illum_dac_h_tx1 = 31; // //High Current settings [173.6mA:5.6mA X 31]
	this->reg.illum_scale_h_tx1 = 0; // //Illum scale for H [173.6mA:5.6mA X 31]

	this->reg.illum_dac_l_tx1 = 31; // //High Current settings [043.4mA:1.4mA X 31]
	this->reg.illum_scale_l_tx1 = 3; // //Illum scale for H [043.4mA:1.4mA X 31]

	this->reg.tg_en = 1; // //Enables Timing Generator

	this->configurationFlags_xtalkFilterTau =  1; // //This is not a register but a settings flag for the SDK
	this->configurationFlags_monoshotMode =  true; // //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

}

The question arises, is it possible to configure OPT3101 in SuperHDR mode plus monoshot mode?
If so, I did something wrong in the configuration, another comment made the configuration of monoshot not in the initialize() function since it affects the lighting and internal crosstalk loading, so I made that configuration at the end of all the configurations and loading of calibration values

  • Guillermo,

      Your code says it's in Monoshot mode. What I do not see is, are you using software trigger or hardware trigger? If hardware verify that the trigger is in the correct state and being held in trigger state. Alternativly if software triggered, make sure the code is not looping and retriggering over and over. 

    I belive the mode should be in the initialization or startup. You might want to check this out as well. 

  • Gordon,

    I activate the monoshot by software by changing the monoshot_bit bit once everything is initialized.
    I will validate your suggestions but then if it is possible to use the SuperHDR mode with monoshot, my problem is that once I activate the shot mode it continues to send me an interruption signal and you can also see the emitter LED on, making bursts.

    What would be the correct configuration to place OPT3101 in low consumption mode including turning off the emitting LED?

  • Guillermo,

      You should not have a problem running SuperHDR in Monoshot mode. The lowest power mode is in Monoshot with no active triggers or calculations.

    If you are getting reoccuring triggers it is usually from some kind of loop in code. The programmers have not indicated that you need to do anything special.

    I will setup up a system on my bench and try SuperHDR with monoshot and see if I need to do anything different.

  • Gordon,

    I would appreciate if you can replicate this.
    Another thing I noticed is that when the initialization is performed as generated by the configuration tool, in the generated initialization the monoshot is enabled (monoshot_mode = 3) with that configuration the internal crosstalk calibration is no longer performed, my assumption here is that The OPT3101 is in sleep mode, that's why I tried enabling monoshot mode after initializing and performing the internal crosstalk calibration.

    The question arises if OPT3101 is capable of making online mode changes, that is, when it is in use, for example, from continuous mode to monoshot mode when I need it once it has been previously configured?

  • Guillermo,

      Let me see if I can replicate this. I am setup for a different test, so it may take me a day or two. I will try to get back to you asap.

  • Guillermo,

      I have not forgotten about you. I am scheduled to be in the lab tomorrow morning with the EVM to see if I can recreate your problem. 

  • Sure, no problem, thanks for the follow-up.

  • Guillermo,

    A few questions. Are you attempting to trigger by external pin         , or by setting the register?

    What I am seeing is that the length of time you pulse the trigger pin can cause a restart that could clear monoshot and send it back to running in default mode. See below.

    The RST_MS pin is a dual-purpose pin used for reset and monoshot triggering. For reset, give a pulse duration
    that is > 30 μs. For monoshot trigger, give a pulse duration that is < 1 μs and > 100 ns.

    I am continuing to test this more info or question as I find something. 

  • Gordon,

    I performed the trigger by configuring the registry (software), and I also made sure to change the state of the RST_MS pin to high to prevent it from restarting or activating the monoshot

  • Guillermo,

    That's good. Try setting tg_en bit to 0 before you change monoshot_mode to 1. (descrepency in data sheet, monoshot mode is 1 not 3) I will be correcting that. Then change tg_en to a 1 to re-enable the timing generator. Then you can set monoshot_bit to a 1 to trigger. Let me know if this helps\.  

  • Guillermo,

      We have been able to re-create your issue. I will forward a solution as soon as we resolve. 

    One item we are attempting is to set monoshot during the init mode, that way when it powers up, it will be in monoshot. 

    Try this yourself and let's regroup and see if it helps. 

  • Gordon,
    Do you have any news with this topic, I have some conclusions, I will share them in these days. Greetings.

  • Guillermo,

       The programmer was going to outline the initialization for monoshot. I have not heard back from him. I will send a message and ask for status.

    Please let me know what you have found when you can. 

  • Guillermo,

      The programmer has responded. It's pretty much what I was saying, except that pulling J17 to 3.3 is important.

     

    There are two ways we can set monoshot mode in OPT3101

    1. External
      1. J17 pin-7 (VSYNC_RST), give an active low pulse (pulse width range min = 0.1us and max = 1us)
      2. You can verify from dev.frame_count1 field in latte. It updates it value after every new reading (3 -> 2 -> 1 -> 0 cyclic)
    2. Using Register
      1. Connect J17 pin-7 (VSYNC_RST) to VDD (3.3V)
      2. Now set dev.monoshot_mode field to 3 in latte.
      3. Now every time setting dev.monoshot_bit field to 1 will trigger a new reading.
      4. You can verify from dev.frame_count1 field in latte. It updates it value after every new reading (3 -> 2 -> 1 -> 0 cyclic)

     Latte Code to set monoshot mode

     dev.monoshot_mode = 3

    dev.monoshot_bit = 1

    frameCount = dev._frame_count1.getValue()

    log(frameCount)

    He commented that pulling J17 to 3.3V is necessary to enter into monoshot mode. 

  • Gordon,
    I share the things you can do regarding this topic.

    1. Regarding the routine to initialize OPT3101 in Monoshot mode, I did not find a way to do it together with the initialization of OPT3101, since I did call the initialization function where OPT3101 is configured SuperHDR mode this->initialize(); inside this function I add the following routine to configure monoshot mode:

    	this->reg.monoshot_mode=3; // //Sets monoshot mode
    	this->reg.dis_glb_pd_refsys=1; // Disables deep sleep PWRDN for blocks
    	//this->reg.dis_glb_pd_temp_sens=1;
    	//this->reg.dis_glb_pd_illum_drv=1
    	//this->reg.dis_glb_pd_afe=1;
    	//this->reg.dis_glb_pd_afe_dac=1;
    	this->reg.dis_glb_pd_amb_dac=1;
    	this->reg.dis_glb_pd_amb_adc=1;
    	this->reg.dis_glb_pd_osc=1;
    	//this->reg.dis_glb_pd_i2chost_osc=1;
    	this->reg.MONOSHOT_NUMFRAME=2; // //Sets number of frames to me measured per trigger
    	this->reg.powerup_delay=159; // //Power-up delay for every monoshot trigger

    When it comes time to perform the internal crostalk correction with this->measureAndCorrectInternalCrosstalk(&this->calibration->internalCrosstalk[0]); This routine is not performed.
    So the way I managed to enable monoshot mode was to do the configuration after starting OPT3101 completely something like this:

    this->initialize();
        this->measureAndCorrectInternalCrosstalk(&this->calibration->internalCrosstalk[0]); 
        this->calibration->internalCrosstalk[0].printHeader();     
        this->calibration->internalCrosstalk[0].print(); 
        this->manuallySetIllumCrosstalkTempCoffs();
    	this->manuallySetPhaseTempCoffs();
    	this->manuallySetPhaseAmbientCoffs();
    	this->loadIllumCrosstalkSet(true);
    	this->loadIllumCrosstalkTempCoffSet();
    	this->loadPhaseOffsetSet(true);
    	this->loadPhaseOffsetTempCoffSet();
    	this->loadPhaseAmbientCoffSet();
    	this->SetMonoshot();

    Therefore separate the enable monoshot mode routine after initializing and loading all calibrations

    Thus, after configuring, the monoshot mode is configured and OPT3101 is asleep waiting for the trigger signal.

    2. About how the monoshot shoots


    2.1 Triggering by hardware: Here you don't know that when monoshot is triggered by placing the VSYNC_RST signal pin 17 on OPT3101 with a low pulse for a time of 100us. OPT3101 in monoshot and SuperHDR mode responds well, generates the interrupt and then returns to sleep mode automatically.

    2.2 Software triggering: This mode is more troublesome when the bit is changed monoshot_bit = 1; OPT3101 raises the interrupt but continues to send interrupts as if the bit will not be automatically cleared as mentioned in the datasheet monoshot_bit = 0; Even if I try to clean it myself I still get interruptions.
    As a workaround to be able to use software-triggered monoshot alongside SuperHDR tube I would induce OPT3101 into a shutdown mode with the following settings:

    //! Disable OPT3101
    this->reg.pdn_global = 1; // Global power down of all the blocks.
    this->reg.tg_en = 0; // // Timing Generator
    
    //! Trigger Enable OPT3101
    this->reg.pdn_global = 0; // Global power down of all the blocks.
    this->reg.tg_en = 1; // // Timing Generator

    In conclusion, hardware activation works for me so I avoid leaving OPT3101 on when I don't need it, as happens with Software activation.