Timers with ISR dispatch

einglis
Posts: 3
Joined: Thu Feb 08, 2024 3:02 pm

Timers with ISR dispatch

Postby einglis » Mon Mar 18, 2024 9:38 pm

I want to use a timer (`esp_timer_create`) with ISR dispatch. The docs say this requires:

Code: Select all

esp_timer_create_args_t timer_config;
...
timer_config.dispatch_method = ESP_TIMER_ISR;
Where `ESP_TIMER_ISR` is only defined if `CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD` is also defined. In my code, both are defined.

If I set the dispatch method to `ESP_TIMER_TASK`, things work as might be expected, but if I use `ESP_TIMER_ISR` as above, `esp_timer_create` returns error 258, which is `ESP_ERR_INVALID_ARG`.

From what I can see in https://github.com/espressif/esp-idf/bl ... mer.c#L128, this implies that the library has been compiled without `CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD` defined, meaning `ESP_TIMER_MAX` is 1, and `ESP_TIMER_ISR` is therefore rejected.

Is there any way to check this implication? If so, is there any way to obtain a different configuration? Or have I missed a much more basic issue?

ps. I've tried to annotate my inline code with backticks because I could not work out the correct forum tag :(

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: Timers with ISR dispatch

Postby lbernstone » Tue Mar 19, 2024 4:50 am

arduino-esp32 uses pre-compiled libraries of the ESP-IDF sdk, so any code dependent on a CONFIG_XX macro will already have those values set. You can see what the sdkconfig settings were for v2.0.14+esp32 at https://github.com/espressif/arduino-es ... /sdkconfig

einglis
Posts: 3
Joined: Thu Feb 08, 2024 3:02 pm

Re: Timers with ISR dispatch

Postby einglis » Tue Mar 19, 2024 5:46 pm

Thanks for the link, @lbernstone. From there I can see:

Code: Select all

# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set
Darn. :(

Who is online

Users browsing this forum: No registered users and 77 guests