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:
- write 0x06 at address 0x00 (
MAIN_CTRL
) - 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:
- I can readback the
MAIN_CTRL
register (0x00) just after writing to it, otherwise always reads as 0x00 - the
MAIN_STATUS
register (0x07) is always 0x20 after writing theMAIN_CTRL
register. Otherwise it changes to 0x00 - as I would expect anyway - the
LS DATA STATUS
bit in theMAIN_STATUS
register is always 0, as it never has new data available - in any case, the data registers (0x0A -> 0x15) are always 0x00
Am I missing anything in the configuration of the registers?
MAIN_CTRL
to enable the sensor. \$\endgroup\$LS_INT_EN
? -- The data sheet is quite short on documentation of the operation. :-( \$\endgroup\$INT_CFG
register only I can read back what I've written. But after enabling the sensor (withLS_EN
inMAIN_CTRL
) alsoINT_CFG
goes back to the default vaule. It seems it resets itself. \$\endgroup\$