eQEP position-compare sync output does not match encoder index pulse

Hi all.

I am working on a project using the BBB PRU and eQEP module. At given positions I am using a pulse to trigger the shutter on a camera that is pointed at the motor that is driving the encoder. For testing purposes I am attempting to get a pulse on every rotation so I can easily compare the image from one rotation to the next to confirm that I am properly trigging every rotation. ‘

This is my first time using the BBB, and it has been quite the learning experience. I have been using the AM335x technical reference manual (starts on page 1650) as a guide for doing this.

The problem:

Using an oscilloscope with the green probe attached to position compare sync output index pin (P8_31) and the red probe attached to the index input from the encoder on each rotation of the motor I am seeing the time between the pulses varying (see attached image Problem.gif, a picture is worth a thousand words). It is important to note that the system technically works, however because the difference in timing I am unable to capture the images that I need. The goal is to be able to consistently get the expected image.

Things I have tried:

Switching the sync output pulse between the strobe and index pins. No change in behavior.

Adjusting the value put into the position-compare register. I tried both 4,001 and 3,999. In each case I still see variance between the position-compare sync output and the index pulse.

Hooking the camera shutter up directly to the index pulse from the encoder and the resulting images show little to no change from one rotation to the next. The camera itself is hooked to a PC that is receiving the image. This confirms that my method for capturing images seems adequate.


I am working on the assumption that the position-compare register on the eQEP module, when set to 4k for my encoder, should exactly match the index pulse coming from the encoder. Is this assumption correct?

Are there any additional debugging steps I could take to determine why this is happening?

Technical details:

Linux beaglebone 3.8.13-bone84 #1 SMP Sun Feb 12 02:54:13 UTC 2017 armv7l GNU/Linux


PRU_encoder.p (3.04 KB)

PRU_encoder.c (4.42 KB)

PRU_encoder.hp (1.64 KB)

For those interested, and electrical engineer solved the problem.

The issue was noise in the A/B channels from the encoder. This was causing extra pulses to be registered.