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.

OPT3004: High Limit Flag is always set

Part Number: OPT3004

I have configured the sensor with following selection-:

  1. FAULT_COUNT - two fault 
  2. MASK_EXPONENT - No exponent mask
  3. LATCH_FIELD - latched window-style comparison operation
  4. CONVERSION_MODE - Continuous 
  5. CONVERSION_TIME  100 ms 
  6. LUX_RANGE manually selected to EXPONENT_LEVEL_4  (lsb value 0.16).

I am testing the sensor by keeping different High Limit and Low Limit value. And reading the High Flag and Low Flag.

The problem I am facing is that every time High Flag is set doesn't matter what result register value is.

Example 1-

I set Hight limit to 20 lux and low limit to 5 lux.

Reading result register when conversion completed flag is high, it is 17 lux.

Reading High Flag and Low Flag, high flag is set. (In my understanding it should not be)

Example 2-

I set Hight limit to 15 lux and low limit to 5 lux.

Reading result register when conversion completed flag is high, it is 17 lux.

Reading High Flag and Low Flag, high flag is set. (This is okay for me)

Example 3-

I set Hight limit to 40 lux and low limit to 20 lux.

Reading result register when conversion completed flag is high, it is 17 lux.

Reading High Flag and Low Flag, high flag is set. (In my understanding Low Flag should have been set)

Please Let me know if my understanding is not correct.

Regards,

Srishti Verma,

  • Hi Srishti,

    With the settings that you listed out above, the following table applies.

    From this table, the high flag will not be reset until the configuration register is read. There may have been conversion before the lux value that you are reading where the value went above 20 lux, and the high flag was subsequently set. Let me know if this was not the case, but keep in mind that the high flag will stay set until you read the configuration register.

    Thank you,

    Brent Elliott

  • Thanks for the response!

    Let me clear that I am reading the result register and configuration register in an infinite loop.

    Every time when result register is read value is below the high limit and when I read configuration register it clears the high limit flag. But every 3rd read of configuration register gives high limit flag set (which is because fault count is set to 2 I guess). 

    Somehow the high limit flag and low limit flag behavior is not as expected.

    Regards,

    Srishti Verma,

  • Additional information- I read the result register only when conversion complete flag is ready.

  • Hi Srishti,

    Thanks for the additional info. Can you share the exact values you are placing in the TL and TH registers?

    Thank you,

    Brent Elliott

  • Hello Brent,

    Following are the values-

    1) Configuration Register-   0x4411

    2) High Limit Register-        0x00BB

    3) Low Limit Register-         0xC006 

    4)Result register is reading- 0x4098.

    Sometimes, I observed both High Limit and Low Limit bit go high together and low together as I read Configuration register.

    Let me know if any other information is needed. Thanks!

    Regards,

    Srishti Verma,

  • Hi Srishti,

    With your current setting for the high limit register, the lux limit for the H flag is 1.87 lux. I believe that you may have included a factor of 8 in there since the conversion time is set to 100ms, but this won't effect the lux equation, it will just limit the resolution in the result register. Try fixing these values and let me know if that works.

    Thank you,

    Brent Elliott

  • Thanks! Brent. That solves my problem. I had understood that the range selected in the configuration register will apply for all registers (Result, High and low). But that's not the case. 

    Can you help me understand one more configuration?

    Is it possible to set low limit with manual range selection as exponent of 4 and single shot read?  OR with the Single shot read configuration how to set low limit?

  • Hi Srishti,

    By single shot read, do you mean end-of-conversion mode? I was looking through the datasheet and was trying to find the answer to that question myself. Since the first two bits of the exponent need to be set in order to enable end-of-conversion mode, I am not sure how the register handles exponents when in this mode. It may be possible to set the last two bits of the exponent in order to go from exponent 0 to 3, but this would need to be tested.

    Thank you,

    Brent Elliott