|
1 | | -# Adafruit_BBIO.Encoder module |
| 1 | +# Adafruit_BBIO.Encoder |
2 | 2 |
|
3 | | -This module enables access to the Beaglebone Black enhanced Quadrature Encoder Pulse (eQEP) modules: eQEP0, eQEP1 and eQEP2. |
4 | | - |
5 | | -Initially based on the [PyBBIO](https://github.com/graycatlabs/PyBBIO/bbio/libraries/RotaryEncoder/rotary_encoder.py) rotary encoder code. |
| 3 | +This module enables access to the Beaglebone Black enhanced Quadrature Encoder Pulse (eQEP) modules: eQEP0, eQEP1 and eQEP2/eQEP2b. |
6 | 4 |
|
7 | 5 | ## Prerequisites |
8 | 6 |
|
9 | | -These instructions are based on a 4.4.x Linux kernel. |
10 | | - |
11 | | -In order to use all eQEP pins the BeagleBone must boot with the [cape-universal](https://github.com/beagleboard/bb.org-overlays/tree/master/tools/beaglebone-universal-io) enabled, and load the cape-universal overlay |
12 | | - |
13 | | -``` |
14 | | -enable_uboot_cape_universal=1 |
15 | | -``` |
| 7 | +These instructions are based on: |
16 | 8 |
|
17 | | -Notes: |
18 | | -- It seems that the `cape-universal` cape _does only enable access to eQEP0 and eQEP2_. TBD: check how to load [`cape-universala`](https://github.com/cdsteinkuehler/beaglebone-universal-io/pull/30) |
19 | | -- An alternative option to the `cape-universal` overlay would be to load one of the [dedicated eQEP overlays](https://github.com/Teknoman117/beaglebot/tree/master/encoders/dts). |
| 9 | +- Linux kernel: 4.4.x or later |
| 10 | +- `bb-cape-overlays` package: version 4.4.20171120.0-0rcnee1~stretch+20171120 or later |
| 11 | +- `bb-customizations` package: version 1.20171123-0rcnee0~stretch+20171123 or later |
20 | 12 |
|
21 | | -### Install/upgrade the latest Device Tree overlays |
| 13 | +It's recommended to run the following command to ensure you have the latest required packages: |
22 | 14 |
|
23 | 15 | ``` |
24 | | -sudo apt-get upgrade bb-cape-overlays |
| 16 | +sudo apt upgrade bb-cape-overlays bb-customizations |
25 | 17 | ``` |
26 | 18 |
|
27 | | -### Load the universal cape |
| 19 | +In order to use all eQEP pins the BeagleBone must boot with the [cape-universal](https://github.com/beagleboard/bb.org-overlays/tree/master/tools/beaglebone-universal-io) enabled, and load the `cape-universal` overlay. |
28 | 20 |
|
29 | | -If it doesn't already contain it, modify the `/boot/uEnv.txt` file to contain this line: |
| 21 | +This is the default, thus **no further steps are initially required to use eQEP0 and eQEP2**. Simply double-check that the following line is present and not commented out on your `/boot/uEnv.txt` file: |
30 | 22 |
|
31 | 23 | ``` |
32 | 24 | enable_uboot_cape_universal=1 |
33 | 25 | ``` |
34 | 26 |
|
35 | | -Notes: |
| 27 | +Note: Some older documentation recommends using the `cmdline` and `cape_enable` options instead. They are meant to load deprecated kernel-based overlays and it's not recommended to use them. Use the new way of [loading overlays via uboot](https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays) instead, as instructed above. |
| 28 | + |
| 29 | +### Enabling additional eQEP modules |
36 | 30 |
|
37 | | -- Some older documentation recommends using these two lines instead. They are meant to load deprecated kernel-based overlays and it's not recommended to use them. Use the new way of [loading overlays via uboot](https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays) instead, as instructed above. |
| 31 | +The `cape-universal` overlay will enable access to the eQEP0 and eQEP2 modules. As it does not expose pins that are shared with the HDMI interface, eQEP1 and eQEP2b will **not** be available. |
38 | 32 |
|
39 | | - ``` |
40 | | - cmdline=cape_universal=enable # Plus some other options |
41 | | - ``` |
42 | | - ``` |
43 | | - cape_enable=bone_capemgr.enable_partno=cape-universala |
44 | | - ``` |
45 | | -- TBD: check the overlays that are currently loaded |
| 33 | +To disable the HDMI interface and gain access to the pins and peripherals that share its pins, comment out the following line on the `/boot/uEnv.txt` file and reboot: |
| 34 | + |
| 35 | +``` |
| 36 | +disable_uboot_overlay_video=1 |
| 37 | +``` |
46 | 38 |
|
47 | 39 | ## eQEP configuraton |
48 | 40 |
|
49 | | -Note: if either eQEP1 or eQEP2b are used on the Beaglebone Black, video must be disabled, as their pins are shared with the LCD_DATAx lines of the HDMI interface. |
| 41 | +Notes: |
| 42 | + |
| 43 | +- If either eQEP1 or eQEP2b are used on the Beaglebone Black, video must be disabled, as their pins are shared with the LCD_DATAx lines of the HDMI interface. |
| 44 | +- eQEP2 and eQEP2b are the same module, but with the alternative of accessing it via two sets of pins. These are mutually exclusive. |
50 | 45 |
|
51 | 46 | ### eQEP0 |
52 | 47 |
|
@@ -91,7 +86,12 @@ $ config-pin P8.41 qep |
91 | 86 | $ config-pin P8.42 qep |
92 | 87 | $ cat /sys/devices/platform/ocp/48304000.epwmss/48304180.eqep/position |
93 | 88 | ``` |
| 89 | + |
| 90 | +## Credits |
| 91 | + |
| 92 | +Initially based on the [PyBBIO](https://github.com/graycatlabs/PyBBIO/bbio/libraries/RotaryEncoder/rotary_encoder.py) rotary encoder code. |
| 93 | + |
94 | 94 | ## Further reading |
95 | 95 |
|
96 | | -- [Beaglebone encoder inputs](https://github.com/Teknoman117/beaglebot/tree/master/encoders) |
97 | | -- [Beaglebone eQEP overlays](https://github.com/Teknoman117/beaglebot/tree/master/encoders/dts) |
| 96 | +1. [Beaglebone encoder inputs](https://github.com/Teknoman117/beaglebot/tree/master/encoders) |
| 97 | +1. [Beaglebone eQEP overlays](https://github.com/Teknoman117/beaglebot/tree/master/encoders/dts) |
0 commit comments