-
Notifications
You must be signed in to change notification settings - Fork 15
Enable fixed timing between timer calls (vs fixed time btw. end of timer call and next call as implemented) #3
Comments
Please follow the instructions in Issue: Bug report, such as adding MRE, your special use-case, terminal debug messages, etc. to illustrate your points. It's really hard and I'm closing the issue now, and will reopen when you post the better enhancement request !!! |
Hi, The Pico SDK offers both options. Please refer to the Pico SDK (https://datasheets.raspberrypi.com/pico/raspberry-pi-pico-c-sdk.pdf). In the implementation of RPI_PIC_TimerInterrupt option "start to end" is used, for some users "start to start" is usefull, therefore would be nice to have both options. Hope this explains better Andreas Addendum :
|
Thanks so much for your detailed research and explanation, which led me to recheck the document and aware of my severe mistake. There is so much a guy can do, if not relying on the help of other people.
I'll fix the severe bug to let users to set Just wonder, in your valuable opinion, if it's necessary to permit users to use both Best Regards, |
I'm in the middle of doing something else, but couldn't wait and have fixed / released the new RPI_PICO_TimerInterrupt v1.3.0 Your contribution is noted at Contributions and Thanks Please test and inform if it's OK now. Regards, Releases v1.3.0
|
Hi Khoi Hoang,
I will test your release during this week.
And if you ask me about if both implementations are needed, my feeling
is that most needed is start-to-start option and the other end-to-start
is a nice to have.
I never new this different timing is anywhere existing until recently,
but the Raspberryy colleagues had for shure reasons for implementing I
am not aware of.
But it should be clearly stated or even better with a different
interface realized, else I assume other would run in similar issues just
by overlooking this small but important difference.
Regards Andreas
|
Hi Khoi Hoang, |
Good to know. Waiting to receive more bug reports from you. Thanks and Regards, |
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
The text was updated successfully, but these errors were encountered: