linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libgpiod] Polling precision/order
@ 2020-06-02  1:59 Ryan Lovelett
  2020-06-03 14:54 ` Kent Gibson
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Lovelett @ 2020-06-02  1:59 UTC (permalink / raw)
  To: linux-gpio

I am trying to use libgpiod to listen for falling edge events to determine rotation direction for a rotary encoder and the values I'm reading seem unstable. I am starting to wonder if either my approach is flawed or libgpiod/Linux cannot be used for this purpose.

Rather than post my code and go with that I think I can explain the problem using the provided tools. Specifically, gpiomon, 
e.g., gpiomon --falling-edge --active-low gpiochip0 3 4. Here I've hooked up the rotary encoder clock and signal gpio pins 3 and 4. Spinning one direction should make 3 go low before 4 and spinning the opposite should make 4 go low before 3. Looking at the signal on the oscilloscope shows exactly that behavior.

Unfortunately, I do not see that in the gpiomon output. It is erratic and order is not always guaranteed. Is this just something that is not going to work on Linux due to the nature of interrupts on Linux? Is this a bug? Or just not supported use case?

-- 
  Ryan Lovelett

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-11 16:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-02  1:59 [libgpiod] Polling precision/order Ryan Lovelett
2020-06-03 14:54 ` Kent Gibson
2020-06-11 16:52   ` Ryan Lovelett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).