Closed dizcza closed 2 years ago
@dizcza Thanks for the detailed debug log, could you help to check if the following fix can help?
diff --git a/components/driver/mcpwm/mcpwm_private.h b/components/driver/mcpwm/mcpwm_private.h
index b5881280f8..eb176fc29e 100644
--- a/components/driver/mcpwm/mcpwm_private.h
+++ b/components/driver/mcpwm/mcpwm_private.h
@@ -29,9 +29,9 @@ extern "C" {
#endif
#if CONFIG_MCPWM_ISR_IRAM_SAFE
-#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM)
+#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM)
#else
-#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED)
+#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED)
#endif
#define MCPWM_PERIPH_CLOCK_PRE_SCALE (2)
@dizcza Thanks for the detailed debug log, could you help to check if the following fix can help?
diff --git a/components/driver/mcpwm/mcpwm_private.h b/components/driver/mcpwm/mcpwm_private.h index b5881280f8..eb176fc29e 100644 --- a/components/driver/mcpwm/mcpwm_private.h +++ b/components/driver/mcpwm/mcpwm_private.h @@ -29,9 +29,9 @@ extern "C" { #endif #if CONFIG_MCPWM_ISR_IRAM_SAFE -#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM) +#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED | ESP_INTR_FLAG_IRAM) #else -#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED) +#define MCPWM_INTR_ALLOC_FLAG (ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED | ESP_INTR_FLAG_INTRDISABLED) #endif #define MCPWM_PERIPH_CLOCK_PRE_SCALE (2)
Yes, the fix solves the issue. Checked for both options for the CONFIG_MCPWM_ISR_IRAM_SAFE.
Environment
Problem Description
I'm migrating MCPWM capture mode from legacy to mcpwm_cap module using esp-idf master branch. In my code, which I cannot show all, I
and the code fails with
If I
mcpwm_capture_channel_register_event_callbacks
works fine. As the return code suggests -ESP_ERROR_CHECK
, - "No free interrupt found with the specified flags".Expected Behavior
There is at least one free interrupt with the MCPWM flags specified and
mcpwm_capture_channel_register_event_callbacks
succeeds.Actual Behavior
There are no free interrupts with the MCPWM flags specified and
mcpwm_capture_channel_register_event_callbacks
fails.Code to reproduce this issue
This is schematic code to perform GPS-RTC sync. It isn't meant to run.
Debug Logs
Update 1
If I call
gps_init
after I initialize MCPWM and enable it,everything works fine.
Update 2
However, if I enable & disable MCPWM, the error appears again.
Legacy MCPWM code
For the reference, the legacy code I'm porting is
And it's very annoying to see logs flooded with GPIO messages each time I "enable" and "disable" the new
mcpwm_cap
driver. I'll perhaps open a discussion on this matter later on to avoid callingmcpwm_new_capture_channel
andmcpwm_del_capture_channel
explicitly as the documentation suggests at the moment.Other items if possible
sdkconfig.txt