raspberrypi / pico-sdk

BSD 3-Clause "New" or "Revised" License
3.26k stars 838 forks source link

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

Closed hajmedwissem closed 1 month ago

hajmedwissem commented 5 months ago

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.

peterharperuk commented 5 months ago

Is the alarm_id returned <0?

hajmedwissem commented 5 months ago

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

kilograham commented 1 month ago

please provide a more complete repro scenario (or ask on the forums https://forums.raspberrypi.com/viewforum.php?f=143)