Replies: 2 comments 1 reply
-
Well, best would be to use a hardware timer/counter. Which platform are you on? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hm, did you check samples/drivers/misc/timeaware_gpio? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to use Zephyr to decode a DCC signal. I have my GPIO setup with an IRQ on both rising and falling edges. In order to decode the signal, I need to know how many microseconds have elapsed between the IRQs.
A half-bit is 58 +- 6 microseconds long, so any work that needs to be done needs to be accurate to that level.
My simplified code looks like the following:
However, this gives inconsistent results where sometimes the cycle time is less than 52 microseconds, and sometimes more than 64 microseconds, when the data coming in is fine(as far as I can tell with my oscilloscope).
Thoughts on what I could do:
Is one of the above ideas a reasonable thing to try? Or is there something that I'm missing?
Beta Was this translation helpful? Give feedback.
All reactions