I normally pin a task to a specific core using xTaskCreatePinnedToCore.
Now I need to execute the content of a high-speed timer callback on core 1, but I cannot find any way to do that by looking at the docs for esp_timer_create.
I could leave the callback on core 0 and just use it to send a notification to a task running on core 1. But I don't know if the notification process is fast/precise enough? I'm hoping to run that code every 100us with as small jitter as possible. Are there better ways to do that?
pin timer callback to specific core?
-
- Posts: 9039
- Joined: Thu Nov 26, 2015 4:08 am
Re: pin timer callback to specific core?
From what I call, the esp_timer subsystem does callbacks from its own task; it may be configurable in Menuconfig on what core it runs.
Esp_timer is a shared resource as in: if something else has scheduled a callback at the same time as your program, your callback could be delayed until the earlier callback has finished. If you truly need low-latency at all times, you might be better off using one of the hardware timers.
Esp_timer is a shared resource as in: if something else has scheduled a callback at the same time as your program, your callback could be delayed until the earlier callback has finished. If you truly need low-latency at all times, you might be better off using one of the hardware timers.
Re: pin timer callback to specific core?
Ah, thank you, I will try using a hardware timer then instead of the esp_timer.
But in terms of what core the ISR runs on, does that make any difference? I still need a way to run the callback on core 1.
The documentation for the timer_isr_register function is not clear to me:
The example on github does not even use this function: it uses the timer_isr_callback_add instead. What is the difference? Should I call this timer_isr_callback_add from a task in core1?
https://github.com/espressif/esp-idf/bl ... ple_main.c
But in terms of what core the ISR runs on, does that make any difference? I still need a way to run the callback on core 1.
The documentation for the timer_isr_register function is not clear to me:
Does that mean that I have to create a task on core 1 just to call this timer_isr_register function?Register Timer interrupt handler, the handler is an ISR. The handler will be attached to the same CPU core that this function is running on.
The example on github does not even use this function: it uses the timer_isr_callback_add instead. What is the difference? Should I call this timer_isr_callback_add from a task in core1?
https://github.com/espressif/esp-idf/bl ... ple_main.c