From 86a8804cca320e0c46b97755467b5f6f472e7585 Mon Sep 17 00:00:00 2001 From: kerms Date: Mon, 15 Apr 2024 14:54:39 +0800 Subject: [PATCH] fix(DAP) reset not working when FREERTOS FREQ < 500 --- components/DAP/DAP_config.h | 1 + components/DAP/cmsis-dap/source/DAP.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/components/DAP/DAP_config.h b/components/DAP/DAP_config.h index 0bc00a1..b00d977 100644 --- a/components/DAP/DAP_config.h +++ b/components/DAP/DAP_config.h @@ -969,6 +969,7 @@ __STATIC_INLINE void DAP_SETUP(void) PORT_OFF(); } +/* minimum 1 tick delay */ extern void dap_os_delay(int ms); /** Reset Target Device with custom specific I/O pin or command sequence. This function allows the optional implementation of a device specific reset sequence. diff --git a/components/DAP/cmsis-dap/source/DAP.c b/components/DAP/cmsis-dap/source/DAP.c index e7f5969..5e93d8e 100644 --- a/components/DAP/cmsis-dap/source/DAP.c +++ b/components/DAP/cmsis-dap/source/DAP.c @@ -1846,8 +1846,11 @@ void DAP_Setup(void) { DAP_SETUP(); // Device specific setup } - void dap_os_delay(int ms) { - vTaskDelay(pdMS_TO_TICKS(ms)); + if (CONFIG_FREERTOS_HZ >= 1000) { + vTaskDelay(pdMS_TO_TICKS(ms)); + } else { + vTaskDelay(pdMS_TO_TICKS(ms) + 1); + } } \ No newline at end of file