GPT input Capture in I.MX8M Mini

cancel
Showing results for 
Search instead for 
Did you mean: 

GPT input Capture in I.MX8M Mini

331 Views
Contributor II

Hi,

I am working on I.MX8M mini(A53) using linux kernel 4.14.78(debian).

I want to find out the motor speed with the GPT CAPTURE function by connecting a motor encoder to SAI3_RXFS.

I have added the patchwork from the below link:

[PATCH 1/2] clocksource/drivers/imx: add input capture support 

I also modified the device tree to use GPT1 CPTURE1.

fsl-imx8mm-ufl.dts

pinctrl_gpt_input_capture0: gptinputcapture0grp {
fsl,pins = <
MX8MM_IOMUXC_SAI3_RXFS_GPT1_CAPTURE1 0x1b0b0
>;
};

fsl-imx9mm.dtsi:

gpt1: gpt@302d0000 {
compatible = "fsl,imx8mm-gpt", "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
reg = <0x0 0x302d0000 0x0 0x10000>;
interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_GPT1_ROOT>,
<&clk IMX8MM_CLK_GPT1_ROOT>,
<&clk IMX8MM_CLK_GPT_3M>;
clock-names = "ipg", "per", "osc_per";
pinctrl-name = "default";
pinctrl-0 = <&pinctrl_gpt_input_capture0>;
status = "okay";
};

 

However, I still have no access to GPT Input Capture Register 1.

I think we should use the mxc_request_input_capture function.
But the problem is, i do not know where should i use the mxc_request_input_capture.

0 Kudos
4 Replies

77 Views
Contributor II

Hi @magicarrow98,

Did you get this working on IMX8MM? I would like to do the same. Are you happy to share your solution? At the moment I can see the device tree is:

pinctrl_gpio_keys: gpiokeysgrp {
fsl,pins = <
MX8MM_IOMUXC_SAI3_RXFS_GPT1_CAPTURE1 0x1b0b0 /* SODIMM 252 */
>;
};

&aips1 {
gpt1: gpt@302d0000 {
compatible = "fsl,imx8mm-gpt", "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
reg = <0x0 0x302d0000 0x0 0x10000>;
interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk IMX8MM_CLK_GPT1_ROOT>,
<&clk IMX8MM_CLK_GPT1_ROOT>,
<&clk IMX8MM_CLK_GPT_3M>;
clock-names = "ipg", "per", "osc_per";
pinctrl-name = "default";
pinctrl-0 = <&pinctrl_gpio_keys>;
status = "okay";
};
};

But I get no kernel messages related to gpt using dmesg | grep gpt

Thanks

Ed

0 Kudos

211 Views
NXP TechSupport
NXP TechSupport

Hi jun

one can try to follow example below and timer description in

sect.2.1.3 Timer attached Linux Manual.

epit.c\mach-imx\arm\arch - linux-imx - i.MX Linux kernel 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

211 Views
Contributor II

Hi, igor.

Thank you for your response.
But I didn't get any hints.
In the reference manual, only the location and brief description of the source code are provided.
This does not help me at all.
Even according to the reference manual, EPIT is said to be used in I.MX6 and I.MX7, but I use I.MX8M Mini.
Can I use Input Capture on I.MX8M Mini?
As mentioned above, I modified the device tree and timer_imx_gpt.c source code to get the encoder signal of the motor using the SAI3_RXFS pin.
I checked the probe in the terminal and there was a platform named mxc-timer.

pastedImage_1.png
However, the input capture function is still not available.
I now need a specific way of what to do.

0 Kudos

211 Views
NXP TechSupport
NXP TechSupport

also one can look at below pacthes:

How can I use the i.MX6 GPT to safely read a PWM? 

Best regards
igor

0 Kudos