Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rp2040 interrupts: is microsecond precision ok? #3689

Open
SylvainGarrigues opened this issue Dec 27, 2024 · 0 comments
Open

rp2040 interrupts: is microsecond precision ok? #3689

SylvainGarrigues opened this issue Dec 27, 2024 · 0 comments

Comments

@SylvainGarrigues
Copy link

I have a 433 MHz receiver with a DATA pin which is connected to a GPIO of my raspberry pico board. Decoding signals basically involves measuring times between edges of this GPIO pin and trying to match those times with one remote control protocol (cf. for instance https://github.com/sui77/rc-switch/blob/master/RCSwitch.cpp#L671).

Schematically:

loop {
    rx_pin.wait_for_any_edge()
    current_instant = Instant::now()
    process_duration((current_instant - last_instant).as_micros())
    last_instant = current_instant
}

This algorithm works great when using an ESP8266 and Arduino / C code (cf. rc-switch link above), but when I use pico board and the Embassy framework and wait_for_any_edge / Instant combination, I get really different and unexpected durations with the same remote / transmitter.

Question is: are interrupts used this way in Embassy precise enough i.e. with 10 microseconds precision? Am I doing something wrong, should I use any other mechanism or timer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant