Strange capture of I2C on logic analyzer
Posted: Mon Jul 17, 2017 9:06 am
Hi, During debugging code interacting with DS3231 over I2C I noticed that my Saleae analyzer cannot decode I2C signals.
I've minimized example to the following (just send address) to make sure analyzer works:
It output success like:
But analyzer does not show address sent
Wiring
I've minimized example to the following (just send address) to make sure analyzer works:
Code: Select all
#include "freertos/FreeRTOS.h"
#include "esp_system.h"
#include "driver/gpio.h"
#include "driver/i2c.h"
#define DS3231_ADDR 0x68
#define ACK_CHECK_EN 0x1
#define SDA_PIN 18
#define SCL_PIN 19
void app_main(void)
{
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = SDA_PIN;
conf.scl_io_num = SCL_PIN;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = 100000;
i2c_param_config(I2C_NUM_0, &conf);
i2c_driver_install(I2C_NUM_0, I2C_MODE_MASTER, 0, 0, 0);
while (true) {
esp_err_t rc;
i2c_cmd_handle_t cmd = i2c_cmd_link_create();
i2c_master_start(cmd);
i2c_master_write_byte(cmd, (DS3231_ADDR << 1) | I2C_MASTER_WRITE, ACK_CHECK_EN);
i2c_master_stop(cmd);
rc = i2c_master_cmd_begin(I2C_NUM_0, cmd, 10 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
printf("address=0x%02x, rc=%d (0x%02x)\n", DS3231_ADDR, rc, rc);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
Code: Select all
address=0x68, rc=0 (0x00)