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.

OPT3006: Latched/windowed mode and interrupts

Part Number: OPT3006

I have the OPT3006 light sensor currently in use via polling.  I am investigating using this via the latched interrupt mode so that I receive an interrupt when the LUX value leaves the area of interest.

The way I read the documentation is that I receive the interrupt and the pin will remain high until I read the R1 status register.  That should clear the int pin as well as the FL bit in the register.

I do this operation.

What I am seeing is that once the interrupt occurs, subsequent I2C read requests of R0 are returned with a NAK response.  I'm clearly able to talk to the device beforehand, yet after that interrupt, nada.

Thank you

  • Hi Robert,

    That behavior is not expected. What pullups are you using for i2c and int? What happens if you read the config register (0x01) when this issue occurs? Does the INT clear and the i2c start working again?

    Best,

    Alex

  • We are using a 10k Ohm resister for int pull-up and 4.7k for I2C pull ups. I2C communications up to this point, have been flawless.  Once I receive the interrupt, I clear the interrupt on the chip(KL03) and wake up the main program.  There I read R1.  FL or FH is high, depending on the condition.

    After that, I read R0.  The R0 read returns from I2C with a NAK.  

  • How many devices do you see this on? Are you able to replicate on the EVM?

  • We only have one I2C device, hence this is coming from the OPT3006. 

    The documentation says that the interrupt pin will remain active until we either send the SMBus alert or read the configuration register (R1). Table 4, page 15.  We are using the default (low) for the interrupt pin state.

    We do receive the interrupt, but the problem is clearing that pin.  Once we get the first interrupt, we cannot clear that pin without a power cycle.  That's contrary to what the manual says.

    I have, as I mentioned, our application attempts to read R1 and receives an I2C NAK response, and the interrupt pin remains active.  I have also attempted to send the SMBus alert message, with the same results.

    As far as the EVM goes, that's connected to a PC via a USB.  The supplied program (LabView?) seems to function as expected; we see the appropriate flags on the R1 display.  That is, however, after we attempt to read R1 as it never appears to generate an interrupt on its own.  Using the Continuous switch, the program appears to pull R1 status, display that, then read R0.

    Again, we configure the device, we get the interrupt, we can just never make the thing go away as we continue to get a NAK response to our I2C packets.

  • Hi Robert,

    The NACK is strange and sounds like issue is not related to INT pin but rather some I2C issue. If the I2C read results in NACK then the read will not occur and INT will not be cleared. Does this mean after first data ready that your I2C comm with device does not work anymore (not able to read or write any registers)?

    Best,

    Alex

  • Yes, since I cannot successfully communicate with the device, the INT pin remains high and I constantly receive interrupts. A power cycle of the board is necessary to clear the device and the offending pin.  A reset, BTW, does not clear up this situation.

    Is there some way to trace the commands going to/from the sensor via the EVM/LabView program?  I would like to know the command trace so that I might be able to duplicate the conversation.

  • Hi Robert,

    I don't know of any easy way within labview (labview if sending command through USB to a chip on the SM-USB-DIG, which is then sending the i2c commands) and would suggest using scope with i2c monitor to get commands off the I2C line as the way to do that.

    Best,

    Alex

  • We have modified our power on the board and the sensor is now behaving as documented.  Thank you for your assistance.