Closed CFD2 closed 3 years ago
From datasheet, p.21:
The Configuration Register can be read from at any time without impacting or affecting the device settings or a conversion in progress. Writing to the Configuration Register halts any conversion in progress until the write sequence is completed resulting in a new conversion starting based on the new contents of the Configuration Register (00h).
The register is available for read/write operations at any time.
On the screenshot in the header message, the format of I2C message is incorrect for writing to registers. It is similar to reading from the register (i.e. change the register pointer, then supply data MSB and LSB, figure 26 on the screenshot from the datasheet).
Instead, when writing to a register, the address needs to be followed by the destination register location and then followed by the data to be written into the register.
From the datasheet, p.19:
In other words, writing to registers should look more like this (addr. 40, reg. 00, data 02 07):
Summary
Writing to configuration register of the power sensor and reading from it results in default (a.k.a. reset) value 0x6127. Can write to another register of the power sensor (Alert Limit Register @ 0x07) just fine.
Description
Sensor address: 0x40 Configuration register address: 0x00 Default register value: 0x6127
Added a debug statement to read from config register right after writing to it: