0
\$\begingroup\$

I'm trying to have my optical encoder work on interrupts. I found some resources online that discuss it but they all seem to be based on an older version of debian since the files and folders in "/sys/class/gpio" are different. The article I was trying to use says to alter "/sys/class/gpio/gpio7/edge" by issuing "echo both > /sys/class/gpio/gpio7/edge" and monitor "/sys/class/gpio/gpio7/value" in the user program the interrupt is implemented in. I was wondering if anyone knows the equivalent files to alter in "Linux beaglebone 3.8.13-bone70"? I plan on using python w/ Adafruit_BBIO.GPIO but I wouldn't mind using C/C++ if needed. Any input or alternate method of implementing interrupts would be much appreciated.

thanks,

Link to article:

https://www.linux.com/learn/tutorials/765810-beaglebone-black-how-to-get-interrupts-through-linux-gpio

\$\endgroup\$
  • \$\begingroup\$ Note that the process in the article does not use interrupts, just a callback. \$\endgroup\$ – Scott Seidman Jan 20 '16 at 16:17
  • \$\begingroup\$ Do you know if there is a way to have a formal interrupt in the the user space? Or is a callback like the one in the article suitable for most applications that need interrupts? \$\endgroup\$ – CompMan Jan 20 '16 at 17:08
  • \$\begingroup\$ I don't know much about BBB -- but I keep hearing that there's a microcontroller unit in that thing that is separate from the main processor that handles the OS. It's hard to say whether the callback approach is suitable or not. I think it would depend upon how fast your encoder is going. It might help to provide some parameters about how fast your encoder will be ticking away. \$\endgroup\$ – Scott Seidman Jan 20 '16 at 18:33
  • \$\begingroup\$ Its the KY-040 optical encoder on a break-out board. Its kinda cheap and i haven't been able to find any formal datasheet on it. The exact frequency of its output signals depends on how fast your turning it and I haven't been able to find an approximate range anywhere online. \$\endgroup\$ – CompMan Jan 21 '16 at 21:29
1
\$\begingroup\$

BBB run on Sitara AM335x which already has the interface for 3 encoders, it called eQEP. The pins are probably used as GPIOs, what you would need is to locate pins of your board, then search for suitable linux driver that can use/setup those GPIOs as eQEP, then you don't need an interrupt - this method is deprecated, it was used with MCUs without a time process unit, nowdays MCUs have all those intefaces like encoder input, PWM generator, timers,...already implemented in hardware, they are very fast.
I have done a fast internet search and this might help you: https://github.com/Teknoman117/beaglebot/tree/master/encoders/patches

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.