improve on playback hiccups because of small DMA buffer

- add default values in menuconfig for ADAU1961
- remove bug in main resulting in failed i2s aquisition

Signed-off-by: Karl Osterseher <karli_o@gmx.at>
This commit is contained in:
Karl Osterseher
2024-02-02 20:57:59 +01:00
Unverified
parent 1e3bda9ad0
commit aeb173bda4
5 changed files with 56 additions and 7 deletions

View File

@@ -51,12 +51,14 @@ menu "Custom Audio Board"
menu "I2S master interface" menu "I2S master interface"
config MASTER_I2S_MCLK_PIN config MASTER_I2S_MCLK_PIN
int "Master i2s mclk" int "Master i2s mclk"
default 3 if DAC_ADAU1961
default 0 default 0
help help
Master audio interface master clock. Master audio interface master clock.
config MASTER_I2S_BCK_PIN config MASTER_I2S_BCK_PIN
int "Master i2s bck" int "Master i2s bck"
default 15 if DAC_ADAU1961
default 23 if DAC_MAX98357 default 23 if DAC_MAX98357
default 23 default 23
help help
@@ -64,6 +66,7 @@ menu "Custom Audio Board"
config MASTER_I2S_LRCK_PIN config MASTER_I2S_LRCK_PIN
int "Master i2s lrck" int "Master i2s lrck"
default 13 if DAC_ADAU1961
default 24 if DAC_MAX98357 default 24 if DAC_MAX98357
default 13 default 13
help help
@@ -71,6 +74,7 @@ menu "Custom Audio Board"
config MASTER_I2S_DATAOUT_PIN config MASTER_I2S_DATAOUT_PIN
int "Master i2s data out" int "Master i2s data out"
default 4 if DAC_ADAU1961
default 25 if DAC_MAX98357 default 25 if DAC_MAX98357
default 14 default 14
help help

View File

@@ -108,7 +108,7 @@ static esp_err_t player_setup_i2s(i2s_port_t i2sNum,
int fi2s_clk; int fi2s_clk;
#if USE_SAMPLE_INSERTION #if USE_SAMPLE_INSERTION
i2sDmaBufMaxLen = 6; i2sDmaBufMaxLen = 12;
i2sDmaBufCnt = CHNK_CTRL_CNT * (setting->chkInFrames / i2sDmaBufCnt = CHNK_CTRL_CNT * (setting->chkInFrames /
i2sDmaBufMaxLen); // 288 * CHNK_CTRL_CNT; i2sDmaBufMaxLen); // 288 * CHNK_CTRL_CNT;
#else #else
@@ -1676,7 +1676,7 @@ static void player_task(void *pvParameters) {
#if USE_SAMPLE_INSERTION #if USE_SAMPLE_INSERTION
// uint32_t sampleSizeInBytes = (uint32_t)(scSet.bits / 8) * // uint32_t sampleSizeInBytes = (uint32_t)(scSet.bits / 8) *
// scSet.ch * (uint32_t)(miniMedian / (1E6 / scSet.sr)); // scSet.ch * (uint32_t)(miniMedian / (1E6 / scSet.sr));
uint32_t sampleSizeInBytes = (scSet.bits / 8) * scSet.ch * 1; uint32_t sampleSizeInBytes = (scSet.bits / 8) * scSet.ch * 2;
if (dir_insert_sample == -1) { if (dir_insert_sample == -1) {
if (i2s_channel_write(tx_chan, p_payload, sampleSizeInBytes, if (i2s_channel_write(tx_chan, p_payload, sampleSizeInBytes,

View File

@@ -2843,6 +2843,14 @@ void app_main(void) {
audio_hal_set_mute(board_handle->audio_hal, audio_hal_set_mute(board_handle->audio_hal,
true); // ensure no noise is sent after firmware crash true); // ensure no noise is sent after firmware crash
#if CONFIG_AUDIO_BOARD_CUSTOM && CONFIG_DAC_ADAU1961
if (tx_chan) {
i2s_channel_disable(tx_chan);
i2s_del_channel(tx_chan);
tx_chan = NULL;
}
#endif
ESP_LOGI(TAG, "init player"); ESP_LOGI(TAG, "init player");
init_player(); init_player();
// setup_ma120(); // setup_ma120();

View File

@@ -1,6 +1,6 @@
# #
# Automatically generated file. DO NOT EDIT. # Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) Project Configuration # Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration
# #
CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined"
CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined"

View File

@@ -358,11 +358,48 @@ CONFIG_USE_SAMPLE_INSERTION=y
# #
# Audio HAL # Audio HAL
# #
# CONFIG_AUDIO_BOARD_CUSTOM is not set CONFIG_AUDIO_BOARD_CUSTOM=y
CONFIG_ESP_LYRAT_V4_3_BOARD=y # CONFIG_ESP_LYRAT_V4_3_BOARD is not set
# CONFIG_ESP_LYRAT_MINI_V1_1_BOARD is not set # CONFIG_ESP_LYRAT_MINI_V1_1_BOARD is not set
# end of Audio HAL # end of Audio HAL
#
# Custom Audio Board
#
# CONFIG_DAC_PCM51XX is not set
# CONFIG_DAC_PCM5102A is not set
# CONFIG_DAC_MA120 is not set
# CONFIG_DAC_MA120X0 is not set
CONFIG_DAC_ADAU1961=y
# CONFIG_DAC_MAX98357 is not set
#
# DAC I2C control interface
#
CONFIG_DAC_I2C_SDA=12
CONFIG_DAC_I2C_SCL=14
CONFIG_DAC_I2C_ADDR=0x70
# end of DAC I2C control interface
#
# I2S master interface
#
CONFIG_MASTER_I2S_MCLK_PIN=3
CONFIG_MASTER_I2S_BCK_PIN=15
CONFIG_MASTER_I2S_LRCK_PIN=13
CONFIG_MASTER_I2S_DATAOUT_PIN=4
# end of I2S master interface
#
# I2S slave interface
#
CONFIG_SLAVE_I2S_MCLK_PIN=0
CONFIG_SLAVE_I2S_BCK_PIN=26
CONFIG_SLAVE_I2S_LRCK_PIN=12
CONFIG_SLAVE_I2S_DATAOUT_PIN=5
# end of I2S slave interface
# end of Custom Audio Board
# #
# ESP32 DSP processor config # ESP32 DSP processor config
# #
@@ -386,8 +423,8 @@ CONFIG_SNTP_SERVER="pool.ntp.org"
# Wifi Configuration # Wifi Configuration
# #
# CONFIG_ENABLE_WIFI_PROVISIONING is not set # CONFIG_ENABLE_WIFI_PROVISIONING is not set
CONFIG_WIFI_SSID="zuhause" CONFIG_WIFI_SSID=""
CONFIG_WIFI_PASSWORD="dErtischlEr" CONFIG_WIFI_PASSWORD=""
CONFIG_WIFI_MAXIMUM_RETRY=0 CONFIG_WIFI_MAXIMUM_RETRY=0
# end of Wifi Configuration # end of Wifi Configuration