eQEP Python error on PocketBeagle

48 views
Skip to first unread message

Mark A. Yoder

unread,
Jun 16, 2020, 8:25:56 PM6/16/20
to BeagleBoard
I'm trying to use the encoders via Python:

from Adafruit_BBIO.Encoder import RotaryEncoder, eQEP2
import time


# Instantiate the class to access channel eQEP2, and initialize
# that channel
myEncoder
= RotaryEncoder(eQEP2)


# Get the current position


while True:
    cur_position
= myEncoder.position
   
print(cur_position)
    time
.sleep(1)

But I get the following error:

Traceback (most recent call last):
 
File "./eQEP.py", line 8, in <module>
    myEncoder
= RotaryEncoder(eQEP2)
 
File "/usr/local/lib/python3.7/dist-packages/Adafruit_BBIO-1.1.1-py3.7-linux-armv7l.egg/Adafruit_BBIO/Encoder.py", line 195, in __init__
   
self._eqep = _eQEP.fromdict(_eQEP_DEFS[eqep_num])
 
File "/usr/local/lib/python3.7/dist-packages/Adafruit_BBIO-1.1.1-py3.7-linux-armv7l.egg/Adafruit_BBIO/Encoder.py", line 126, in fromdict
   
return cls(**df)
 
File "/usr/local/lib/python3.7/dist-packages/Adafruit_BBIO-1.1.1-py3.7-linux-armv7l.egg/Adafruit_BBIO/Encoder.py", line 150, in __init__
   
self.node = Node(sys_path)
 
File "/usr/local/lib/python3.7/dist-packages/Adafruit_BBIO-1.1.1-py3.7-linux-armv7l.egg/Adafruit_BBIO/sysfs.py", line 78, in __init__
   
self.__dict__.update(dict.fromkeys(listdir(self._path_)))
FileNotFoundError: [Errno 2] No such file or directory: '/sys/devices/platform/ocp/48304000.epwmss/48304180.eqep'


I'm running a current image:

cat /ID.txt
BeagleBoard.org Debian Buster IoT Image 2020-04-06
name -a
Linux pocket 4.19.94-ti-r42 #1buster SMP PREEMPT Tue Mar 31 19:38:29 UTC 2020 armv7l GNU/Linux

Any suggestions on how to make it work?

--Mark



Drew Fustini

unread,
Jun 17, 2020, 8:05:13 AM6/17/20
to Beagle Board
I think the problem is
/sys/devices/platform/ocp/48304000.epwmss/48304180.eqep is missing.

It is possible the eQEP driver is not being loaded. I've not tried to
use it in a long time.

Which image are you using? I can try to replicate.

thanks,
drew

Mark A. Yoder

unread,
Jun 17, 2020, 10:01:10 AM6/17/20
to BeagleBoard
Drew:
  Yes,
/sys/devices/platform/ocp/48304000.epwmss/48304180.eqep

is missing.  There's no errors in dmesg about eqp.

I'm running the current image.
cat /ID.txt 
BeagleBoard.org Debian Buster IoT Image 2020-04-06 
uname -a 

Linux pocket 4.19.94-ti-r42 #1buster SMP PREEMPT Tue Mar 31 19:38:29 UTC 2020 armv7l GNU/Linux 


On Wednesday, June 17, 2020 at 8:05:13 AM UTC-4, Drew Fustini wrote:

Mark A. Yoder

unread,
Jun 17, 2020, 10:28:25 AM6/17/20
to BeagleBoard
It's also missing on the 5.4 and 4.14 kernels.

Drew Fustini

unread,
Jun 18, 2020, 1:10:10 PM6/18/20
to Beagle Board
I think what is missing is adding the appropriate eQEP overlay to the
uboot config.

This should do it:
uboot_overlay_addr4=/lib/firmware/bone_eqep0-00A0.dtbo

debian@beaglebone:~$ dmesg |grep -i qep
[ 1.802343] eqep 48300180.eqep: ver. 1.0
[ 1.806717] eqep 48300180.eqep: count_mode:1
[ 1.811157] eqep 48300180.eqep: invert_qa:0
[ 1.815435] eqep 48300180.eqep: invert_qb:0
[ 1.819700] eqep 48300180.eqep: invert_qi:0
[ 1.823929] eqep 48300180.eqep: invert_qs:0
[ 1.828167] eqep 48300180.eqep: swap_inputs:0
[ 1.832836] eqep 48300180.eqep: QDECCTL:0x4000
[ 1.837462] eqep 48300180.eqep: QPOSINIT:0x00000000
[ 1.842556] eqep 48300180.eqep: QPOSMAX:0xffffffff
[ 1.847411] eqep 48300180.eqep: QPOSCNT:0x00000000
[ 1.852254] eqep 48300180.eqep: omit_interrupt:0
[ 1.856948] eqep 48300180.eqep: QEINT:0x0800
[ 1.861297] eqep 48300180.eqep: QUPRD:0x05f5e100
[ 1.865995] eqep 48300180.eqep: QEPCTL:0x009e write
[ 1.870964] eqep 48300180.eqep: QEPCTL:0x009e read
[ 1.875850] eqep 48300180.eqep: irq:101, clk_rate:100000000
[ 1.888276] pinctrl-single 44e10800.pinmux: pin PIN107 already
requested by 48300180.eqep; cannot claim for ocp:P1_29_pinmux
[ 1.958007] pinctrl-single 44e10800.pinmux: pin PIN104 already
requested by 48300180.eqep; cannot claim for ocp:P1_31_pinmux
[ 2.045313] pinctrl-single 44e10800.pinmux: pin PIN106 already
requested by 48300180.eqep; cannot claim for ocp:P2_28_pinmux
[ 2.107607] pinctrl-single 44e10800.pinmux: pin PIN105 already
requested by 48300180.eqep; cannot claim for ocp:P2_34_pinmux

debian@beaglebone:~$ uname -a
Linux beaglebone 4.19.94-ti-r43 #1buster SMP PREEMPT Wed Apr 22
06:11:16 UTC 2020 armv7l GNU/Linux

And the /sys/devices entries are there:

debian@beaglebone:~$ ls -la
/sys/devices/platform/ocp/48300000.epwmss/48300180.eqep/
total 0
drwxrwxr-x 3 root gpio 0 May 18 17:30 .
drwxrwxr-x 5 root gpio 0 May 18 17:30 ..
lrwxrwxrwx 1 root gpio 0 May 18 17:30 driver ->
../../../../../bus/platform/drivers/eqep
-rw-rw-r-- 1 root gpio 4096 May 18 17:30 driver_override
-rw-rw-r-- 1 root gpio 4096 May 18 17:30 enabled
-r--r--r-- 1 root gpio 4096 May 18 17:30 modalias
-rw-rw-r-- 1 root gpio 4096 May 18 17:30 mode
lrwxrwxrwx 1 root gpio 0 May 18 17:30 of_node ->
../../../../../firmware/devicetree/base/ocp/epwmss@48300000/eqep@0x48300180
-rw-rw-r-- 1 root gpio 4096 May 18 17:30 period
-rw-rw-r-- 1 root gpio 4096 May 18 17:30 position
drwxrwxr-x 2 root gpio 0 May 18 17:30 power
lrwxrwxrwx 1 root gpio 0 May 18 17:30 subsystem ->
../../../../../bus/platform
-rw-rw-r-- 1 root gpio 4096 May 18 17:30 uevent


-Drew

Robert Nelson

unread,
Jun 18, 2020, 1:12:31 PM6/18/20
to Beagle Board, David Lechner
On Wed, Jun 17, 2020 at 9:28 AM Mark A. Yoder <mark.a...@gmail.com> wrote:
>
> It's also missing on the 5.4 and 4.14 kernels.

eQEP on 5.4.x is going to be fun, @David Lechner 's counter driver is
now available. ;)

Regards,

--
Robert Nelson
https://rcn-ee.com/

Drew Fustini

unread,
Jun 18, 2020, 2:44:20 PM6/18/20
to Beagle Board, David Lechner
On Thu, Jun 18, 2020 at 7:12 PM Robert Nelson <robert...@gmail.com> wrote:
>
> On Wed, Jun 17, 2020 at 9:28 AM Mark A. Yoder <mark.a...@gmail.com> wrote:
> >
> > It's also missing on the 5.4 and 4.14 kernels.
>
> eQEP on 5.4.x is going to be fun, @David Lechner 's counter driver is
> now available. ;)
>

Yes, it will be good to move to that as now there is a proper support
for counters.

Are you compiling it into our 5.4?

-Drew
Reply all
Reply to author
Forward
0 new messages