0
\$\begingroup\$

I'm trying to read data from an APDS-9253 with an xmega. My i2c bus is working because I'm reading other devices without any problem.

From the datasheet it seems at power-up the sensor is not activated: LS_EN is 0. Here my flow:

  1. write 0x06 at address 0x00 (MAIN_CTRL)
  2. read registers

I get these values:

reg[0x00] = 0x06 // correct
reg[0x01] = 0x36 // reserved
reg[0x02] = 0x08 // reserved
reg[0x03] = 0x05 // reserved
reg[0x04] = 0x22 // correct
reg[0x05] = 0x01 // correct
reg[0x06] = 0xC2 // correct
reg[0x07] = 0x20 // correct? it should be 0x20 only the first time
reg[0x08] = 0x00 // reserved
reg[0x09] = 0x00 // reserved
reg[0x0A] = 0x00 // no data
reg[0x0B] = 0x00
reg[0x0C] = 0x00
...
reg[0x15] = 0x00

There are four weird behaviors:

  1. I can readback the MAIN_CTRL register (0x00) just after writing to it, otherwise always reads as 0x00
  2. the MAIN_STATUS register (0x07) is always 0x20 after writing the MAIN_CTRL register. Otherwise it changes to 0x00 - as I would expect anyway
  3. the LS DATA STATUS bit in the MAIN_STATUS register is always 0, as it never has new data available
  4. in any case, the data registers (0x0A -> 0x15) are always 0x00

Am I missing anything in the configuration of the registers?

\$\endgroup\$
7
  • \$\begingroup\$ Without having read all of the data sheet, I think you need to write to the MAIN_CTRL to enable the sensor. \$\endgroup\$ Mar 21, 2021 at 10:10
  • \$\begingroup\$ @thebusybee, please read point 1. of my question: "write 0x06 at address 0x00 (MAIN_CTRL)". \$\endgroup\$
    – Mark
    Mar 21, 2021 at 12:47
  • \$\begingroup\$ Ah, I overread this, sorry. -- Did you try to enable LS_INT_EN? -- The data sheet is quite short on documentation of the operation. :-( \$\endgroup\$ Mar 21, 2021 at 13:29
  • \$\begingroup\$ @thebusybee, tried right now. If I write to the INT_CFG register only I can read back what I've written. But after enabling the sensor (with LS_EN in MAIN_CTRL) also INT_CFG goes back to the default vaule. It seems it resets itself. \$\endgroup\$
    – Mark
    Mar 21, 2021 at 13:45
  • \$\begingroup\$ I tried with different boards and sensors, so it cannot be a damaged one. \$\endgroup\$
    – Mark
    Mar 21, 2021 at 13:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.