pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

The timer doesn't work when using FreeRTOS in a multicore environment.

Open hajmedwissem opened this issue 1 year ago • 2 comments

I use FreeRTOS on the Raspberry Pi Pico to utilize both cores. In one of my FreeRTOS tasks running on core 1, I have created a timer with a callback function scheduled to run every 90 microseconds. However, the function is never called. I use the following code to create the timer and set the alarm:

add_alarm_in_us(90, timer_callback, NULL, true);

Could anyone explain why the timer isn't starting? Thank you, guys.

hajmedwissem avatar Jan 12 '24 12:01 hajmedwissem

Is the alarm_id returned <0?

peterharperuk avatar Jan 12 '24 13:01 peterharperuk

After debugging, the value of alarm_id returned by the add_alarm_in_us() function is equal to 1

hajmedwissem avatar Jan 12 '24 13:01 hajmedwissem