mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
rtcio: Add a test case to test RTCIO's hold ability after deep sleep wakeup
This commit is contained in:
parent
a05e8996ab
commit
dd311381a4
@ -304,3 +304,52 @@ TEST_CASE("RTCIO_output_hold_test", "[rtcio]")
|
|||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "RTCIO hold test over");
|
ESP_LOGI(TAG, "RTCIO hold test over");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It is not necessary to test every rtcio pin, it will take too much ci testing time for deep sleep
|
||||||
|
// Only tests on s_test_map[TEST_RTCIO_DEEP_SLEEP_PIN_INDEX] pin
|
||||||
|
// (ESP32: IO25, ESP32S2, S3: IO6) these pads' default configuration is low level
|
||||||
|
#define TEST_RTCIO_DEEP_SLEEP_PIN_INDEX 5
|
||||||
|
|
||||||
|
static void rtcio_deep_sleep_hold_test_first_stage(void)
|
||||||
|
{
|
||||||
|
printf("configure rtcio pin to hold during deep sleep");
|
||||||
|
int io_num = s_test_map[TEST_RTCIO_DEEP_SLEEP_PIN_INDEX];
|
||||||
|
|
||||||
|
TEST_ESP_OK(esp_sleep_enable_timer_wakeup(2000000));
|
||||||
|
|
||||||
|
gpio_config_t io_conf = {
|
||||||
|
.intr_type = GPIO_INTR_DISABLE,
|
||||||
|
.mode = GPIO_MODE_INPUT_OUTPUT,
|
||||||
|
.pin_bit_mask = (1ULL << io_num),
|
||||||
|
.pull_down_en = 0,
|
||||||
|
.pull_up_en = 0,
|
||||||
|
};
|
||||||
|
gpio_config(&io_conf);
|
||||||
|
|
||||||
|
gpio_set_level(io_num, 1);
|
||||||
|
// Enable global persistence
|
||||||
|
TEST_ESP_OK(gpio_hold_en(io_num));
|
||||||
|
|
||||||
|
esp_deep_sleep_start();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rtcio_deep_sleep_hold_test_second_stage(void)
|
||||||
|
{
|
||||||
|
int io_num = s_test_map[TEST_RTCIO_DEEP_SLEEP_PIN_INDEX];
|
||||||
|
// Check reset reason is waking up from deepsleep
|
||||||
|
TEST_ASSERT_EQUAL(ESP_RST_DEEPSLEEP, esp_reset_reason());
|
||||||
|
// Pin should stay at high level after the deep sleep
|
||||||
|
TEST_ASSERT_EQUAL_INT(1, gpio_get_level(io_num));
|
||||||
|
|
||||||
|
gpio_hold_dis(io_num);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test rtcio hold function during deep sleep.
|
||||||
|
* This test case can only check the hold state after waking up from deep sleep
|
||||||
|
* If you want to check that the rtcio hold function works properly during deep sleep,
|
||||||
|
* please use logic analyzer or oscillscope
|
||||||
|
*/
|
||||||
|
TEST_CASE_MULTIPLE_STAGES("RTCIO_deep_sleep_output_hold_test", "[rtcio]",
|
||||||
|
rtcio_deep_sleep_hold_test_first_stage,
|
||||||
|
rtcio_deep_sleep_hold_test_second_stage)
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from pytest_embedded import Dut
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.supported_targets
|
@pytest.mark.supported_targets
|
||||||
@ -15,7 +14,5 @@ from pytest_embedded import Dut
|
|||||||
],
|
],
|
||||||
indirect=True,
|
indirect=True,
|
||||||
)
|
)
|
||||||
def test_gpio(dut: Dut) -> None:
|
def test_gpio(case_tester) -> None: # type: ignore
|
||||||
dut.expect_exact('Press ENTER to see the list of tests')
|
case_tester.run_all_cases(timeout=300)
|
||||||
dut.write('*')
|
|
||||||
dut.expect_unity_test_output(timeout=300)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user