From a8667790708c1cce7d0a260b3f7fcc32d77135d7 Mon Sep 17 00:00:00 2001 From: Martin Vychodil Date: Fri, 20 Aug 2021 13:47:25 +0200 Subject: [PATCH] Examples/Storage: sufficient timeout for SD formatting Too short timeouts often cause useless failures on large-capacity SDs (16GB+) Fixed by adding 60 sec timeout on new "Filesystem mounted" checkpoint JIRA IDF-3741 --- examples/storage/sd_card/sdmmc/main/sd_card_example_main.c | 2 ++ examples/storage/sd_card/sdmmc/sd_card_example_test.py | 3 +++ examples/storage/sd_card/sdspi/main/sd_card_example_main.c | 2 ++ examples/storage/sd_card/sdspi/sd_card_example_test.py | 3 +++ 4 files changed, 10 insertions(+) diff --git a/examples/storage/sd_card/sdmmc/main/sd_card_example_main.c b/examples/storage/sd_card/sdmmc/main/sd_card_example_main.c index 6146b16538..3260324283 100644 --- a/examples/storage/sd_card/sdmmc/main/sd_card_example_main.c +++ b/examples/storage/sd_card/sdmmc/main/sd_card_example_main.c @@ -71,6 +71,7 @@ void app_main(void) // connected on the bus. This is for debug / example purpose only. slot_config.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP; + ESP_LOGI(TAG, "Mounting filesystem"); ret = esp_vfs_fat_sdmmc_mount(mount_point, &host, &slot_config, &mount_config, &card); if (ret != ESP_OK) { @@ -83,6 +84,7 @@ void app_main(void) } return; } + ESP_LOGI(TAG, "Filesystem mounted"); // Card has been initialized, print its properties sdmmc_card_print_info(stdout, card); diff --git a/examples/storage/sd_card/sdmmc/sd_card_example_test.py b/examples/storage/sd_card/sdmmc/sd_card_example_test.py index 3e7cc28530..18a9516f14 100644 --- a/examples/storage/sd_card/sdmmc/sd_card_example_test.py +++ b/examples/storage/sd_card/sdmmc/sd_card_example_test.py @@ -12,6 +12,9 @@ def test_examples_sd_card(env, extra_data): # type: (ttfw_idf.Env.Env, None ) - dut.expect('example: Initializing SD card', timeout=20) dut.expect('example: Using SDMMC peripheral', timeout=10) + # Provide enough time for possible SD card formatting + dut.expect('Filesystem mounted', timeout=60) + # These lines are matched separately because of ASCII color codes in the output name = dut.expect(re.compile(r'Name: (\w+)'), timeout=10)[0] _type = dut.expect(re.compile(r'Type: (\S+)'), timeout=10)[0] diff --git a/examples/storage/sd_card/sdspi/main/sd_card_example_main.c b/examples/storage/sd_card/sdspi/main/sd_card_example_main.c index 243370c644..38f34c12a6 100644 --- a/examples/storage/sd_card/sdspi/main/sd_card_example_main.c +++ b/examples/storage/sd_card/sdspi/main/sd_card_example_main.c @@ -88,6 +88,7 @@ void app_main(void) slot_config.gpio_cs = PIN_NUM_CS; slot_config.host_id = host.slot; + ESP_LOGI(TAG, "Mounting filesystem"); ret = esp_vfs_fat_sdspi_mount(mount_point, &host, &slot_config, &mount_config, &card); if (ret != ESP_OK) { @@ -100,6 +101,7 @@ void app_main(void) } return; } + ESP_LOGI(TAG, "Filesystem mounted"); // Card has been initialized, print its properties sdmmc_card_print_info(stdout, card); diff --git a/examples/storage/sd_card/sdspi/sd_card_example_test.py b/examples/storage/sd_card/sdspi/sd_card_example_test.py index 0438eb105e..72fe104164 100644 --- a/examples/storage/sd_card/sdspi/sd_card_example_test.py +++ b/examples/storage/sd_card/sdspi/sd_card_example_test.py @@ -12,6 +12,9 @@ def test_examples_sd_card(env, extra_data): # type: (ttfw_idf.Env.Env, None ) - dut.expect('example: Initializing SD card', timeout=20) dut.expect('example: Using SPI peripheral', timeout=20) + # Provide enough time for possible SD card formatting + dut.expect('Filesystem mounted', timeout=60) + # These lines are matched separately because of ASCII color codes in the output name = dut.expect(re.compile(r'Name: (\w+)'), timeout=20)[0] _type = dut.expect(re.compile(r'Type: (\S+)'), timeout=20)[0]