Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Enable fixed timing between timer calls (vs fixed time btw. end of timer call and next call as implemented) #3

@AndreasOKircher

Description

@AndreasOKircher

Ardunio IDE 1.8.19
RP2040 core v2.5.2
RPI_PICO_TimerInterrupt 1.2.0
Adafruit Feather
Windows

Issue

I struggled to get a precise timing for repeating timer interrupts (using RPI_PICO_Timer X and X.setFrequency(.....) )
Eg. instead of expected 5000 hz, I get 4950 Hz, always little slower than intended (measured with Oszi)

Proposal

In the PICO SDK the function 4.2.14.4.2. add_repeating_timer_us has the option to pass the variable delay_us in positive and negative form. If positive values are passed and this leads to exact timing btw. end of timer interrupt call and the next timer interrupt call ( The way the libary is implemented (at least in setFrequency)
If negativ values are passed this leads to same intervalls btw. start of timer interrupt.

At least for me the passing negativ values to function add_repeating_timer_us solved the issue and the timer interrupt frequency is as expected.
Maybe you can give both options to set timers.

Many Thanks for your great work !

Andreas

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions