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.

OPT4001: How to work arround CRC errors

Part Number: OPT4001

Hi,

Please share your wisdom with me.
I'm trying to read the Lux value for OPT4001 using a circuit that can only operate at 2-byte read.
The process is as follows.

Read 2 bytes from address 0x00.

Next, read 2 bytes from address 0x01.

And, CRC error occurs.

It appears this is caused by a change in the Lux value before the second read.

Question:

  • Is there any way to lock the Lux value until the second read is complete?
  • Is there any way to prevent the Lux value from being updated until the second read is complete?

It would be helpful if you could tell me a workaround.

  • Hello Hironobu, 

    How often are you trying to make measurement reading?   Operating in monoshot mode would eliminate this issue. 

    Thank you, 

    Joseph Scherphorn

  • Hi Joseph-san,

    Thank you for your reply.

    We want to read 10 times per second continuously.

    Am I correct in understanding that "Moonshot" refers to the "One-shot" shown in the figure below?

    Is my understanding correct below?

    • If 2-byte reads can be performed at both addresses within the time period set in CONVERSION_TIME, no CRC error will occur.
    • The Result Register will not change during the time period set in CONVERSION_TIME.

    Best regards,
    Tomita

  • Hello Hironobu-san, 

    Yes, apologies for the typo, I had meant "monoshot".      In this mode the mcu triggers each conversion individually, If you were to use this mode and needed to absolutely ensure 10 measurements a second I would choose the 50ms conversion time. One shot would be triggered, the MCU waits for the conversion time duration and then reads all registers of interest then immediately triggers the next conversion

    Yes you are correct in you understanding about the read timing and that The Result Register will not change during the time period set in CONVERSION_TIME. 

    At what rate are you able to make reads?

    What is likely happening is the read timing and the measurement period are not synced causing some reads to be in process while the results register is being rewritten, this results in crc error. For continuous conversion mode. The int pin or CONVERSION_READY_FLAG can be monitored in order to know when to make read. 

    Thank you, 

    Joseph Scherphorn

  • Hello Joseph-san,

    Thank you for teaching me so many things.

    I was able to understand the control mechanism for monitoring the int pin or CONVERSION_READY_FLAG and then reading the results.

    Just to be sure, please let me know.

    Even if burst reads are performed at addresses 00h and 01h, as shown in the figure, will a CRC error occur if the measurement result update timing occurs during the burst read? In other words, controlling based on monitoring either the int pin or CONVERSION_READY_FLAG is necessary, right?


    And thank you for letting me know that the conversion time is 50ms.
    I am sorry, this is a different question.
    I'd like to set the FULL-SCALE LIGHT LEVEL to maximum.

    If I set the CONVERSION_TIME register to 7 (50 ms) , is it possible to set the RANGE register to 8?

    Best regards,
    Tomita

  • Hello Hironobu-san, 

    Yes, you are correct. Without monitoring the int pin or CONVERSION_READY_FLAG you will be likely to see CRC errors.

    If acceptable you could also simply discard the readings with when CRC flag is high as this would indicate the result update happened during read and the exponent and mantissa are likely mismatched.

    Any combination of range and conversion time setting is acceptable. 

    Thank you, 

    Joseph Scherphorn

  • Hello Joseph-san,

    Thank you for your detailed advice and information!

    I now understand how to prevent CRC errors and what to do when a CRC error occurs.

    And thank you also for your response regarding the combination of range and conversion time setting. I asked this question because other companies had a constraint such as “CT × 1.3 < range.” 

    It was really helpful to know that, too.


    Best regards,

    Tomita