diff --git a/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/Kconfig.projbuild b/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/Kconfig.projbuild index 92042713dd..78dd723a57 100644 --- a/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/Kconfig.projbuild +++ b/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/Kconfig.projbuild @@ -33,6 +33,10 @@ menu "SDMMC Test Board Configuration" bool "ESP32-P4 Function EV Board" depends on IDF_TARGET_ESP32P4 + config SDMMC_BOARD_ESP32P4_EV_BOARD_WITH_SDSPI + bool "ESP32-P4 Function EV Board with SDSPI breakout" + depends on IDF_TARGET_ESP32P4 + config SDMMC_BOARD_ESP32C5_BREAKOUT bool "ESP32-C5 breakout board" depends on IDF_TARGET_ESP32C5 diff --git a/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/sdmmc_test_board_defs.c b/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/sdmmc_test_board_defs.c index c737ab8510..229902ff6f 100644 --- a/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/sdmmc_test_board_defs.c +++ b/components/esp_driver_sdmmc/test_apps/sd_test_utils/components/sdmmc_test_boards/sdmmc_test_board_defs.c @@ -346,6 +346,34 @@ static const sdmmc_test_board_info_t s_board_info = { }, }; +#elif CONFIG_SDMMC_BOARD_ESP32P4_EV_BOARD_WITH_SDSPI + +static const sdmmc_test_board_info_t s_board_info = { + .name = "ESP32-P4 Function EV Board with SDSPI breakout", + .slot = { + { + .slot_exists = false + }, + { + .slot_exists = true, + .bus_width = 1, + .clk = 53, + .cmd_mosi = 36, + .d0_miso = 47, + .d1 = GPIO_NUM_NC, + .d2 = GPIO_NUM_NC, + .d3_cs = 33, + .d4 = GPIO_NUM_NC, + .d5 = GPIO_NUM_NC, + .d6 = GPIO_NUM_NC, + .d7 = GPIO_NUM_NC, + .cd = CONFIG_SDMMC_BOARD_CUSTOM_CD, + .wp = CONFIG_SDMMC_BOARD_CUSTOM_WP, + .unused_pin = CONFIG_SDMMC_BOARD_CUSTOM_UNUSED, + } + }, +}; + #elif CONFIG_SDMMC_BOARD_ESP32C5_BREAKOUT static const sdmmc_test_board_info_t s_board_info = { diff --git a/components/esp_driver_sdspi/test_apps/sdspi/components/sdspi_tests/sdmmc_test_cd_wp_spi.c b/components/esp_driver_sdspi/test_apps/sdspi/components/sdspi_tests/sdmmc_test_cd_wp_spi.c index 4066810bcb..997380c431 100644 --- a/components/esp_driver_sdspi/test_apps/sdspi/components/sdspi_tests/sdmmc_test_cd_wp_spi.c +++ b/components/esp_driver_sdspi/test_apps/sdspi/components/sdspi_tests/sdmmc_test_cd_wp_spi.c @@ -49,7 +49,9 @@ TEST_CASE("CD input works in SPI mode", "[sdspi]") TEST_ESP_OK(sdspi_host_deinit()); TEST_ESP_OK(spi_bus_free(SDSPI_DEFAULT_HOST)); sdmmc_test_board_card_power_set(false); +#if SOC_SDMMC_IO_POWER_EXTERNAL TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(pwr_ctrl_handle)); +#endif } TEST_CASE("WP input works in SPI mode", "[sdspi]") @@ -85,5 +87,7 @@ TEST_CASE("WP input works in SPI mode", "[sdspi]") TEST_ESP_OK(sdspi_host_deinit()); TEST_ESP_OK(spi_bus_free(SDSPI_DEFAULT_HOST)); sdmmc_test_board_card_power_set(false); +#if SOC_SDMMC_IO_POWER_EXTERNAL TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(pwr_ctrl_handle)); +#endif } diff --git a/components/esp_driver_sdspi/test_apps/sdspi/pytest_sdspi.py b/components/esp_driver_sdspi/test_apps/sdspi/pytest_sdspi.py index 86d1815537..06c8305275 100644 --- a/components/esp_driver_sdspi/test_apps/sdspi/pytest_sdspi.py +++ b/components/esp_driver_sdspi/test_apps/sdspi/pytest_sdspi.py @@ -6,6 +6,7 @@ from pytest_embedded_idf import IdfDut @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.esp32p4 @pytest.mark.esp32c5 @pytest.mark.sdcard_spimode def test_sdspi(dut: IdfDut) -> None: diff --git a/components/esp_driver_sdspi/test_apps/sdspi/sdkconfig.defaults.esp32p4 b/components/esp_driver_sdspi/test_apps/sdspi/sdkconfig.defaults.esp32p4 new file mode 100644 index 0000000000..74592300eb --- /dev/null +++ b/components/esp_driver_sdspi/test_apps/sdspi/sdkconfig.defaults.esp32p4 @@ -0,0 +1,2 @@ +CONFIG_SDMMC_BOARD_ESP32P4_EV_BOARD_WITH_SDSPI=y +CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y diff --git a/components/hal/include/hal/spi_hal.h b/components/hal/include/hal/spi_hal.h index 0ad890170b..605158ecc9 100644 --- a/components/hal/include/hal/spi_hal.h +++ b/components/hal/include/hal/spi_hal.h @@ -72,7 +72,7 @@ typedef struct { typedef struct { spi_ll_clock_val_t clock_reg; ///< Register value used by the LL layer spi_clock_source_t clock_source; ///< Clock source of each device used by LL layer - uint32_t source_pre_div; ///< Pre divider befor enter SPI peripheral + uint32_t source_pre_div; ///< Pre divider before enter SPI peripheral int real_freq; ///< Output of the actual frequency int timing_dummy; ///< Extra dummy needed to compensate the timing int timing_miso_delay; ///< Extra miso delay clocks to compensate the timing @@ -129,7 +129,7 @@ typedef struct { #if SOC_SPI_AS_CS_SUPPORTED uint32_t as_cs : 1; ///< Whether to toggle the CS while the clock toggles, device specific #endif - uint32_t positive_cs : 1; ///< Whether the postive CS feature is abled, device specific + uint32_t positive_cs : 1; ///< Whether the positive CS feature is abled, device specific };//boolean configurations } spi_hal_dev_config_t; diff --git a/examples/storage/sd_card/sdspi/main/Kconfig.projbuild b/examples/storage/sd_card/sdspi/main/Kconfig.projbuild index 5c08ec6d5a..17455b9193 100644 --- a/examples/storage/sd_card/sdspi/main/Kconfig.projbuild +++ b/examples/storage/sd_card/sdspi/main/Kconfig.projbuild @@ -19,7 +19,7 @@ menu "SD SPI Example Configuration" default 35 if IDF_TARGET_ESP32S2 default 35 if IDF_TARGET_ESP32S3 default 5 if IDF_TARGET_ESP32H2 - default 48 if IDF_TARGET_ESP32P4 + default 36 if IDF_TARGET_ESP32P4 default 4 # C3 and others config EXAMPLE_PIN_MISO diff --git a/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py b/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py index 5a669d8073..2d9d1f0e7f 100644 --- a/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py +++ b/examples/storage/sd_card/sdspi/pytest_sdspi_card_example.py @@ -9,6 +9,7 @@ from pytest_embedded import Dut @pytest.mark.esp32 @pytest.mark.esp32c3 +@pytest.mark.esp32p4 @pytest.mark.esp32c5 @pytest.mark.sdcard_spimode def test_examples_sd_card_sdspi(dut: Dut) -> None: @@ -16,7 +17,7 @@ def test_examples_sd_card_sdspi(dut: Dut) -> None: dut.expect('example: Using SPI peripheral', timeout=20) # Provide enough time for possible SD card formatting - dut.expect('Filesystem mounted', timeout=60) + dut.expect('Filesystem mounted', timeout=180) # These lines are matched separately because of ASCII color codes in the output name = dut.expect(re.compile(rb'Name: (\w+)\r'), timeout=20).group(1).decode() @@ -43,4 +44,4 @@ def test_examples_sd_card_sdspi(dut: Dut) -> None: dut.expect_exact(msg, timeout=30) dut.expect(sd_card_format, timeout=180) # Provide enough time for SD card FATFS format operation for msg in message_list2: - dut.expect_exact(msg, timeout=30) + dut.expect_exact(msg, timeout=180) diff --git a/examples/storage/sd_card/sdspi/sdkconfig.defaults.esp32p4 b/examples/storage/sd_card/sdspi/sdkconfig.defaults.esp32p4 new file mode 100644 index 0000000000..5e9f8e25bd --- /dev/null +++ b/examples/storage/sd_card/sdspi/sdkconfig.defaults.esp32p4 @@ -0,0 +1 @@ +CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y