eqep2 problemss

Dear,
I’m struggling with eqep2 on BBB, After one week of attempts nothing works…
Here my situation:

  • I compiled this dts file (generating bone_eqep2-new-00A0.dtbo):

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
compatible = “ti,beaglebone”, “ti,beaglebone-black”;

// identification
part-number = “bone_eqep2b”;
version = “00A0”;

// resources this cape uses
exclusive-use =
“P8.12”, // EQEP2A_in
“P8.11”, // EQEP2B_in
“P8.16”, // EQEP2_index
“P8.15”, // EQEP2_strobe

“eqep2”; // hardware ip used

/*

  • Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
    */
    fragment@0 {
    target-path=“/”;
    overlay {

chosen {
overlays {
bone_eqep2b-00A0 = TIMESTAMP;
};
};
};
};

/*

  • Free up the pins used by the cape from the pinmux helpers.
    /
    fragment@1 {
    target = <&ocp>;
    overlay {
    P8_12_pinmux { status = “disabled”; }; /
    P8_12: GPIO1_12 = EQEP2A_in /
    P8_11_pinmux { status = “disabled”; }; /
    P8_11: GPIO1_13 = EQEP2B_in /
    P8_16_pinmux { status = “disabled”; }; /
    P8_16: GPIO1_14 = EQEP2_index /
    P8_15_pinmux { status = “disabled”; }; /
    P8_15: GPIO1_15 = EQEP2_strobe */
    };
    };

fragment@2 {
target = <&am33xx_pinmux>;
overlay {
pinctrl_eqep2: pinctrl_eqep2_pins {
pinctrl-single,pins = <
BONE_P8_12 (PIN_INPUT_PULLUP | MUX_MODE4) /* P8_12: GPIO1_12 = EQEP2A_in /
BONE_P8_11 (PIN_INPUT_PULLUP | MUX_MODE4) /
P8_11: GPIO1_13 = EQEP2B_in /
BONE_P8_16 (PIN_INPUT | MUX_MODE4) /
P8_16: GPIO1_14 = EQEP2_index /
BONE_P8_15 (PIN_INPUT | MUX_MODE4) /
P8_15: GPIO1_15 = EQEP2_strobe */
// From: Redirecting to Google Groups

;
};
};
};

fragment@3 {
target = <&epwmss2>;
overlay {
status = “okay”;
};
};

fragment@4 {
target = <&eqep2>;
overlay {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_eqep2>;

count_mode = <0>; // count_mode is not userspace op_mode
// 0 → Quadrature mode, normal 90 phase offset cha & chb.
// 1 → Direction mode. cha input = clock, chb input = direction
// 2 → UP count mode for frequency measurement QDIR=1, ignore direction input
// 3 → DOWN count mode for frequency measurement QDIR=0, ignore direction input

swap_inputs = <0>; // swap channel A and B? (0 - no, 1 - yes)
invert_qa = <0>; // invert channel A input?
invert_qb = <0>; // invert channel B input?
invert_qi = <0>; // invert index input?
invert_qs = <0>; // invert strobe input?
omit_interrupt = <0>; // 1 → do not install interrupt handler, 0 → do install

status = “okay”;
};
};
};

  • Moved file to /lib/firmware

  • Modified /boot/uEnv.txt:

#Docs: Beagleboard:U-boot partitioning layout 2.0 - eLinux.org

enable_uboot_overlays=1
enable_uboot_cape_universal=1
disable_uboot_overlay_video=1

uname_r=4.14.108-ti-r127
#uuid=
#dtb=
cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet

#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e

#Use an overlayfs on top of a read-only root filesystem:
#cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet overlayroot=tmpfs

##enable x15: eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3-no-eeprom.sh

#uboot_overlay_addr0=/lib/firmware/PRU_BlinkLed-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo

uboot_overlay_eqep2=/lib/firmware/bone_eqep2-new-00A0.dtbo

  • Reboot BBB

  • cd /sys/devices/platform/ocp/48304000.epwmss/48304180.eqeps

  • cat enabled → 1

  • cat mode → 0

  • cat position → 0

  • Connnect the encoder.

  • cat position → 0 ALWAYS

  • /opt/scripts/tool/version.sh:

git:/opt/scripts/:[e457c010efc76c4e6fecccb7a5f7ff9b0597c4c0]
eeprom:[A335BNLT00C01020BBBK2003]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2020-02-01]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-UIO-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0]
kernel:[4.14.108-ti-r127]
nodejs:[v6.17.0]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[enable_uboot_cape_universal=1]
uboot_overlay_options:[disable_uboot_overlay_video=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[uboot_overlay_eqep2=/lib/firmware/bone_eqep2-new-00A0.dtbo]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.14.20200430.0-0~stretch+20200430]
pkg:[bb-wl18xx-firmware]:[1.20190227.1-0rcnee0~stretch+20190227]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~stretch+20190327]
pkg:[firmware-ti-connectivity]:[20180825+dfsg-1rcnee1~stretch+20181217]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 1.306013] remoteproc remoteproc0: wkup_m3 is available
[ 1.394865] remoteproc remoteproc0: powering up wkup_m3
[ 1.394975] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 1.399517] remoteproc remoteproc0: remote processor wkup_m3 is now up
dmesg | grep pru
dmesg | grep pinctrl-single
[ 0.948952] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 0.961540] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

  • dmesg doesn’t give any info regarding the overlay.
  • I don’t know where I’m wrong.

Let me know if you can help me.
Regards.

#uboot_overlay_addr0=/lib/firmware/PRU_BlinkLed-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo

uboot_overlay_eqep2=/lib/firmware/bone_eqep2-new-00A0.dtbo

We aren't that fancy ^ just use:

uboot_overlay_addr0=/lib/firmware/bone_eqep2-new-00A0.dtbo

Regards,

Thanks Robert for your quick reply.
I tried changing from uboot_overlay_eqep2 to uboot_overlay_addr0 but nothing happened.
Eqep2 is still not counting.

I checked the messages from ‘version.h’ and there is something strange (to me…):

uboot_overlay_options:[uboot_overlay_addr0=/lib/firmware/bone_eqep2-new-00A0.dtbo]

pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]

Same message when I was using uboot_overlay_eqep2=/lib/firmware/bone_eqep2-new-00A0.dtbo

I tried changing uEnv.txt to

uboot_overlay_addr0=/lib/firmware/bone_eqep21-new-00A0.dtbo

File …eqep21… doesn’t exist. After reboot I had the same message from ‘version.h’:

uboot_overlay_options:[uboot_overlay_addr0=/lib/firmware/bone_eqep21-new-00A0.dtbo]

pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]

Could it be a problem?

Is there something else I can check?
Regards.

Sure, check out libpruio. Easy controlling of QEP modules in one, two or three line configurations (without any device tree trouble).

Regards