Skip to content

Commit

Permalink
Merge branch 'bugfix/improve_es8311_i2c_stability' into 'master'
Browse files Browse the repository at this point in the history
audio_hal: Improve ES8311 I2C stability

See merge request adf/esp-adf-internal!1370
  • Loading branch information
jason-mao committed Jan 20, 2025
2 parents 93a56fc + 45d3c3e commit 8fc8a4a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
7 changes: 6 additions & 1 deletion components/audio_hal/driver/es8311/es8311.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ esp_err_t es8311_codec_init(audio_hal_codec_config_t *codec_cfg)
esp_err_t ret = ESP_OK;
i2c_init(); // ESP32 in master mode

/* Enhance ES8311 I2C noise immunity */
ret |= es8311_write_reg(ES8311_GPIO_REG44, 0x08);
/* Due to occasional failures during the first I2C write with the ES8311 chip, a second write is performed to ensure reliability */
ret |= es8311_write_reg(ES8311_GPIO_REG44, 0x08);

ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, 0x30);
ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG02, 0x00);
ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG03, 0x10);
Expand Down Expand Up @@ -667,7 +672,7 @@ esp_err_t es8311_start(es_module_t mode)
ret |= es8311_write_reg(ES8311_GP_REG45, 0x00);

/* set internal reference signal (ADCL + DACR) */
ret |= es8311_write_reg(ES8311_GPIO_REG44, 0x50);
ret |= es8311_write_reg(ES8311_GPIO_REG44, 0x58);

return ret;
}
Expand Down
7 changes: 7 additions & 0 deletions components/esp_codec_dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## v1.3.4

### Bug Fixes

- Enhance ES8311 I2C noise immunity


## v1.3.3

### Bug Fixes
Expand Down
10 changes: 8 additions & 2 deletions components/esp_codec_dev/device/es8311/es8311.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,12 @@ static int es8311_open(const audio_codec_if_t *h, void *cfg, int cfg_size)
}
int regv;
int ret = ESP_CODEC_DEV_OK;

/* Enhance ES8311 I2C noise immunity */
ret |= es8311_write_reg(codec, ES8311_GPIO_REG44, 0x08);
/* Due to occasional failures during the first I2C write with the ES8311 chip, a second write is performed to ensure reliability */
ret |= es8311_write_reg(codec, ES8311_GPIO_REG44, 0x08);

ret |= es8311_write_reg(codec, ES8311_CLK_MANAGER_REG01, 0x30);
ret |= es8311_write_reg(codec, ES8311_CLK_MANAGER_REG02, 0x00);
ret |= es8311_write_reg(codec, ES8311_CLK_MANAGER_REG03, 0x10);
Expand Down Expand Up @@ -541,9 +547,9 @@ static int es8311_open(const audio_codec_if_t *h, void *cfg, int cfg_size)
ret |= es8311_write_reg(codec, ES8311_ADC_REG1C, 0x6A);
if (codec_cfg->no_dac_ref == false) {
/* set internal reference signal (ADCL + DACR) */
ret |= es8311_write_reg(codec, ES8311_GPIO_REG44, 0x50);
ret |= es8311_write_reg(codec, ES8311_GPIO_REG44, 0x58);
} else {
ret |= es8311_write_reg(codec, ES8311_GPIO_REG44, 0);
ret |= es8311_write_reg(codec, ES8311_GPIO_REG44, 0x08);
}
if (ret != 0) {
return ESP_CODEC_DEV_WRITE_FAIL;
Expand Down
2 changes: 1 addition & 1 deletion components/esp_codec_dev/idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 1.3.3
version: 1.3.4
description: Audio codec device support for Espressif SOC
url: https://github.com/espressif/esp-adf/tree/master/components/esp_codec_dev

Expand Down

0 comments on commit 8fc8a4a

Please sign in to comment.