TI中文支持网
TI专业的中文技术问题搜集分享网站

AM5728: 在BeagleBoard-X15板子上读取编码器的position值一直是0

Part Number:AM5728

加载eqep2的设备成功,但接入一个编码器读它的position值一直是0,

读取启动信息如下:

root@arm:~# dmesg | grep eqep
[ 2.330920] eqep 48442180.eqep: ver. 1.0
[ 2.335285] eqep 48442180.eqep: count_mode:0
[ 2.339584] eqep 48442180.eqep: invert_qa:0
[ 2.343799] eqep 48442180.eqep: invert_qb:0
[ 2.348011] eqep 48442180.eqep: invert_qi:0
[ 2.352222] eqep 48442180.eqep: invert_qs:0
[ 2.356433] eqep 48442180.eqep: swap_inputs:0
[ 2.360815] eqep 48442180.eqep: QDECCTL:0x0000
[ 2.365290] eqep 48442180.eqep: QPOSINIT:0x00000000
[ 2.370211] eqep 48442180.eqep: QPOSMAX:0xffffffff
[ 2.375030] eqep 48442180.eqep: QPOSCNT:0x00000000
[ 2.379852] eqep 48442180.eqep: omit_interrupt:0
[ 2.384496] eqep 48442180.eqep: QEINT:0x0800
[ 2.388793] eqep 48442180.eqep: QUPRD:0x07ed6b40
[ 2.393438] eqep 48442180.eqep: QEPCTL:0x009e write
[ 2.398344] eqep 48442180.eqep: QEPCTL:0x009e read
[ 2.403195] eqep 48442180.eqep: irq:171, clk_rate:133000000

用的是这个SDK:Linux arm 4.14.108-ti-rt-r140

转动编码器的轴,eQEP2A_in(对应GPIO3_10)和eQEP2B_in(对应GPIO3_11)在示波器上已经有正交信号

读取position路径:/sys/devices/platform/44000000.ocp/48442000.epwmss/48442180.eqep

root@arm:/sys/devices/platform/44000000.ocp/48442000.epwmss/48442180.eqep# ls
driver enabled mode period power uevent
driver_override modalias of_node position subsystem

root@arm:/sys/devices/platform/44000000.ocp/48442000.epwmss/48442180.eqep# cat position0

不论怎么转动编码器的轴,输出值都是0

am57xx-beagle-x15-revc.dts 配置eqep2如下

pinctrl_eqep2: pinctrl_eqep2 {
pinctrl-single,pins = <
DRA7XX_CORE_IOPAD(0x350c, PIN_INPUT_PULLUP | MUX_MODE10) /* eQEP2A_in */
DRA7XX_CORE_IOPAD(0x3510, PIN_INPUT_PULLUP | MUX_MODE10) /* eQEP2B_in */
DRA7XX_CORE_IOPAD(0x3514, PIN_OUTPUT_PULLUP | MUX_MODE10) /* eQEP2_index */
DRA7XX_CORE_IOPAD(0x3518, PIN_OUTPUT_PULLUP | MUX_MODE10) /* eQEP2_strobe */
>;
};

&eqep2 {
status = "okay";
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 = <0>; /* Should we invert the channel A input? */
invert_qb = <0>; /* Should we invert the channel B input? inveIrt 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? */
omit_interrupt = <0>;
};

dra7.dtsi 配置eqep2如下

epwmss2: epwmss@48442000 {
compatible = "ti,dra746-pwmss", "ti,am33xx-pwmss";
reg = <0x48442000 0x30>;
ti,hwmods = "epwmss2";
#address-cells = <1>;
#size-cells = <1>;
status = "okay";
ranges = <0x48442100 0x48442100 0x80 /* ECAP2 */
0x48442180 0x48442180 0x80 /* EQEP2 */
0x48442200 0x48442200 0x80>; /* EHRPWM2 */

ehrpwm2: pwm@48442200 {
compatible = "ti,dra746-ehrpwm",
"ti,am3352-ehrpwm";
#pwm-cells = <3>;
reg = <0x48442200 0x80>;
clocks = <&ehrpwm2_tbclk>, <&l4_root_clk_div>;
clock-names = "tbclk", "fck";
status = "okay";
};

eqep2: eqep@0x48442180 {
compatible = "ti,am33xx-eqep";
reg = <0x48442180 0x80>;
clocks = <&l4_root_clk_div>;
clock-names = "fck";
interrupt-parent = <&crossbar_mpu>;
interrupts = <GIC_SPI 212 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
};

ecap2: ecap@48442100 {
compatible = "ti,dra746-ecap",
"ti,am3352-ecap";
#pwm-cells = <3>;
reg = <0x48442100 0x80>;
clocks = <&l4_root_clk_div>;
clock-names = "fck";
status = "okay";
};
};

调用的驱动为ti-linux-kernel-dev\KERNEL\drivers\misc\tieqep.c

请帮忙看看,感谢。

Nancy Wang:

建议您到英文论坛发帖咨询,会有产品线工程师给您提供支持,谢谢!

https://e2e.ti.com/support/processors-group/processors/f/processors-forum

,

Shi Ganbo:

好的,谢谢提醒

赞(0)
未经允许不得转载:TI中文支持网 » AM5728: 在BeagleBoard-X15板子上读取编码器的position值一直是0
分享到: 更多 (0)