This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62: eQEP function of resetting the position counter using the index pin

Part Number: SK-AM62

Tool/software:

Hi,

I am using SK-AM62 with PSDK 9.2 and would like to confirm the eQEP function of resetting the position counter using the index pin.

I am having trouble with the counter not resetting even after setting IEI.

Here's what I've tried:

# connect GPIO0_41 to EQEP0_A and GPIO0_42 to EQEP0_I
# enable GPIO0_41
echo 461 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio461/direction
echo 0 > /sys/class/gpio/gpio461/value
# enable GPIO0_42
echo 462 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio462/direction
echo 0 > /sys/class/gpio/gpio462/value
# set UP mode
echo increase > /sys/bus/counter/devices/counter0/count0/function
# enable position counter
echo 1 > /sys/bus/counter/devices/counter0/count0/enable
# set IEI 2 (IEI_INITRISING)
devmem2 0x23200028 w 0x02088000
# increment counter
echo 1 > /sys/class/gpio/gpio461/value
echo 0 > /sys/class/gpio/gpio461/value
# check current counter
cat /sys/bus/counter/devices/counter0/count0/count
# trigger Index pin
echo 1 > /sys/class/gpio/gpio462/value
# check current counter but count is not zero.
cat /sys/bus/counter/devices/counter0/count0/count

If you try the same thing with SEI, it works as expected.

# connect GPIO0_41 to EQEP0_A and GPIO0_42 to EQEP0_S
# enable GPIO0_41
echo 461 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio461/direction
echo 0 > /sys/class/gpio/gpio461/value
# enable GPIO0_42
echo 462 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio462/direction
echo 0 > /sys/class/gpio/gpio462/value
# set UP mode
echo increase > /sys/bus/counter/devices/counter0/count0/function
# enable position counter
echo 1 > /sys/bus/counter/devices/counter0/count0/enable
# set SEI 2 (SEI_INITQEPSRISING)
devmem2 0x23200028 w 0x08088000
# increment counter
echo 1 > /sys/class/gpio/gpio461/value
echo 0 > /sys/class/gpio/gpio461/value
# check current counter
cat /sys/bus/counter/devices/counter0/count0/count
# trigger Strobe pin
echo 1 > /sys/class/gpio/gpio462/value
# check current counter and counter is zero.
cat /sys/bus/counter/devices/counter0/count0/count

I would appreciate some advice.

Regards, 

Takayuki

  • Hello Takayuki-san,

    We have not tried connecting EQEP signals to GPIO pins and toggling the GPIO signals to test the EQEP interface. In general, I would recommend using a rotary encoder for testing instead, like we document in the Linux SDK documentation: https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/11_00_09_04/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/EQEP.html

    IEI seems like it keeps track of forward direction (reset counter on rising edge) and backwards direction (reset counter on falling edge). The EQEP can only know forward/backwards if you are sending signals to both EQEP_A and EQEP_B. I suspect that the behavior is undefined if you are only sending signals to EQEP_A.

    SEI seems to reset the position counter on the rising edge regardless of what A and B are doing, which is probably why you are able to reset the value on a rising edge.

    For future readers, here is the relevant part of the AM62x Technical Reference Manual (TRM):

    Regards,

    Nick