assert(rt->alarm_id == id) fails for repeating timers on two cores #1485

Closed
opened 2023-08-27 10:43:54 -05:00 by MrtzGtz · 3 comments
MrtzGtz commented 2023-08-27 10:43:54 -05:00 (Migrated from github.com)

I created a repeating timer independently on each core with alarm_pool_create and alarm_pool_add_repeating_timer_us with different hardware alarms for each alarm_pool.

When using small values for the delay_us (like 40) assert(rt->alarm_id == id); fails in repeating_timer_callback.

I created a project to reproduce the error: pico_timer_error.

I already researched the problem and only found others which had errors with the timer, like #737 and Pico Forum: add_alarm_in_ms - assertion?

I created a repeating timer independently on each core with `alarm_pool_create` and `alarm_pool_add_repeating_timer_us` with different hardware alarms for each alarm_pool. When using small values for the `delay_us` (like 40) `assert(rt->alarm_id == id);` fails in `repeating_timer_callback`. I created a project to reproduce the error: [pico_timer_error](https://github.com/MrtzGtz/pico_timer_error). I already researched the problem and only found others which had errors with the timer, like #737 and [Pico Forum: add_alarm_in_ms - assertion?](https://forums.raspberrypi.com/viewtopic.php?t=348922&)
kilograham commented 2023-08-28 15:11:10 -05:00 (Migrated from github.com)

thanks for the repo, that will be a big help!

thanks for the repo, that will be a big help!
kilograham commented 2023-08-29 09:35:21 -05:00 (Migrated from github.com)

ah, that assertion is actually incorrect - it breaks if the repeating timer has a very short period, and fires before creating the timer is fully complete
Screenshot from 2023-08-29 09-32-30

ah, that assertion is actually incorrect - it breaks if the repeating timer has a very short period, and fires before creating the timer is fully complete ![Screenshot from 2023-08-29 09-32-30](https://github.com/raspberrypi/pico-sdk/assets/575810/611bccaa-4618-4180-8665-a8042fda3df5)
kilograham commented 2023-08-29 11:29:31 -05:00 (Migrated from github.com)

merged into develop

merged into develop
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1485
No description provided.