Giuseppe, I cheated a little in my setup. Instead of hooking up an encoder, I've only hooked up two SPDT buttons I took from the inside of a ball mouse to ground and 3.3V and pressed the buttons to generate gray code.
I set mine up again to see if I could spot anything and came across a little problem. Check your pinmux settings after loading the dtbo. When I loaded the eqep2 dtbo provided by Teknoman117, the pinmux didn't change. I've attached the output from my successful session where I load my custom eqep2 dtbo on P8's 11 & 12. You might need to recompile the dtbo's. James On Monday, October 14, 2013 5:31:24 AM UTC-5, Giuseppe Iellamo wrote: > > Hi James, > > After a lot of other tests I'm quite sure the pins are hooked correct, > really the eQep reads something, the only thing is tath it is continually > underflow/Overflow... > > I'm experimentig varying the QEPCTL settings but without luck (until now). > > Giuseppe > > Il giorno sabato 12 ottobre 2013 22:41:58 UTC+2, James Zapico ha scritto: >> >> I came across that post and Teknoman's library a few weeks ago. I have >> been able to compile it and get the eQEP to work on 3.8.13-bone28 Ubuntu >> 12.04 (shortly before I carelessly shorted my BBB). Yes, the position sysfs >> entry does change when I use it. The only problems I noticed were you have >> to make sure you're hooked up to the correct pins, and the pullup/pulldown >> settings don't seem to do anything in eQEP mode. >> >> On Friday, October 11, 2013 9:42:57 AM UTC-5, Giuseppe Iellamo wrote: >>> >>> Hi all, >>> >>> Since I want to use Beaglebone black in order to perform e motor >>> position controller I need to use an Encoder. >>> I'm struggling with the eQep configuration. >>> >>> Searching other posts I found this: >>> >>> >>> https://groups.google.com/forum/#!searchin/beagleboard/encoder/beagleboard/mE_ha4zOApM/VewMCyQx37kJ >>> >>> In which Teknoman117 released his own version of a kernel module driver. >>> >>> I compiled it, and it seems to work except that the posiotion sysfs >>> entry is always 0. >>> >>> Has anybody ever used it? >>> Or Has anybaody used the eQep? >>> >>> I'm using a 3.8.13bone28 kernel with xenomai extensions... >>> >> -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
ubuntu@ubuntu-armhf:~$ sudo bash root@ubuntu-armhf:~# cd /lib/firmware/ root@ubuntu-armhf:/lib/firmware# cat bone_eqep2alt.dts /* * Copyright (C) 2013 Nathaniel R. Lewis - http://teknoman117.wordpress.com/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Enable eQEP2 on the Beaglebone White and Black */ /dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black"; /* identification */ part-number = "bone_eqep2"; version = "00A0"; fragment@0 { target = <&am33xx_pinmux>; __overlay__ { pinctrl_eqep2: pinctrl_eqep2_pins { pinctrl-single,pins = < 0x038 0x24 /* P8_16 = GPIO2_14 = EQEP2_index, MODE4 */ 0x03C 0x24 /* P8_15 = GPIO2_15 = EQEP2_strobe, MODE4 */ 0x030 0x34 /* P8_12 = GPIO2_12 = EQEP2A_in, MODE4 */ 0x034 0x34 /* P8_11 = GPIO2_13 = EQEP2B_in, MODE4 */ >; }; }; }; fragment@1 { target = <&epwmss2>; __overlay__ { status = "okay"; }; }; fragment@2 { target = <&eqep2>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_eqep2>; count_mode = <0>; /* 0 - Quadrature mode, normal 90 phase offset cha & chb. 1 - Direction mode. cha input = clock, chb input = direction */ swap_inputs = <0>; /* Are channel A and channel B swapped? (0 - no, 1 - yes) */ invert_qa = <1>; /* Should we invert the channel A input? */ invert_qb = <1>; /* Should we invert the channel B input? I invert these because my encoder outputs drive transistors that pull down the pins */ invert_qi = <0>; /* Should we invert the index input? */ invert_qs = <0>; /* Should we invert the strobe input? */ status = "okay"; }; }; }; root@ubuntu-armhf:/lib/firmware# echo bone_eqep2alt > $SLOTS root@ubuntu-armhf:/lib/firmware# cat $SLOTS 0: 54:PF--- 1: 55:PF--- 2: 56:PF--- 3: 57:PF--- 4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI 7: ff:P-O-L Override Board Name,00A0,Override Manuf,bone_eqep2alt root@ubuntu-armhf:/lib/firmware# cat $PINS | grep 834 pin 13 (44e10834) 00000034 pinctrl-single root@ubuntu-armhf:/lib/firmware# cat $PINS | grep 830 pin 12 (44e10830) 00000034 pinctrl-single root@ubuntu-armhf:/lib/firmware# cd /sys/devices/ocp.3/48304000.epwmss/48304180.eqep/ root@ubuntu-armhf:/sys/devices/ocp.3/48304000.epwmss/48304180.eqep# ls driver enabled modalias mode period position power subsystem uevent root@ubuntu-armhf:/sys/devices/ocp.3/48304000.epwmss/48304180.eqep# cat enabled 1 root@ubuntu-armhf:/sys/devices/ocp.3/48304000.epwmss/48304180.eqep# cat mode 0 root@ubuntu-armhf:/sys/devices/ocp.3/48304000.epwmss/48304180.eqep# cat period 1000000000 root@ubuntu-armhf:/sys/devices/ocp.3/48304000.epwmss/48304180.eqep/power# cd .. root@ubuntu-armhf:/sys/devices/ocp.3/48304000.epwmss/48304180.eqep# while [[ 1 ]] > do > cat position > sleep 1 > done 0 0 0 1 1 1 2 4 5 7 10 14
