mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Merge branch 'fix/i2s_sample_rate_restriction_v6.1' into 'release/v6.1'
fix(i2s): fix test issue on esp32s31 & esp32h4 (v6.1) See merge request espressif/esp-idf!48952
This commit is contained in:
@@ -228,10 +228,6 @@ examples/peripherals/i2s/i2s_codec/i2s_es7210_tdm:
|
||||
disable:
|
||||
- if: SOC_I2S_SUPPORTS_TDM != 1 or (SOC_I2C_SUPPORTED != 1 or SOC_GPSPI_SUPPORTED != 1)
|
||||
reason: rely on I2S TDM mode to receive audio, I2C to config es7210 and SPI to save audio to SD card
|
||||
disable_test:
|
||||
- if: IDF_TARGET in ["esp32h4"]
|
||||
temporary: true
|
||||
reason: cannot pass # TODO: IDF-15609
|
||||
depends_components:
|
||||
- esp_driver_i2s
|
||||
- esp_driver_dma
|
||||
@@ -244,10 +240,6 @@ examples/peripherals/i2s/i2s_codec/i2s_es8311:
|
||||
disable:
|
||||
- if: (SOC_I2S_SUPPORTED != 1 or SOC_I2C_SUPPORTED != 1)
|
||||
reason: rely on I2S STD mode and I2C to config es7210
|
||||
disable_test:
|
||||
- if: IDF_TARGET in ["esp32h4"]
|
||||
temporary: true
|
||||
reason: cannot pass # TODO: IDF-15609
|
||||
depends_components:
|
||||
- esp_driver_dma
|
||||
- esp_driver_i2s
|
||||
|
||||
@@ -29,7 +29,7 @@ Recorded voice will be saved to SD card in `wav` format, and can be played or pr
|
||||
* A SPI SD card module
|
||||
* A SD card reader and a PC (if you want to play recorded voice)
|
||||
|
||||
All the GPIO used in this example can be changed according to your board, by macros `EXAMPLE_xxx_IO` defined at the beginning of [i2s_es7210_record_example.c](main/i2s_es7210_record_example.c).
|
||||
All the GPIO used in this example can be changed according to your board, via `idf.py menuconfig` under `Example Configuration` -> `Example IO Configuration`.
|
||||
|
||||
### Dependency
|
||||
|
||||
@@ -49,7 +49,7 @@ If the dependency is added, you can check `idf_component.yml` for more detail. W
|
||||
idf.py set-target TARGET
|
||||
```
|
||||
|
||||
The configuration macros are defined at the beginning of `main/i2s_es7210_record_example.c`, you can change the configuration macros according to your needs.
|
||||
Run `idf.py menuconfig` to configure GPIO pins and other options under `Example Configuration`.
|
||||
|
||||
### Build and Flash
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
menu "Example Configuration"
|
||||
|
||||
menu "Example IO Configuration"
|
||||
config EXAMPLE_I2C_SDA_IO
|
||||
int "I2C SDA IO"
|
||||
default 1 if IDF_TARGET_ESP32S3
|
||||
default 17 if IDF_TARGET_ESP32H4
|
||||
default 3
|
||||
|
||||
config EXAMPLE_I2C_SCL_IO
|
||||
int "I2C SCL IO"
|
||||
default 16 if IDF_TARGET_ESP32H4
|
||||
default 2
|
||||
|
||||
config EXAMPLE_I2S_MCLK_IO
|
||||
int "I2S MCLK IO"
|
||||
default 20 if IDF_TARGET_ESP32S3
|
||||
default 4 if IDF_TARGET_ESP32P4
|
||||
default 0
|
||||
|
||||
config EXAMPLE_I2S_BCLK_IO
|
||||
int "I2S BCLK IO"
|
||||
default 10 if IDF_TARGET_ESP32S3
|
||||
default 5 if IDF_TARGET_ESP32P4
|
||||
default 4 if IDF_TARGET_ESP32H4
|
||||
default 1
|
||||
|
||||
config EXAMPLE_I2S_WS_IO
|
||||
int "I2S WS IO"
|
||||
default 9 if IDF_TARGET_ESP32S3
|
||||
default 6 if IDF_TARGET_ESP32P4
|
||||
default 5 if IDF_TARGET_ESP32H4
|
||||
default 10
|
||||
|
||||
config EXAMPLE_I2S_DIN_IO
|
||||
int "I2S DIN IO"
|
||||
default 11 if IDF_TARGET_ESP32S3
|
||||
default 7 if IDF_TARGET_ESP32P4
|
||||
default 6 if IDF_TARGET_ESP32H4
|
||||
default 8
|
||||
|
||||
config EXAMPLE_SD_SPI_CLK_IO
|
||||
int "SD card SPI CLK IO"
|
||||
default 18 if IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32P4
|
||||
default 12 if IDF_TARGET_ESP32H4
|
||||
default 5
|
||||
|
||||
config EXAMPLE_SD_SPI_MOSI_IO
|
||||
int "SD card SPI MOSI IO"
|
||||
default 17 if IDF_TARGET_ESP32S3
|
||||
default 19 if IDF_TARGET_ESP32P4
|
||||
default 13 if IDF_TARGET_ESP32H4
|
||||
default 7
|
||||
|
||||
config EXAMPLE_SD_SPI_MISO_IO
|
||||
int "SD card SPI MISO IO"
|
||||
default 16 if IDF_TARGET_ESP32S3
|
||||
default 14 if IDF_TARGET_ESP32P4 || IDF_TARGET_ESP32H4
|
||||
default 6
|
||||
|
||||
config EXAMPLE_SD_SPI_CS_IO
|
||||
int "SD card SPI CS IO"
|
||||
default 15 if IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32H4
|
||||
default 17 if IDF_TARGET_ESP32P4
|
||||
default 4
|
||||
|
||||
endmenu
|
||||
|
||||
endmenu
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/* I2C port and GPIOs */
|
||||
#define EXAMPLE_I2C_NUM (0)
|
||||
#define EXAMPLE_I2C_SDA_IO CONFIG_EXAMPLE_I2C_SDA_IO
|
||||
#define EXAMPLE_I2C_SCL_IO CONFIG_EXAMPLE_I2C_SCL_IO
|
||||
|
||||
/* I2S port and GPIOs */
|
||||
#define EXAMPLE_I2S_NUM (0)
|
||||
#define EXAMPLE_I2S_MCK_IO CONFIG_EXAMPLE_I2S_MCLK_IO
|
||||
#define EXAMPLE_I2S_BCK_IO CONFIG_EXAMPLE_I2S_BCLK_IO
|
||||
#define EXAMPLE_I2S_WS_IO CONFIG_EXAMPLE_I2S_WS_IO
|
||||
#define EXAMPLE_I2S_DI_IO CONFIG_EXAMPLE_I2S_DIN_IO
|
||||
|
||||
/* SD card SPI GPIOs */
|
||||
#define EXAMPLE_SD_SPI_CLK_IO CONFIG_EXAMPLE_SD_SPI_CLK_IO
|
||||
#define EXAMPLE_SD_SPI_MOSI_IO CONFIG_EXAMPLE_SD_SPI_MOSI_IO
|
||||
#define EXAMPLE_SD_SPI_MISO_IO CONFIG_EXAMPLE_SD_SPI_MISO_IO
|
||||
#define EXAMPLE_SD_SPI_CS_IO CONFIG_EXAMPLE_SD_SPI_CS_IO
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -13,60 +13,7 @@
|
||||
#include "esp_codec_dev.h"
|
||||
#include "esp_codec_dev_vol.h"
|
||||
#include "format_wav.h"
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32S3 // ESP32-S3-Korvo-1 pin out
|
||||
/* I2C port and GPIOs */
|
||||
#define EXAMPLE_I2C_NUM (0)
|
||||
#define EXAMPLE_I2C_SDA_IO (1)
|
||||
#define EXAMPLE_I2C_SCL_IO (2)
|
||||
|
||||
/* I2S port and GPIOs */
|
||||
#define EXAMPLE_I2S_NUM (0)
|
||||
#define EXAMPLE_I2S_MCK_IO (20)
|
||||
#define EXAMPLE_I2S_BCK_IO (10)
|
||||
#define EXAMPLE_I2S_WS_IO (9)
|
||||
#define EXAMPLE_I2S_DI_IO (11)
|
||||
|
||||
/* SD card SPI GPIOs */
|
||||
#define EXAMPLE_SD_SPI_CLK_IO (18)
|
||||
#define EXAMPLE_SD_SPI_MOSI_IO (17)
|
||||
#define EXAMPLE_SD_SPI_MISO_IO (16)
|
||||
#define EXAMPLE_SD_SPI_CS_IO (15)
|
||||
#elif CONFIG_IDF_TARGET_ESP32P4
|
||||
#define EXAMPLE_I2C_NUM (0)
|
||||
#define EXAMPLE_I2C_SDA_IO (3)
|
||||
#define EXAMPLE_I2C_SCL_IO (2)
|
||||
|
||||
/* I2S port and GPIOs */
|
||||
#define EXAMPLE_I2S_NUM (0)
|
||||
#define EXAMPLE_I2S_MCK_IO (4)
|
||||
#define EXAMPLE_I2S_BCK_IO (5)
|
||||
#define EXAMPLE_I2S_WS_IO (6)
|
||||
#define EXAMPLE_I2S_DI_IO (7)
|
||||
|
||||
/* SD card SPI GPIOs */
|
||||
#define EXAMPLE_SD_SPI_CLK_IO (18)
|
||||
#define EXAMPLE_SD_SPI_MOSI_IO (19)
|
||||
#define EXAMPLE_SD_SPI_MISO_IO (14)
|
||||
#define EXAMPLE_SD_SPI_CS_IO (17)
|
||||
#else
|
||||
#define EXAMPLE_I2C_NUM (0)
|
||||
#define EXAMPLE_I2C_SDA_IO (3)
|
||||
#define EXAMPLE_I2C_SCL_IO (2)
|
||||
|
||||
/* I2S port and GPIOs */
|
||||
#define EXAMPLE_I2S_NUM (0)
|
||||
#define EXAMPLE_I2S_MCK_IO (0)
|
||||
#define EXAMPLE_I2S_BCK_IO (1)
|
||||
#define EXAMPLE_I2S_WS_IO (10)
|
||||
#define EXAMPLE_I2S_DI_IO (8)
|
||||
|
||||
/* SD card SPI GPIOs */
|
||||
#define EXAMPLE_SD_SPI_CLK_IO (5)
|
||||
#define EXAMPLE_SD_SPI_MOSI_IO (7)
|
||||
#define EXAMPLE_SD_SPI_MISO_IO (6)
|
||||
#define EXAMPLE_SD_SPI_CS_IO (4)
|
||||
#endif
|
||||
#include "example_config.h"
|
||||
|
||||
/* I2S configurations */
|
||||
#define EXAMPLE_I2S_CHAN_NUM (4)
|
||||
|
||||
@@ -9,7 +9,6 @@ from pytest_embedded_idf.utils import soc_filtered_targets
|
||||
@pytest.mark.generic
|
||||
@idf_parametrize('target', soc_filtered_targets('SOC_I2S_SUPPORTS_TDM == 1'), indirect=['target'])
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32h21'], reason='lack of runners')
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32h4'], reason='cannot pass') # TODO: IDF-15609
|
||||
def test_i2s_es7210_tdm_example(dut: Dut) -> None:
|
||||
dut.expect_exact('example: Create I2S receive channel')
|
||||
dut.expect_exact('example: Configure I2S receive channel to TDM mode')
|
||||
|
||||
@@ -10,13 +10,13 @@ menu "Example Configuration"
|
||||
|
||||
config EXAMPLE_I2C_SDA_IO
|
||||
int "I2C SDA IO"
|
||||
default 17 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||
default 17 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32H4
|
||||
default 9 if IDF_TARGET_ESP32H2
|
||||
default 7
|
||||
|
||||
config EXAMPLE_I2C_SCL_IO
|
||||
int "I2C SCL IO"
|
||||
default 16 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3
|
||||
default 16 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32H4
|
||||
default 8 if IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32P4
|
||||
default 6
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ from pytest_embedded_idf.utils import soc_filtered_targets
|
||||
indirect=['target'],
|
||||
)
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32h21'], reason='lack of runners')
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32h4'], reason='cannot pass') # TODO: IDF-15609
|
||||
def test_i2s_es8311_example_generic(dut: Dut) -> None:
|
||||
dut.expect('i2s es8311 codec example start')
|
||||
dut.expect('-----------------------------')
|
||||
|
||||
Reference in New Issue
Block a user