diff --git a/components/audio_board/CMakeLists.txt b/components/audio_board/CMakeLists.txt index 2dfb3c64e..fa01df9b6 100644 --- a/components/audio_board/CMakeLists.txt +++ b/components/audio_board/CMakeLists.txt @@ -51,6 +51,15 @@ set(COMPONENT_SRCS ) endif() +if (CONFIG_ESP32_S3_KORVO1_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_S3_KORVO1_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_s3_korvo1) +set(COMPONENT_SRCS +./esp32_s3_korvo1/board.c +./esp32_s3_korvo1/board_pins_config.c +) +endif() + if (CONFIG_ESP32_KORVO_DU1906_BOARD) message(STATUS "Current board name is " CONFIG_ESP32_KORVO_DU1906_BOARD) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_korvo_du1906) diff --git a/components/audio_board/Kconfig.projbuild b/components/audio_board/Kconfig.projbuild index 54e984197..c93083d82 100644 --- a/components/audio_board/Kconfig.projbuild +++ b/components/audio_board/Kconfig.projbuild @@ -17,6 +17,8 @@ config ESP_LYRATD_MSC_V2_2_BOARD bool "ESP32-LyraTD-MSC V2.2" config ESP_LYRAT_MINI_V1_1_BOARD bool "ESP32-Lyrat-Mini V1.1" +config ESP32_S3_KORVO1_BOARD + bool "ESP32-S3-Korvo-1" config ESP32_KORVO_DU1906_BOARD bool "ESP32_KORVO_DU1906" config ESP32_S2_KALUGA_1_V1_2_BOARD diff --git a/components/audio_board/esp32_s3_korvo1/board.c b/components/audio_board/esp32_s3_korvo1/board.c new file mode 100644 index 000000000..1322c4bff --- /dev/null +++ b/components/audio_board/esp32_s3_korvo1/board.c @@ -0,0 +1,127 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, + * it is free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#include "esp_log.h" +#include "board.h" +#include "audio_mem.h" +#include "periph_sdcard.h" +#include "periph_adc_button.h" +#include "tca9554.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) +{ + ESP_LOGD(TAG, "Initializing the board"); + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = (audio_board_handle_t) audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + board_handle->adc_hal = audio_board_adc_init(); + ESP_LOGD(TAG, "Initializing the board done"); + return board_handle; +} + +audio_hal_handle_t audio_board_adc_init(void) +{ + ESP_LOGD(TAG, "Initializing the adc"); + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_ES7210_CONFIG(); + audio_hal_handle_t adc_hal = audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES7210_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, adc_hal, return NULL); + return adc_hal; +} + +audio_hal_handle_t audio_board_codec_init(void) +{ + ESP_LOGD(TAG, "Initializing the codec"); + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_ES8311_CONFIG(); + audio_hal_handle_t codec_hal = audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8311_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) +{ + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.total_steps = 6; + adc_btn_tag.adc_ch = ADC1_CHANNEL_7; + int btn_array[7] = {190, 600, 1000, 1375, 1775, 2195, 3000}; + adc_btn_tag.adc_level_step = btn_array; + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + return esp_periph_start(set, adc_btn_handle); +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode) +{ + if (mode != SD_MODE_1_LINE) { + ESP_LOGE(TAG, "Current board only support 1-line SD mode!"); + return ESP_FAIL; + } + periph_sdcard_cfg_t sdcard_cfg = { + .root = "/sdcard", + .card_detect_pin = get_sdcard_intr_gpio(), + .mode = mode + }; + esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); + esp_err_t ret = esp_periph_start(set, sdcard_handle); + int retry_time = 5; + bool mount_flag = false; + while (retry_time --) { + if (periph_sdcard_is_mounted(sdcard_handle)) { + mount_flag = true; + break; + } else { + vTaskDelay(500 / portTICK_PERIOD_MS); + } + } + if (mount_flag == false) { + ESP_LOGE(TAG, "Sdcard mount failed"); + return ESP_FAIL; + } + return ret; +} + +audio_board_handle_t audio_board_get_handle(void) +{ + return board_handle; +} + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) +{ + esp_err_t ret = ESP_OK; + ret |= audio_hal_deinit(audio_board->audio_hal); + ret |= audio_hal_deinit(audio_board->adc_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_s3_korvo1/board.h b/components/audio_board/esp32_s3_korvo1/board.h new file mode 100644 index 000000000..707c8cbd6 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo1/board.h @@ -0,0 +1,138 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, + * it is free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "esp_peripherals.h" +#include "display_service.h" +#include "periph_sdcard.h" +#include "periph_lcd.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ + audio_hal_handle_t adc_hal; /*!< adc hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize adc + * + * @return The adc hal handle + */ +audio_hal_handle_t audio_board_adc_init(void); + +/** + * @brief Initialize lcd peripheral + * + * @param set The handle of esp_periph_set_handle_t + * @param cb The `on_color_trans_done` callback in `esp_lcd_panel_io_spi_config_t` + * + * @return The `esp_lcd_panel_handle_t` handle + */ +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_blue_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_s3_korvo1/board_def.h b/components/audio_board/esp32_s3_korvo1/board_def.h new file mode 100644 index 000000000..9f7a95658 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo1/board_def.h @@ -0,0 +1,141 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, + * it is free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief LED Function Definition + */ +#define FUNC_SYS_LEN_EN (0) + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 1 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 + +#define ESP_SD_PIN_CLK GPIO_NUM_18 +#define ESP_SD_PIN_CMD GPIO_NUM_17 +#define ESP_SD_PIN_D0 GPIO_NUM_16 +#define ESP_SD_PIN_D1 -1 +#define ESP_SD_PIN_D2 -1 +#define ESP_SD_PIN_D3 GPIO_NUM_15 +#define ESP_SD_PIN_D4 -1 +#define ESP_SD_PIN_D5 -1 +#define ESP_SD_PIN_D6 -1 +#define ESP_SD_PIN_D7 -1 +#define ESP_SD_PIN_CD -1 +#define ESP_SD_PIN_WP -1 + + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define ES8311_MCLK_SOURCE (1) /* 0 From MCLK of esp32 1 From BCLK */ +#define HEADPHONE_DETECT (-1) +#define PA_ENABLE_GPIO GPIO_NUM_38 +#define CODEC_I2S_PORT (0) +#define CODEC_ADC_I2S_PORT (1) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_32BIT +#define CODEC_ADC_SAMPLE_RATE (16000) +#define RECORD_HARDWARE_AEC (true) +#define BOARD_PA_GAIN (6) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE; +extern audio_hal_func_t AUDIO_CODEC_ES7210_DEFAULT_HANDLE; + +#define AUDIO_CODEC_ES8311_CONFIG(){ \ + .adc_input = AUDIO_HAL_ADC_INPUT_ALL, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_DECODE, \ + .i2s_iface = { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_16K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ +}; +#define AUDIO_CODEC_ES7210_CONFIG(){ \ + .adc_input = AUDIO_HAL_ADC_INPUT_ALL, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_ENCODE, \ + .i2s_iface = { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_16K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_32BITS, \ + }, \ +}; + + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define INPUT_KEY_NUM 6 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 + +#define INPUT_KEY_DEFAULT_INFO() { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MUTE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ +} + +#endif diff --git a/components/audio_board/esp32_s3_korvo1/board_pins_config.c b/components/audio_board/esp32_s3_korvo1/board_pins_config.c new file mode 100644 index 000000000..f68b4b1ae --- /dev/null +++ b/components/audio_board/esp32_s3_korvo1/board_pins_config.c @@ -0,0 +1,158 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case, + * it is free of charge, to any person obtaining a copy of this software and associated + * documentation files (the "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the Software is furnished + * to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#include "esp_log.h" +#include "driver/gpio.h" +#include +#include "board.h" +#include "audio_error.h" +#include "audio_mem.h" +#include "hal/gpio_types.h" +#include "soc/soc_caps.h" + +static const char *TAG = "ESP32_S3_KORVO_1"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) +{ + ESP_LOGI(TAG, "i2c port %d init", port); + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0) { + i2c_config->sda_io_num = GPIO_NUM_1; + i2c_config->scl_io_num = GPIO_NUM_2; + i2c_config->master.clk_speed = 600000; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) +{ + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0) { // Codec + i2s_config->bck_io_num = GPIO_NUM_40; + i2s_config->ws_io_num = GPIO_NUM_41; + i2s_config->data_out_num = GPIO_NUM_39; + i2s_config->data_in_num = GPIO_NUM_NC; + i2s_config->mck_io_num = GPIO_NUM_42; + } else if (port == I2S_NUM_1) { // ADC + i2s_config->bck_io_num = GPIO_NUM_10; + i2s_config->ws_io_num = GPIO_NUM_9; + i2s_config->data_out_num = GPIO_NUM_NC; + i2s_config->data_in_num = GPIO_NUM_11; + i2s_config->mck_io_num = GPIO_NUM_20; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + + return ESP_OK; +} + +esp_err_t get_spi_pins(spi_bus_config_t *spi_config, spi_device_interface_config_t *spi_device_interface_config) +{ + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) +{ + return SDCARD_INTR_GPIO; +} + +int8_t get_sdcard_open_file_num_max(void) +{ + return SDCARD_OPEN_FILE_NUM_MAX; +} + +int8_t get_sdcard_power_ctrl_gpio(void) +{ + return SDCARD_PWR_CTRL; +} + +// input-output pins + +int8_t get_headphone_detect_gpio(void) +{ + return HEADPHONE_DETECT; +} + +int8_t get_pa_enable_gpio(void) +{ + return PA_ENABLE_GPIO; +} + +// adc button id + +int8_t get_input_rec_id(void) +{ + return BUTTON_REC_ID; +} + +int8_t get_input_mode_id(void) +{ + return BUTTON_MODE_ID; +} + +int8_t get_input_set_id(void) +{ + return BUTTON_SET_ID; +} + +int8_t get_input_play_id(void) +{ + return BUTTON_PLAY_ID; +} + +int8_t get_input_volup_id(void) +{ + return BUTTON_VOLUP_ID; +} + +int8_t get_input_voldown_id(void) +{ + return BUTTON_VOLDOWN_ID; +} + +int8_t get_es8311_mclk_src(void) +{ + return ES8311_MCLK_SOURCE; +} diff --git a/components/audio_hal/driver/es7210/es7210.c b/components/audio_hal/driver/es7210/es7210.c index 005c40381..a72273447 100644 --- a/components/audio_hal/driver/es7210/es7210.c +++ b/components/audio_hal/driver/es7210/es7210.c @@ -38,7 +38,7 @@ #define FROM_CLOCK_DOUBLE_PIN 1 /* ES7210 mic select */ -#if CONFIG_ESP32_S3_KORVO2_V3_BOARD +#if CONFIG_ESP32_S3_KORVO2_V3_BOARD || CONFIG_ESP32_S3_KORVO1_BOARD #define ES7210_MIC_SELECT ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 | ES7210_INPUT_MIC3 #else #define ES7210_MIC_SELECT ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 diff --git a/examples/audio_processing/pipeline_passthru/main/passthru.c b/examples/audio_processing/pipeline_passthru/main/passthru.c index c4d69224e..3f92a4ccd 100755 --- a/examples/audio_processing/pipeline_passthru/main/passthru.c +++ b/examples/audio_processing/pipeline_passthru/main/passthru.c @@ -28,7 +28,7 @@ void app_main(void) ESP_LOGI(TAG, "[ 1 ] Start codec chip"); audio_board_handle_t board_handle = audio_board_init(); -#ifdef CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD +#if defined CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD || defined CONFIG_ESP32_S3_KORVO1_BOARD audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_BOTH, AUDIO_HAL_CTRL_START); #else audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_LINE_IN, AUDIO_HAL_CTRL_START); @@ -47,6 +47,9 @@ void app_main(void) ESP_LOGI(TAG, "[3.2] Create i2s stream to read data from codec chip"); i2s_stream_cfg_t i2s_cfg_read = I2S_STREAM_CFG_DEFAULT(); i2s_cfg_read.type = AUDIO_STREAM_READER; +#if defined CONFIG_ESP32_S3_KORVO1_BOARD + i2s_cfg_read.i2s_port = I2S_NUM_1; +#endif i2s_stream_reader = i2s_stream_init(&i2s_cfg_read); ESP_LOGI(TAG, "[3.3] Register all elements to audio pipeline"); diff --git a/examples/audio_processing/pipeline_passthru/sdkconfig.defaults.esp32s3 b/examples/audio_processing/pipeline_passthru/sdkconfig.defaults.esp32s3 new file mode 100644 index 000000000..e6b0cd19a --- /dev/null +++ b/examples/audio_processing/pipeline_passthru/sdkconfig.defaults.esp32s3 @@ -0,0 +1,17 @@ +CONFIG_IDF_CMAKE=y +CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET="esp32s3" +CONFIG_IDF_TARGET_ESP32S3=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0009 + +# +# SDK tool configuration +# +CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" +# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set +# end of SDK tool configuration + +# +# Audio HAL +# +CONFIG_ESP32_S3_KORVO2_V3_BOARD=y diff --git a/examples/speech_recognition/vad/main/example_vad_main.c b/examples/speech_recognition/vad/main/example_vad_main.c index c23e925e2..2fd351113 100644 --- a/examples/speech_recognition/vad/main/example_vad_main.c +++ b/examples/speech_recognition/vad/main/example_vad_main.c @@ -49,7 +49,7 @@ void app_main() i2s_stream_cfg_t i2s_cfg = I2S_STREAM_CFG_DEFAULT(); i2s_cfg.i2s_config.sample_rate = 48000; i2s_cfg.type = AUDIO_STREAM_READER; -#if defined CONFIG_ESP_LYRAT_MINI_V1_1_BOARD +#if defined(CONFIG_ESP_LYRAT_MINI_V1_1_BOARD) || defined(CONFIG_ESP32_S3_KORVO1_BOARD) i2s_cfg.i2s_port = 1; #if (ESP_IDF_VERSION <= ESP_IDF_VERSION_VAL(4, 0, 0)) i2s_cfg.i2s_config.channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT;