From 13756274613d24888eb3fafc124511e165b84193 Mon Sep 17 00:00:00 2001 From: morris Date: Tue, 28 Mar 2023 18:22:21 +0800 Subject: [PATCH] filter: workaround a hw issue in the glitch filter that the internal glitch counter will overflow at 64 constant level input, causing a wrong filter result --- components/hal/esp32c6/include/hal/gpio_glitch_filter_ll.h | 5 +++-- components/hal/esp32h2/include/hal/gpio_glitch_filter_ll.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/hal/esp32c6/include/hal/gpio_glitch_filter_ll.h b/components/hal/esp32c6/include/hal/gpio_glitch_filter_ll.h index 7823060765..86d52ba43d 100644 --- a/components/hal/esp32c6/include/hal/gpio_glitch_filter_ll.h +++ b/components/hal/esp32c6/include/hal/gpio_glitch_filter_ll.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -16,7 +16,8 @@ #include "hal/assert.h" #include "soc/gpio_ext_struct.h" -#define GPIO_LL_GLITCH_FILTER_MAX_WINDOW 64 +// the max window size is expected to be 64, but due to a hardware issue, we need to limit it to 63 +#define GPIO_LL_GLITCH_FILTER_MAX_WINDOW 63 #ifdef __cplusplus extern "C" { diff --git a/components/hal/esp32h2/include/hal/gpio_glitch_filter_ll.h b/components/hal/esp32h2/include/hal/gpio_glitch_filter_ll.h index 7a577c296d..5d19a96188 100644 --- a/components/hal/esp32h2/include/hal/gpio_glitch_filter_ll.h +++ b/components/hal/esp32h2/include/hal/gpio_glitch_filter_ll.h @@ -16,7 +16,8 @@ #include "hal/assert.h" #include "soc/gpio_ext_struct.h" -#define GPIO_LL_GLITCH_FILTER_MAX_WINDOW 64 +// the max window size is expected to be 64, but due to a hardware issue, we need to limit it to 63 +#define GPIO_LL_GLITCH_FILTER_MAX_WINDOW 63 #ifdef __cplusplus extern "C" {