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.

OPT3101EVM: phase_out keeps changing even when mode becomes monoshot mode?

Part Number: OPT3101EVM
Other Parts Discussed in Thread: OPT3101

Hello,

We're using OPT3101 EVM to develop our code base for distance measurement app.

We'd like to ask if our understanding on how monoshot mode works
is right.

We're planning to use monoshot mode for power-saving.
In other words, we want to measure a distance only when we trigger
measurement by setting "MONOSHOT_BIT" to 1.

Now we have a question here:
we assume that PHASE_OUT[15:0] register value wouldn't be updated and
remain constant as frames aren't captured once MONOSHOT_MODE[1:0] is set to 3(=monoshot_mode).
Is this assumption correct..??


Because, after I set MONOSHOT_MODE[1:0] to 3 by calling dev.writeReg(addr) I always
observe updated PHASE_OUT values, in other words PHASE_OUT value chages each time it's read out,
even though I've not set MONOSHOT_BIT to 1 yet. It looks this phenomenon doesn't match our assumption. 

I put what we've done and observed below for your info:


1. Connect PC to OPT3101 EVM over USB
   |
2. Start Latte GUI
   |
3. After Latte has started, read out those registers for status-check by dev.readReg(addr) methond in readAllRegisters.py :
0x27:0x26ac18 // read addr 0x27, mode = continuous mode
0x00:0x000000 // read addr 0x00, MONOSHOT_BIT = 0
   |
4. Then, I wrote value 0x26ac1B, which changes LSB 2bit to 3 from 0, at addr:0x27 to make the mode monoshot mode.
After reading addr0x27 out again, I saw the reg value was what was expected. All is fine so far.  
0x27:0x26ac1b // read addr 0x27, mode = monosho_mode
   |
5. Now, I tried reading out PHASE_OUT(addr0x08 bit[15:0]) some times and saw
its value changing even though MONOSHOT_BIT stayed 0: 

0x00:0x000000 // read addr 0x00, MONOSHOT_BIT = 0
0x08:0x960b1a // read addr 0x08, PHASE_OUT = 0x0b1a
0x08:0x96097b // read addr 0x08, PHASE_OUT = 0x097b
0x08:0x960b1e // read addr 0x08, PHASE_OUT = 0x0b1e
.
.

In short, our questions are as follow :
Q1. Is our assumption mentioned above on monoshot mode correct?

Q2. If not, would you tell us right regsiter settings to get monoshot mode to work?

I appreciate your help in advance,
regards,
kinoshita

  • Hi Tak,

    Looking into this.

    Best,

    Alex

  • Hi Alex,

    thanks for your help. 

    Please let me know if there is any new info. 

    regards,

    kinoshita

  • Hi Kinoshita,

    OPT3101 is not designed to switch live between monoshot and continuous. For continuous mode the device should be configured for continuous mode after power up and likewise for monoshot. Looking at your configuration sequence it looks that you are starting latte in default state (continuous mode) and then switching to monoshot. I would instead suggest to modify the init.py file to power up in monoshot mode instead of continuous. The operation you are seeing with your settings seems that device is still in continuous mode.

    Best,

    Alex

  • Hi Alex,

    thanks a lot for your help!

    As you mentioned it seems we'd been trying to switch live to monoshot after power up, which seems not to be feasible. 

    Now We tried, as you suggested, setting MONOSHOT_MODE = 3 in '03-Initialization.py' that  is called in 'devInit.py'. 

    Though, We've still got no luck, frames are being captured and phase_out is updated time to time even though MONOSHOT_BIT isn't set. 

    It seems we've missed something to set in 03-Initialization.py to enable monoshot right.  

    Would you kindly tell us what's we've missed in the file..? 

    I've attached "03-Initialization.py" we used, a Latte log on power up("Latte_Log_on_powerup.txt") and register dump after power up("regdump_on_powerup.txt") for your referece.

    log.zip

    We appreciate your help. 

    regards,

    kinoshita

  • Hi Kinoshita,

    I would need more time to go through this, but we have a configuration tool online that generates the config registers. Could you try using this? It will generate the configuration in C++ for the SDK (also online) so you may need to compare the configuration generated with your code to make sure they match up.

    Links are here under the tools section https://e2e.ti.com/support/sensors/f/1023/t/815766

    Best,

    Alex

  • Hi Alex,

    Thanks for your info! I've generated a config file using that config tool, then used the settings of the file

    for initialization. Unfortunately it didn't bring any differences so I debugged the code a bit, let me share what I've found.

    1.)The original code(02-loadCalibrationFromFlash.py) sends 'DEVR' to reset device before loading flash. I commented it out for a debugging purpose then

    found that phase_out remained constant before setting monoshot_bit. 

    2.) After setting monoshot_bit, phase_out began updating, but it just didn't stop the update. I thought expected behavior here would be that I it stopped after specified number of frames were capture. Also, the monoshot_bit somehow wasn't cleared automatically, it looked like a skicky bit. 

    3.) When I skip the internal xtalk correction(int_xtalk_calib = 1) for again debug purpose and try 2,) then I observed

    phase_out got updated only once on the setting of monoshot_bit, which means each time I set monoshot_bit phase_out

    became update. but of course, the phase_out value itself wasn't correct because of probably the lack of internal xtalk correction.

    I still don't understand why the update of phase_out doesn't stop once internal xtalk correction is conducted. 

    best,

    kinoshita

  • Hi Kinoshita,

    Thanks for the additional details. The calibration functions will modify the device state to perform the calibration. Can you try performing calibration like normal and then reset the device and run initialization and load calibration? This should put the device back in monoshot state but also load the calibration to results are correct.

    Best,

    Alex

  • Hi Alex,

    Thanks so much for your help! We've managed to get it working now. The new distance is measured only when

    monoshot_bit is set, and it stays the same until the bit is set next time. 

    Here is the sequence we tried : 

    1. Initialize

    2. xtalkcalib

    3. load the calibration

    We skipped doing DEVR since the frame capture doesn't stop somehow when it's sent, and we're not sure the reason of that. 

    =====

    0x08:0x000000   <--- distance = 0 

    0x00:0x800000   <--- set monoshot_bit 

    0x08:0x161ef9    <--- distance changed

    0x08:0x161ef9    <--- same distance is observed as frame's not captured

    0x00:0x800000   <--- set monoshot_bit

    0x08:0x160bbe   <--- distance changed

    0x08:0x160bbe   <--- same distance is observed as frame's not captured

    0x00:0x800000   <--- set monoshot_bit

    0x08:0x160bba   <--- distance changed

    0x08:0x160bba   <--- same distance is observed as frame's not captured

    ....