esp-adf
esp-adf copied to clipboard
visualcode 1.82.2 error compile (AUD-4918)
Audio development kit esp32 audio kit v2.2 a221 Using an IDE?: VSCode Power supply: USB
hi guys, using windows 11 with the latest version of vlc, I can't compile everything and get the error: I don't know if it's related to the new versions, but I updated everything, reinstalled everything and I can't find the error. thanks https://nopaste.net/yrCwRnR9DT
@Nexet Which ADF and IDF versions are used? And did you select your board before building?
@jason-mao esp-idf 5.1.1 release version ,the adf version is the latest, download visualcode via the command. yes I selected esp32 as the board. the problem exists after copying the audio kit files, before editing I can compile, if I copy these I have the problem. https://github.com/Ai-Thinker-Open/ESP32-A1S-AudioKit
I followed this video step by step, but the error is always the same, I try to compile with the modified files and it gives an error. https://www.youtube.com/watch?v=2eKuLPoECL0&t=358s
Hi @Nexet ESP-IDF v5.1.1 currently requires ESP-ADF 2.6 or master, but ESP32-A1S-AudioKit is not yet adapted to the latest ESP-ADF and ESP-IDF 5.x.
I modified board_def.h
and board_pins_config.c
and they compile correctly. Here are the two files below. You also need to change other configurations such as SDcard PINs according to the board design to make ESP-ADF and ESP-IDF work properly.
You can also refer to $ADF_PATH/components/audio_board/
to modify the board support files.
board_def.h
/*
* @Author: your name
* @Date: 2020-01-26 10:13:06
* @LastEditTime : 2020-01-28 19:24:42
* @LastEditors : Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \esp-adf\components\audio_board\aithinker\board_def.h
*/
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD>
*
* 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_
/* SD card related */
#define SD_CARD_INTR_GPIO GPIO_NUM_34
#define SD_CARD_INTR_SEL GPIO_SEL_34
#define SD_CARD_OPEN_FILE_NUM_MAX 5
#define ESP_SD_PIN_CLK -1 // Please configure to your settings
#define ESP_SD_PIN_CMD -1 // Please configure to your settings
#define ESP_SD_PIN_D0 -1 // Please configure to your settings
#define ESP_SD_PIN_D3 -1 // Please configure to your settings
#define HEADPHONE_DETECT GPIO_NUM_5
#define PA_ENABLE_GPIO GPIO_NUM_21
#define GREEN_LED_GPIO GPIO_NUM_22
#define BLUE_LED_GPIO GPIO_NUM_19
#define BUTTON_REC_ID GPIO_NUM_36
#define BUTTON_MODE_ID GPIO_NUM_13
/* Touch pad related */
#define TOUCH_SEL_SET GPIO_NUM_19 // Please configure to your settings
#define TOUCH_SEL_PLAY GPIO_NUM_23 // Please configure to your settings
#define TOUCH_SEL_VOLUP GPIO_NUM_18 // Please configure to your settings
#define TOUCH_SEL_VOLDWN GPIO_NUM_5 // Please configure to your settings
#define TOUCH_SET GPIO_NUM_19
#define TOUCH_PLAY GPIO_NUM_23
#define TOUCH_VOLUP GPIO_NUM_18
#define TOUCH_VOLDWN GPIO_NUM_5
#define BOARD_PA_GAIN (10) // Adapt to esp-adf
extern audio_hal_func_t AUDIO_CODEC_AC101_CODEC_HANDLE;
#define AUDIO_CODEC_DEFAULT_CONFIG() { \
.adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \
.dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \
.codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \
.i2s_iface = { \
.mode = AUDIO_HAL_MODE_SLAVE, \
.fmt = AUDIO_HAL_I2S_NORMAL, \
.samples = AUDIO_HAL_48K_SAMPLES, \
.bits = AUDIO_HAL_BIT_LENGTH_16BITS, \
}, \
};
#endif
board_pins_config.c
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD>
*
* 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 <string.h>
#include "board.h"
#include "audio_error.h"
#include "audio_mem.h"
static const char *TAG = "A1S";
esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config)
{
AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL);
if (port == I2C_NUM_0)
{
i2c_config->sda_io_num = GPIO_NUM_33;
i2c_config->scl_io_num = GPIO_NUM_32;
ESP_LOGI(TAG, "i2c port configured!!!!");
}
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) // Adapt to new esp-adf version
{
AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL);
if (port == I2S_NUM_0)
{
i2s_config->bck_io_num = GPIO_NUM_27;
i2s_config->ws_io_num = GPIO_NUM_26;
i2s_config->data_out_num = GPIO_NUM_25;
i2s_config->data_in_num = GPIO_NUM_35;
ESP_LOGI(TAG, "i2s port configured!!!!");
}
else
{
memset(i2s_config, -1, sizeof(i2s_pin_config_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 = GPIO_NUM_23;
spi_config->miso_io_num = -1;
spi_config->sclk_io_num = GPIO_NUM_18;
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;
}
// Adapt to new esp-adf version
// esp_err_t i2s_mclk_gpio_select(i2s_port_t i2s_num, gpio_num_t gpio_num)
// {
// if (i2s_num >= I2S_NUM_MAX)
// {
// ESP_LOGE(TAG, "Does not support i2s number(%d)", i2s_num);
// return ESP_ERR_INVALID_ARG;
// }
// if (gpio_num != GPIO_NUM_0 && gpio_num != GPIO_NUM_1 && gpio_num != GPIO_NUM_3)
// {
// ESP_LOGE(TAG, "Only support GPIO0/GPIO1/GPIO3, gpio_num:%d", gpio_num);
// return ESP_ERR_INVALID_ARG;
// }
// if (i2s_num == I2S_NUM_0)
// {
// if (gpio_num == GPIO_NUM_0)
// {
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1);
// WRITE_PERI_REG(PIN_CTRL, 0xFFF0);
// }
// else if (gpio_num == GPIO_NUM_1)
// {
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3);
// WRITE_PERI_REG(PIN_CTRL, 0xF0F0);
// }
// else
// {
// PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2);
// WRITE_PERI_REG(PIN_CTRL, 0xFF00);
// }
// }
// return ESP_OK;
// }
// input-output pins
int8_t get_headphone_detect_gpio(void)
{
return HEADPHONE_DETECT;
}
int8_t get_pa_enable_gpio(void)
{
return PA_ENABLE_GPIO;
}
// led pins
int8_t get_green_led_gpio(void)
{
return GREEN_LED_GPIO;
}
int8_t get_blue_led_gpio(void)
{
return BLUE_LED_GPIO;
}
// button pins
int8_t get_input_rec_id(void)
{
return BUTTON_REC_ID;
}
int8_t get_input_mode_id(void)
{
return BUTTON_MODE_ID;
}
// touch pins
int8_t get_input_set_id(void)
{
return TOUCH_SET;
}
int8_t get_input_play_id(void)
{
return TOUCH_PLAY;
}
int8_t get_input_volup_id(void)
{
return TOUCH_VOLUP;
}
int8_t get_input_voldown_id(void)
{
return TOUCH_VOLDWN;
}
// sdcard
int8_t get_sdcard_intr_gpio(void){
return SD_CARD_INTR_GPIO;
}
int8_t get_sdcard_open_file_num_max(void)
{
return SD_CARD_OPEN_FILE_NUM_MAX;
}
Hi @Nexet ESP-IDF v5.1.1 currently requires ESP-ADF 2.6 or master, but ESP32-A1S-AudioKit is not yet adapted to the latest ESP-ADF and ESP-IDF 5.x.
I modified
board_def.h
andboard_pins_config.c
and they compile correctly. Here are the two files below. You also need to change other configurations such as SDcard PINs according to the board design to make ESP-ADF and ESP-IDF work properly.You can also refer to
$ADF_PATH/components/audio_board/
to modify the board support files.board_def.h
/* * @Author: your name * @Date: 2020-01-26 10:13:06 * @LastEditTime : 2020-01-28 19:24:42 * @LastEditors : Please set LastEditors * @Description: In User Settings Edit * @FilePath: \esp-adf\components\audio_board\aithinker\board_def.h */ /* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * 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_ /* SD card related */ #define SD_CARD_INTR_GPIO GPIO_NUM_34 #define SD_CARD_INTR_SEL GPIO_SEL_34 #define SD_CARD_OPEN_FILE_NUM_MAX 5 #define ESP_SD_PIN_CLK -1 // Please configure to your settings #define ESP_SD_PIN_CMD -1 // Please configure to your settings #define ESP_SD_PIN_D0 -1 // Please configure to your settings #define ESP_SD_PIN_D3 -1 // Please configure to your settings #define HEADPHONE_DETECT GPIO_NUM_5 #define PA_ENABLE_GPIO GPIO_NUM_21 #define GREEN_LED_GPIO GPIO_NUM_22 #define BLUE_LED_GPIO GPIO_NUM_19 #define BUTTON_REC_ID GPIO_NUM_36 #define BUTTON_MODE_ID GPIO_NUM_13 /* Touch pad related */ #define TOUCH_SEL_SET GPIO_NUM_19 // Please configure to your settings #define TOUCH_SEL_PLAY GPIO_NUM_23 // Please configure to your settings #define TOUCH_SEL_VOLUP GPIO_NUM_18 // Please configure to your settings #define TOUCH_SEL_VOLDWN GPIO_NUM_5 // Please configure to your settings #define TOUCH_SET GPIO_NUM_19 #define TOUCH_PLAY GPIO_NUM_23 #define TOUCH_VOLUP GPIO_NUM_18 #define TOUCH_VOLDWN GPIO_NUM_5 #define BOARD_PA_GAIN (10) // Adapt to esp-adf extern audio_hal_func_t AUDIO_CODEC_AC101_CODEC_HANDLE; #define AUDIO_CODEC_DEFAULT_CONFIG() { \ .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ .i2s_iface = { \ .mode = AUDIO_HAL_MODE_SLAVE, \ .fmt = AUDIO_HAL_I2S_NORMAL, \ .samples = AUDIO_HAL_48K_SAMPLES, \ .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ }, \ }; #endif
board_pins_config.c
/* * ESPRESSIF MIT License * * Copyright (c) 2019 <ESPRESSIF SYSTEMS (SHANGHAI) CO., LTD> * * 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 <string.h> #include "board.h" #include "audio_error.h" #include "audio_mem.h" static const char *TAG = "A1S"; esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); if (port == I2C_NUM_0) { i2c_config->sda_io_num = GPIO_NUM_33; i2c_config->scl_io_num = GPIO_NUM_32; ESP_LOGI(TAG, "i2c port configured!!!!"); } 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) // Adapt to new esp-adf version { AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); if (port == I2S_NUM_0) { i2s_config->bck_io_num = GPIO_NUM_27; i2s_config->ws_io_num = GPIO_NUM_26; i2s_config->data_out_num = GPIO_NUM_25; i2s_config->data_in_num = GPIO_NUM_35; ESP_LOGI(TAG, "i2s port configured!!!!"); } else { memset(i2s_config, -1, sizeof(i2s_pin_config_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 = GPIO_NUM_23; spi_config->miso_io_num = -1; spi_config->sclk_io_num = GPIO_NUM_18; 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; } // Adapt to new esp-adf version // esp_err_t i2s_mclk_gpio_select(i2s_port_t i2s_num, gpio_num_t gpio_num) // { // if (i2s_num >= I2S_NUM_MAX) // { // ESP_LOGE(TAG, "Does not support i2s number(%d)", i2s_num); // return ESP_ERR_INVALID_ARG; // } // if (gpio_num != GPIO_NUM_0 && gpio_num != GPIO_NUM_1 && gpio_num != GPIO_NUM_3) // { // ESP_LOGE(TAG, "Only support GPIO0/GPIO1/GPIO3, gpio_num:%d", gpio_num); // return ESP_ERR_INVALID_ARG; // } // if (i2s_num == I2S_NUM_0) // { // if (gpio_num == GPIO_NUM_0) // { // PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); // WRITE_PERI_REG(PIN_CTRL, 0xFFF0); // } // else if (gpio_num == GPIO_NUM_1) // { // PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); // WRITE_PERI_REG(PIN_CTRL, 0xF0F0); // } // else // { // PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); // WRITE_PERI_REG(PIN_CTRL, 0xFF00); // } // } // return ESP_OK; // } // input-output pins int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } // led pins int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } int8_t get_blue_led_gpio(void) { return BLUE_LED_GPIO; } // button pins int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } // touch pins int8_t get_input_set_id(void) { return TOUCH_SET; } int8_t get_input_play_id(void) { return TOUCH_PLAY; } int8_t get_input_volup_id(void) { return TOUCH_VOLUP; } int8_t get_input_voldown_id(void) { return TOUCH_VOLDWN; } // sdcard int8_t get_sdcard_intr_gpio(void){ return SD_CARD_INTR_GPIO; } int8_t get_sdcard_open_file_num_max(void) { return SD_CARD_OPEN_FILE_NUM_MAX; }
thanks for the help, were you able to complete on the new version? because I have the same problem with your files too.
Hi @Nexet To solve the problem of adapting to the new version, the recommended method is to copy the board support files that are already supported by ESP-ADF and then modify them.
You can copy $ADF_PATH/components/audio_board/lyrat_v4_3/
to audio_board
folder and rename it. Then follow the module tutorial to add your board to ESP-ADF.
After that, modify the PINs and codec configuration according to the hardware design. You can also refer to the old version file or existing files in $ADF_PATH/components/audio_board/
.