forked from espressif/esp-idf
docs(example): added troubleshooting for i2s_es8311 example
Closes https://github.com/espressif/esp-idf/issues/15047
This commit is contained in:
@@ -129,6 +129,11 @@ If you have a logic analyzer, you can use a logic analyzer to grab GPIO signal d
|
||||
| SDOUT |serial data out| GPIO_NUM_18/2 |
|
||||
| SDIN |serial data in | GPIO_NUM_19/3 |
|
||||
|
||||
Other pins like I2C please refer to `example_config.h`.
|
||||
|
||||
Please note that the power amplifier on some development boards (like P4 EV board) are disabled by default, you might need to set the PA_CTRL pin to high to play the music via a speaker.
|
||||
The PA_CTRL pin can be configured by `idf.py menuconfig`, please check if the PA_CTRL pin is correct on your board if the audio can only be played from the earphones but not the speaker.
|
||||
|
||||
### Customize your own music
|
||||
|
||||
The example have contained a piece of music in canon.pcm, if you want to play your own music, you can follow these steps:
|
||||
@@ -150,4 +155,9 @@ The example have contained a piece of music in canon.pcm, if you want to play yo
|
||||
* Hardware connection is not correct: run `idf.py -p PORT monitor`, and reboot your board to see if there are any output logs.
|
||||
* The baud rate for downloading is too high: lower your baud rate in the `menuconfig` menu, and try again.
|
||||
|
||||
* Failed to get audio from specker
|
||||
|
||||
* The PA (Power Amplifier) on some dev-kits might be disabled by default, please check the schematic to see if PA_CTRL is connected to any GPIO or something.
|
||||
* Pull-up the PA_CTRL pin either by setting that GPIO to high or by connecting it to 3.3V with a jump wire should help.
|
||||
|
||||
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
|
||||
|
@@ -56,6 +56,13 @@ menu "Example Configuration"
|
||||
help
|
||||
Set voice volume
|
||||
|
||||
config EXAMPLE_PA_CTRL_IO
|
||||
int "Power Amplifier control IO"
|
||||
default 53 if IDF_TARGET_ESP32P4
|
||||
default -1
|
||||
help
|
||||
Set GPIO number for PA control. Set -1 to disable PA control.
|
||||
|
||||
config EXAMPLE_BSP
|
||||
bool "Enable Board Support Package (BSP) support"
|
||||
default n
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#define EXAMPLE_MCLK_MULTIPLE (384) // If not using 24-bit data width, 256 should be enough
|
||||
#define EXAMPLE_MCLK_FREQ_HZ (EXAMPLE_SAMPLE_RATE * EXAMPLE_MCLK_MULTIPLE)
|
||||
#define EXAMPLE_VOICE_VOLUME CONFIG_EXAMPLE_VOICE_VOLUME
|
||||
#define EXAMPLE_PA_CTRL_IO CONFIG_EXAMPLE_PA_CTRL_IO
|
||||
#if CONFIG_EXAMPLE_MODE_ECHO
|
||||
#define EXAMPLE_MIC_GAIN CONFIG_EXAMPLE_MIC_GAIN
|
||||
#endif
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "driver/i2s_std.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_check.h"
|
||||
#include "es8311.h"
|
||||
@@ -198,6 +199,17 @@ void app_main(void)
|
||||
} else {
|
||||
ESP_LOGI(TAG, "es8311 codec init success");
|
||||
}
|
||||
|
||||
#if EXAMPLE_PA_CTRL_IO >= 0
|
||||
/* Enable PA by setting the PA_CTRL_IO to high, because the power amplifier on some dev-kits are disabled by default */
|
||||
gpio_config_t gpio_cfg = {
|
||||
.pin_bit_mask = (1ULL << EXAMPLE_PA_CTRL_IO),
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
};
|
||||
ESP_ERROR_CHECK(gpio_config(&gpio_cfg));
|
||||
ESP_ERROR_CHECK(gpio_set_level(EXAMPLE_PA_CTRL_IO, 1));
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_MODE_MUSIC
|
||||
/* Play a piece of music in music mode */
|
||||
xTaskCreate(i2s_music, "i2s_music", 4096, NULL, 5, NULL);
|
||||
|
Reference in New Issue
Block a user