IDF5.3 ESP32s3, NAU88C22, delay between SDA and SCL
Posted: Mon Aug 19, 2024 4:06 pm
Dear community,
I am unable to communicate with the NAU88C22 audio codec using I2C on the ESP32s3 under IDF 5.3. Here is the setup: I have a custom-designed PCB with an I2C bus. The ESP32s3 is configured as the I2C master, and there are several I2C slaves on the bus, including an AHT20, an LSM6DS3, an NAU88C22 codec, and an STM32G431. The STM32G431 usually operates as an I2C slave.
Communication with the AHT20, LSM6DS3, and STM32G431 works without any issues using the ESP32s3. However, I am unable to reach the NAU88C22 codec.
However, when I reconfigure the STM32G431 to act as an I2C master and disable the ESP32s3, the NAU88C22 codec is accessible. To further diagnose the issue, I captured the communication with my oscilloscope. I noticed that the SDA line consistently lags behind the SCL line by about 1 microsecond. In contrast, with the STM32G431 as the master, the SCL and SDA lines are perfectly synchronized.
Could this be the cause of the communication issues? How can it be resolved?
This is my very simple test code for the ESP32
Attachment: oscilloscope hardcopy, top=SDA, bottom=SCL, measument= delay of SDA with respect to SCL, ca. 1us
Regards, Klaus
I am unable to communicate with the NAU88C22 audio codec using I2C on the ESP32s3 under IDF 5.3. Here is the setup: I have a custom-designed PCB with an I2C bus. The ESP32s3 is configured as the I2C master, and there are several I2C slaves on the bus, including an AHT20, an LSM6DS3, an NAU88C22 codec, and an STM32G431. The STM32G431 usually operates as an I2C slave.
Communication with the AHT20, LSM6DS3, and STM32G431 works without any issues using the ESP32s3. However, I am unable to reach the NAU88C22 codec.
However, when I reconfigure the STM32G431 to act as an I2C master and disable the ESP32s3, the NAU88C22 codec is accessible. To further diagnose the issue, I captured the communication with my oscilloscope. I noticed that the SDA line consistently lags behind the SCL line by about 1 microsecond. In contrast, with the STM32G431 as the master, the SCL and SDA lines are perfectly synchronized.
Could this be the cause of the communication issues? How can it be resolved?
This is my very simple test code for the ESP32
Code: Select all
#include <driver/i2c_master.h>
#define TAG "MAIN"
#include "esp_log.h"
void app_main(void)
{
i2c_master_bus_handle_t bus_handle;
i2c_master_bus_config_t i2c_mst_config = {
.i2c_port = 0,
.sda_io_num = 4,
.scl_io_num = 5,
.clk_source = I2C_CLK_SRC_DEFAULT,
.glitch_ignore_cnt = 7,
.intr_priority = 3,
.trans_queue_depth = 0,
.flags = {
.enable_internal_pullup = 1,
}};
i2c_new_master_bus(&i2c_mst_config, &bus_handle);
while(true){
i2c_master_probe(bus_handle, 0x1A, 100);
}
for (uint8_t i = 1; i < 128; i++)
{
if (i2c_master_probe(bus_handle, i, 100) != ESP_ERR_NOT_FOUND)
{
ESP_LOGI(TAG, "Found I2C-Device @ 0x%02X", i);
}
}
}
Regards, Klaus