Problem reading I2C sensor
Posted: Sun Feb 19, 2017 2:59 pm
Hello,
i´ve been trying to get data out of a SDP600 differential pressure sensor from Sensirion for a couple of days now.
The problem is that i can not read back data at all. The sensor is wired correctly and answering a scan request. To start the transmission of measuring data, you have to write a command (0xF1) to the sensor, then trigger the reading of 2-3 bytes (if additional crc byte is needed) and then wait for about 5ms while the sensor is processing the data.
All these steps are working but when the sensor is finished (SCA and SDA are released to high), the ESP32 does not read back any data (see attached picture from logic analyzer).
Does anyone have an idea how to solve this and read back the data?
Code:
Pictures from logic analyzer:
kind regards,
Markus
i´ve been trying to get data out of a SDP600 differential pressure sensor from Sensirion for a couple of days now.
The problem is that i can not read back data at all. The sensor is wired correctly and answering a scan request. To start the transmission of measuring data, you have to write a command (0xF1) to the sensor, then trigger the reading of 2-3 bytes (if additional crc byte is needed) and then wait for about 5ms while the sensor is processing the data.
All these steps are working but when the sensor is finished (SCA and SDA are released to high), the ESP32 does not read back any data (see attached picture from logic analyzer).
Does anyone have an idea how to solve this and read back the data?
Code:
Code: Select all
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (hwaddr << 1) | I2C_MASTER_WRITE, 1 /* expect ack */);
i2c_master_write_byte(cmd, 0xF1, 1);
i2c_master_stop(cmd);
i2c_master_cmd_begin(I2C_NUM_0, cmd, 1000/portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (hwaddr << 1) | I2C_MASTER_READ, 1 /* expect ack */);
i2c_master_stop(cmd);
i2c_master_cmd_begin(I2C_NUM_0, cmd, 1000/portTICK_PERIOD_MS);
i2c_master_start(cmd);
i2c_master_read_byte(cmd, &msb, 1);
i2c_master_read_byte(cmd, &lsb, 1);
i2c_master_read_byte(cmd, &xlsb, 0);
i2c_master_stop(cmd);
i2c_master_cmd_begin(I2C_NUM_0, cmd, 1000/portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
kind regards,
Markus