电路图如下,有点小瑕疵ES8388_VMID PIN10/19/20电容没有忘加,查资料应该不影响语言输出,可能噪音大,如果能导致不输出请告诉我一下。
下面是移植过程
1、自定义borad
复制lyrat_v4_3 board文件 改名gm8388_v1_0
2、修改管脚I2C\I2S
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 || port == I2C_NUM_1) {
i2c_config->sda_io_num = GPIO_NUM_40;//SDA
i2c_config->scl_io_num = GPIO_NUM_39;//SCL
} 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, i2s_pin_config_t *i2s_config)
{
AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL);
if (port == I2S_NUM_0) {
i2s_config->bck_io_num = GPIO_NUM_34; // 设置串行时钟引脚 ES8388_SCLK
i2s_config->ws_io_num = GPIO_NUM_35; //设置左右声道的时钟引脚 ES8388_LRCK
i2s_config->data_out_num = GPIO_NUM_37; //ES8388_ASDOUT
i2s_config->data_in_num = GPIO_NUM_36; //ES8388_DSDIN
}
else if (port == I2S_NUM_1) {
i2s_config->bck_io_num = -1;
i2s_config->ws_io_num = -1;
i2s_config->data_out_num = -1;
i2s_config->data_in_num = -1;
}
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;
}
3、mclk管脚
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;
}
gpio_num = (gpio_num_t)GPIO_NUM_33;
ESP_LOGD(TAG, "I2S%d, MCLK output by GPIO%d", i2s_num, gpio_num);
gpio_matrix_out(gpio_num, CLK_I2S_MUX_IDX, 0, 0);
}
切换到工程配置选择开发板
别忘记设置一下flash,这里新手容易出差
编译,若有board头文件提示将自建board路径添加c_cpp_properties.json
"D:/PROJECT/ESP32/esp-adf/components/audio_board/gm8388_v1_0"
编译完成后下载自己board发现,没有声音只有噪音,log过程也对不知道哪里有问题。
I (350) PLAY_MP3_FLASH: [ 1 ] Start audio codec chip
I (370) PLAY_MP3_FLASH: [ 2 ] Create audio pipeline, add all elements to pipeline, and subscribe pipeline event
I (370) PLAY_MP3_FLASH: [2.1] Create mp3 decoder to decode mp3 file and set custom read callback
I (380) PLAY_MP3_FLASH: [2.2] Create i2s stream to write data to codec chip
I (400) PLAY_MP3_FLASH: [2.3] Register all elements to audio pipeline
I (400) PLAY_MP3_FLASH: [2.4] Link it together [mp3_music_read_cb]-->mp3_decoder-->i2s_stream-->[codec_chip]
I (410) PLAY_MP3_FLASH: [ 3 ] Set up event listener
I (410) PLAY_MP3_FLASH: [3.1] Listening event from all elements of pipeline
I (420) PLAY_MP3_FLASH: [ 4 ] Start audio_pipeline
I (430) PLAY_MP3_FLASH: [ 4.1 ] vol level=69
I (430) PLAY_MP3_FLASH: [ 4.2 ] vol level=100
I (450) PLAY_MP3_FLASH: [ * ] Receive music info from mp3 decoder, sample_rates=44100, bits=16, ch=2
I (7220) PLAY_MP3_FLASH: [ 5 ] Stop audio_pipeline
E (7220) AUDIO_ELEMENT: [mp3] Element already stopped
E (7220) AUDIO_ELEMENT: [i2s] Element already stopped
W (7220) AUDIO_PIPELINE: There are no listener registered
W (7230) AUDIO_ELEMENT: [i2s] Element has not create when AUDIO_ELEMENT_TERMINATE
W (7240) AUDIO_ELEMENT: [mp3] Element has not create when AUDIO_ELEMENT_TERMINATE
切换到8311开发板可以播放,log和上面相同。
ESP32S2管脚映射
这里主要问题是我不确定MCLK 放到S2的PIN33是否合适,查资料好像没有时钟管脚约束了,如果这里有问题请告知。ESP32S2+ES8388移植过程及问题
-
- Posts: 4
- Joined: Wed Mar 02, 2022 12:44 am
Re: ESP32S2+ES8388移植过程及问题
I2S的MCLK引脚不能用GPIO33的,只能选用GPIO0、 GPIO1、GPIO2这3个引脚,请参考文档。
Who is online
Users browsing this forum: No registered users and 18 guests