Page 1 of 1

Timer not working on core 1

Posted: Tue Jul 09, 2024 2:23 pm
by srjasz
I have a timer that works when running in a task on core 0 but does not work when running in a task running on core 1.
Thanks

Re: Timer not working on core 1

Posted: Tue Jul 09, 2024 5:35 pm
by aliarifat794
You did not mention which version of the ESP32 you are using. Anyways, is there any other tasks or interrupts that might be interfering with the timer on core 1?

Re: Timer not working on core 1

Posted: Wed Jul 10, 2024 8:11 pm
by srjasz
Thanks for the response.

I am using an S3. There is only a single task running on core 1 and the only thing in the task is the timer.

Re: Timer not working on core 1

Posted: Thu Jul 11, 2024 7:35 am
by MicroController
What do you mean you have a timer "running in a task"?

Re: Timer not working on core 1

Posted: Thu Jul 11, 2024 2:38 pm
by srjasz
Thanks for responding.
I am using a general purpose timer. Timer 0 in Timer Group 0. The timer is set to count to 200. When it reaches 200 it sets the interrupt flag and restarts at 0. As it is counting up I poll for the interrupt flag. When the flag gets set, I clear it, then continue running the rest of the function.

This has been working in a task on core 0 but when I run that same task on core 1 it does not.

When running in the task the code is bare metal and does not use any API's. The initialization is done using the API's in app_main(). Is it possible that since the initialization is being done in app_main(), which is running on core 0 that it will not work on core 1? Both cores should have identical access to the timer registers so I don't see why that should matter.

Thanks again

Re: Timer not working on core 1

Posted: Sat Jul 27, 2024 8:26 am
by eriksl
Yes, that is the case and it's documented.