Skip to content

Commit 2850be6

Browse files
mabembeddedkartben
authored andcommitted
drivers: sensor: ams/tsl2591: Don't check return code of initial reset
The TSL2591 driver fails to initialize because the sensor responds with a NACK on the initial RESET. Although the datasheet from Adafruit claims that this is operation should be valid (RESET is part of the CONTROL register), other sample non-Zephyr drivers provided by Arduino don't explicitly reset the sensor on initialization (see https://github.com/adafruit/Adafruit_TSL2591_Library/blob/master/Adafruit_TSL2591.cpp). Thus, the assumption is that when the sensor is reset via software, it doesn't respond to an ACK. After removing the check for this initial RESET, the driver initializes successfully. Signed-off-by: Mohammed Billoo <[email protected]>
1 parent be91cfe commit 2850be6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/sensor/ams/tsl2591/tsl2591.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,11 @@ static int tsl2591_setup(const struct device *dev)
418418
uint8_t device_id;
419419
int ret;
420420

421-
ret = tsl2591_reg_write(dev, TSL2591_REG_CONFIG, TSL2591_SRESET);
422-
if (ret < 0) {
423-
LOG_ERR("Failed to reset device");
424-
return ret;
425-
}
421+
/* Reset the sensor. Although this is not clearly documented in the datasheet,
422+
* it is suspected that because the sensor is reset, it doesn't explicitly send
423+
* an ACK. Thus, don't check the return code.
424+
*/
425+
tsl2591_reg_write(dev, TSL2591_REG_CONFIG, TSL2591_SRESET);
426426

427427
ret = tsl2591_reg_read(dev, TSL2591_REG_ID, &device_id, 1U);
428428
if (ret < 0) {

0 commit comments

Comments
 (0)