mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 15:14:33 +02:00
Merge branch 'bugfix/fix_i2s_pcnt_target_test_on_h2' into 'master'
Test: Fixed target test of I2S and PCNT on H2 Closes IDF-6811, IDF-6814, IDFCI-1623, and IDFCI-1627 See merge request espressif/esp-idf!22478
This commit is contained in:
@@ -19,10 +19,7 @@ components/driver/test_apps/i2s_test_apps:
|
|||||||
components/driver/test_apps/i2s_test_apps/i2s:
|
components/driver/test_apps/i2s_test_apps/i2s:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_I2S_SUPPORTED != 1
|
- if: SOC_I2S_SUPPORTED != 1
|
||||||
disable_test:
|
|
||||||
- if: IDF_TARGET in ["esp32h2"]
|
|
||||||
temporary: true
|
|
||||||
reason: Cannot pass test, see IDF-6811
|
|
||||||
components/driver/test_apps/i2s_test_apps/i2s_tdm:
|
components/driver/test_apps/i2s_test_apps/i2s_tdm:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_I2S_SUPPORTS_TDM != 1
|
- if: SOC_I2S_SUPPORTS_TDM != 1
|
||||||
@@ -34,10 +31,6 @@ components/driver/test_apps/i2s_test_apps/legacy_i2s_adc_dac:
|
|||||||
components/driver/test_apps/i2s_test_apps/legacy_i2s_driver:
|
components/driver/test_apps/i2s_test_apps/legacy_i2s_driver:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_I2S_SUPPORTED != 1
|
- if: SOC_I2S_SUPPORTED != 1
|
||||||
disable_test:
|
|
||||||
- if: IDF_TARGET in ["esp32h2"]
|
|
||||||
temporary: true
|
|
||||||
reason: cannot pass test IDF-6811
|
|
||||||
|
|
||||||
components/driver/test_apps/ledc:
|
components/driver/test_apps/ledc:
|
||||||
disable:
|
disable:
|
||||||
@@ -58,10 +51,6 @@ components/driver/test_apps/legacy_mcpwm_driver:
|
|||||||
components/driver/test_apps/legacy_pcnt_driver:
|
components/driver/test_apps/legacy_pcnt_driver:
|
||||||
disable:
|
disable:
|
||||||
- if: SOC_PCNT_SUPPORTED != 1
|
- if: SOC_PCNT_SUPPORTED != 1
|
||||||
disable_test:
|
|
||||||
- if: IDF_TARGET in ["esp32h2"]
|
|
||||||
temporary: true
|
|
||||||
reason: cannot pass test IDF-6814
|
|
||||||
|
|
||||||
components/driver/test_apps/legacy_rmt_driver:
|
components/driver/test_apps/legacy_rmt_driver:
|
||||||
disable:
|
disable:
|
||||||
|
@@ -1086,8 +1086,11 @@ esp_err_t i2s_channel_preload_data(i2s_chan_handle_t tx_handle, const void *src,
|
|||||||
if (bytes_can_load == 0) {
|
if (bytes_can_load == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* Add spinlock in case memcpy be interrupted */
|
||||||
|
portENTER_CRITICAL_SAFE(&g_i2s.spinlock);
|
||||||
/* Load the data from the last loaded position */
|
/* Load the data from the last loaded position */
|
||||||
memcpy((uint8_t *)(desc_ptr->buf + tx_handle->dma.rw_pos), data_ptr, bytes_can_load);
|
memcpy((uint8_t *)(desc_ptr->buf + tx_handle->dma.rw_pos), data_ptr, bytes_can_load);
|
||||||
|
portEXIT_CRITICAL_SAFE(&g_i2s.spinlock);
|
||||||
data_ptr += bytes_can_load; // Move forward the data pointer
|
data_ptr += bytes_can_load; // Move forward the data pointer
|
||||||
total_loaded_bytes += bytes_can_load; // Add to the total loaded bytes
|
total_loaded_bytes += bytes_can_load; // Add to the total loaded bytes
|
||||||
remain_bytes -= bytes_can_load; // Update the remaining bytes to be loaded
|
remain_bytes -= bytes_can_load; // Update the remaining bytes to be loaded
|
||||||
@@ -1143,7 +1146,10 @@ esp_err_t i2s_channel_write(i2s_chan_handle_t handle, const void *src, size_t si
|
|||||||
if (bytes_can_write > size) {
|
if (bytes_can_write > size) {
|
||||||
bytes_can_write = size;
|
bytes_can_write = size;
|
||||||
}
|
}
|
||||||
|
/* Add spinlock in case memcpy be interrupted */
|
||||||
|
portENTER_CRITICAL_SAFE(&g_i2s.spinlock);
|
||||||
memcpy(data_ptr, src_byte, bytes_can_write);
|
memcpy(data_ptr, src_byte, bytes_can_write);
|
||||||
|
portEXIT_CRITICAL_SAFE(&g_i2s.spinlock);
|
||||||
size -= bytes_can_write;
|
size -= bytes_can_write;
|
||||||
src_byte += bytes_can_write;
|
src_byte += bytes_can_write;
|
||||||
handle->dma.rw_pos += bytes_can_write;
|
handle->dma.rw_pos += bytes_can_write;
|
||||||
@@ -1185,7 +1191,10 @@ esp_err_t i2s_channel_read(i2s_chan_handle_t handle, void *dest, size_t size, si
|
|||||||
if (bytes_can_read > (int)size) {
|
if (bytes_can_read > (int)size) {
|
||||||
bytes_can_read = size;
|
bytes_can_read = size;
|
||||||
}
|
}
|
||||||
|
/* Add spinlock in case memcpy be interrupted */
|
||||||
|
portENTER_CRITICAL_SAFE(&g_i2s.spinlock);
|
||||||
memcpy(dest_byte, data_ptr, bytes_can_read);
|
memcpy(dest_byte, data_ptr, bytes_can_read);
|
||||||
|
portEXIT_CRITICAL_SAFE(&g_i2s.spinlock);
|
||||||
size -= bytes_can_read;
|
size -= bytes_can_read;
|
||||||
dest_byte += bytes_can_read;
|
dest_byte += bytes_can_read;
|
||||||
handle->dma.rw_pos += bytes_can_read;
|
handle->dma.rw_pos += bytes_can_read;
|
||||||
|
@@ -749,11 +749,15 @@ static void i2s_test_common_sample_rate(i2s_chan_handle_t rx_chan, i2s_std_clk_c
|
|||||||
/* Test common sample rate
|
/* Test common sample rate
|
||||||
* Workaround: set 12000 as 12001 to bypass the unknown failure, TODO: IDF-6705 */
|
* Workaround: set 12000 as 12001 to bypass the unknown failure, TODO: IDF-6705 */
|
||||||
const uint32_t test_freq[] = {
|
const uint32_t test_freq[] = {
|
||||||
8000, 10000, 11025, 12001, 16000, 22050,
|
8000, 10001, 11025, 12001, 16000, 22050,
|
||||||
24000, 32000, 44100, 48000, 64000, 88200,
|
24000, 32000, 44100, 48000, 64000, 88200,
|
||||||
96000, 128000,144000,196000};
|
96000, 128000,144000,196000};
|
||||||
int real_pulse = 0;
|
int real_pulse = 0;
|
||||||
int case_cnt = sizeof(test_freq) / sizeof(uint32_t);
|
int case_cnt = sizeof(test_freq) / sizeof(uint32_t);
|
||||||
|
#if SOC_I2S_SUPPORTS_PLL_F96M
|
||||||
|
// 196000 Hz sample rate doesn't support on PLL_96M target
|
||||||
|
case_cnt = 15;
|
||||||
|
#endif
|
||||||
#if SOC_I2S_SUPPORTS_XTAL
|
#if SOC_I2S_SUPPORTS_XTAL
|
||||||
// Can't support a very high sample rate while using XTAL as clock source
|
// Can't support a very high sample rate while using XTAL as clock source
|
||||||
if (clk_cfg->clk_src == I2S_CLK_SRC_XTAL) {
|
if (clk_cfg->clk_src == I2S_CLK_SRC_XTAL) {
|
||||||
|
@@ -10,7 +10,7 @@ from pytest_embedded import Dut
|
|||||||
@pytest.mark.esp32c3
|
@pytest.mark.esp32c3
|
||||||
@pytest.mark.esp32c6
|
@pytest.mark.esp32c6
|
||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
# @pytest.mark.esp32h2 IDF-6811
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
|
@@ -888,6 +888,11 @@ static void i2s_test_common_sample_rate(i2s_port_t id)
|
|||||||
int case_cnt = sizeof(test_freq) / sizeof(uint32_t);
|
int case_cnt = sizeof(test_freq) / sizeof(uint32_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SOC_I2S_SUPPORTS_PLL_F96M
|
||||||
|
// 196000 Hz sample rate doesn't support on PLL_96M target
|
||||||
|
case_cnt = 15;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Acquire the PM lock incase Dynamic Frequency Scaling(DFS) lower the frequency
|
// Acquire the PM lock incase Dynamic Frequency Scaling(DFS) lower the frequency
|
||||||
#ifdef CONFIG_PM_ENABLE
|
#ifdef CONFIG_PM_ENABLE
|
||||||
esp_pm_lock_handle_t pm_lock;
|
esp_pm_lock_handle_t pm_lock;
|
||||||
|
@@ -10,7 +10,7 @@ from pytest_embedded import Dut
|
|||||||
@pytest.mark.esp32c3
|
@pytest.mark.esp32c3
|
||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
@pytest.mark.esp32c6
|
@pytest.mark.esp32c6
|
||||||
# @pytest.mark.esp32h2 IDF-6811
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "esp_rom_gpio.h"
|
#include "esp_rom_gpio.h"
|
||||||
|
|
||||||
#define PULSE_IO 21
|
#define PULSE_IO 12
|
||||||
#define PCNT_INPUT_IO 4
|
#define PCNT_INPUT_IO 4
|
||||||
#define PCNT_CTRL_VCC_IO 5
|
#define PCNT_CTRL_VCC_IO 5
|
||||||
#define PCNT_CTRL_GND_IO 2
|
#define PCNT_CTRL_GND_IO 2
|
||||||
|
@@ -9,7 +9,7 @@ from pytest_embedded import Dut
|
|||||||
@pytest.mark.esp32s2
|
@pytest.mark.esp32s2
|
||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
@pytest.mark.esp32c6
|
@pytest.mark.esp32c6
|
||||||
# @pytest.mark.esp32h2 IDF-6814
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
'config',
|
'config',
|
||||||
|
@@ -57,10 +57,6 @@ examples/peripherals/i2s/i2s_codec/i2s_es7210_tdm:
|
|||||||
disable:
|
disable:
|
||||||
- if: SOC_I2S_SUPPORTS_TDM != 1 or (SOC_I2C_SUPPORTED != 1 or SOC_GPSPI_SUPPORTED != 1)
|
- 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
|
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 ["esp32h2"]
|
|
||||||
temporary: true
|
|
||||||
reason: cannot pass target test IDF-6811
|
|
||||||
|
|
||||||
examples/peripherals/i2s/i2s_codec/i2s_es8311:
|
examples/peripherals/i2s/i2s_codec/i2s_es8311:
|
||||||
disable:
|
disable:
|
||||||
|
@@ -7,7 +7,7 @@ from pytest_embedded import Dut
|
|||||||
@pytest.mark.esp32s3
|
@pytest.mark.esp32s3
|
||||||
@pytest.mark.esp32c3
|
@pytest.mark.esp32c3
|
||||||
@pytest.mark.esp32c6
|
@pytest.mark.esp32c6
|
||||||
# @pytest.mark.esp32h2 IDF-6264
|
@pytest.mark.esp32h2
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
def test_i2s_es7210_tdm_example(dut: Dut) -> None:
|
def test_i2s_es7210_tdm_example(dut: Dut) -> None:
|
||||||
dut.expect_exact('example: Create I2S receive channel')
|
dut.expect_exact('example: Create I2S receive channel')
|
||||||
|
Reference in New Issue
Block a user