Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is currently no way to configure WDT to do anything but a system reset #1831

Closed
bjoernQ opened this issue Jul 18, 2024 · 1 comment · Fixed by #2330
Closed

There is currently no way to configure WDT to do anything but a system reset #1831

bjoernQ opened this issue Jul 18, 2024 · 1 comment · Fixed by #2330
Assignees
Labels
peripheral:wdt Watchdog timer peripheral(s) status:blocked Unable to progress - dependent on another task
Milestone

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Jul 18, 2024

While we can set an interrupt handler, we currently have no way for the user to configure the WDT to cause anything but a system reset.

@jessebraham jessebraham added the peripheral:wdt Watchdog timer peripheral(s) label Jul 18, 2024
@tom-borcin tom-borcin added this to the 0.22.0 milestone Oct 7, 2024
@playfulFence playfulFence self-assigned this Oct 7, 2024
@playfulFence
Copy link
Contributor

playfulFence commented Oct 10, 2024

From the current state of #2330

Even though I'm setting everything correctly (I'm also checking if wdt_stgX registers are in correct value), WDT constantly only resets the whole system, no matter which value is in those registers, it never fires an interrupt or if "No Action" mode is set - it still resets the whole system.

I decided to check if that works in IDF implementation and got this result:

code (modified test_reset_reason unit test) :

static void do_rtc_wdt(void)
{
    setup_values();
    // Enable RTC watchdog for 0.1 second
    wdt_hal_context_t rtc_wdt_ctx;
    wdt_hal_init(&rtc_wdt_ctx, WDT_RWDT, 0, false);
    uint32_t stage_timeout_ticks = rtc_clk_slow_freq_get_hz() / 10;
    wdt_hal_write_protect_disable(&rtc_wdt_ctx);
    wdt_hal_config_stage(&rtc_wdt_ctx, WDT_STAGE0, stage_timeout_ticks, WDT_STAGE_ACTION_OFF);
    wdt_hal_config_stage(&rtc_wdt_ctx, WDT_STAGE1, stage_timeout_ticks, WDT_STAGE_ACTION_OFF);
    wdt_hal_config_stage(&rtc_wdt_ctx, WDT_STAGE2, stage_timeout_ticks, WDT_STAGE_ACTION_OFF);
    wdt_hal_config_stage(&rtc_wdt_ctx, WDT_STAGE3, stage_timeout_ticks, WDT_STAGE_ACTION_OFF);

    wdt_hal_set_flashboot_en(&rtc_wdt_ctx, true);
    wdt_hal_write_protect_enable(&rtc_wdt_ctx);
    while (1);
}

Output:
image

so as you can see even though stage registers are set to Off value, it still resets the whole system

UPD: My bad, for RWDT we needed to turn off flashboot and after some smaller fixes it works in our driver now. However, MWDT still seems to be not working correctly 🤔

@playfulFence playfulFence added the status:blocked Unable to progress - dependent on another task label Oct 10, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
peripheral:wdt Watchdog timer peripheral(s) status:blocked Unable to progress - dependent on another task
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants