i.MX8MM - GPT1 Input Capture clock

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8MM - GPT1 Input Capture clock

Jump to solution
2,014 Views
c_guerr
Contributor III

Hi NXP Community !

Subject:

I want to use the General Purpose Timer 1 in INPUT Capture mode on the i.MX8MM. 

I've used the following patches described here: https://lwn.net/ml/linux-kernel/20220210084335.1979778-1-jian.jiang@nxp.com/

In device tree i've added those following lines:

 

 

 

gpt1: gpt@302d0000 {
    compatible = "fsl,imx8mm-gpt";
    reg = <0x302d0000 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";
};

 

 

 


I've also disabled SAI3 and SAI5 to avoid any reconfiguration.

But i get the following error on boot logs:  

i.MX timer: unable to get clk

 

According the driver in /drivers/clocksource/timer-imx-gpt.c, it seems that is because it didn't manage to use any clock for the device (clk_per).

I've followed this link :https://community.nxp.com/t5/i-MX-Processors/GPT-capture-sample-on-M4-seems-to-hang-on-Linux-boot/m-...

It says that the linux part is disabling the clock. Why that?

I've followed this link also : https://community.nxp.com/t5/i-MX-Processors/GPT-on-i-MX-8M-Mini/m-p/1206969#M167291

I don't really understand the answer, tried it, I got the clocksource initialized:

[0.008172] clocksource: mxc_timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 637086815595 ns

But the kernel stops at the middle of the boot process.


Any advices?

I obviously added CONFIG_CLKSRC_IMX_GPT=y to enable the driver, as some logs shown above came from that driver. 
So device tree seems fines.
Config seems fines.

I suspect a clocking problem.


Thanks!

0 Kudos
Reply
1 Solution
1,910 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @c_guerr,

I hope you are doing well.
 
We don't have any information about the upcoming Linux BSP Release yet.
 
Alternatively, one can use the M4 core for input capture.
Please refer to the example at SDK_2_13_0_EVK-MIMX8MM/boards/evkmimx8mm/driver_examples/gpt/capture in MCUXpresso SDK.

 

Thanks & Regards,

Dhruvit Vasavada.

View solution in original post

6 Replies
1,982 Views
c_guerr
Contributor III

To be more precise, it's seems that the GPT Driver probed earlier than the clk-imx8mm driver.
I've already see a patch to change the clock driver to get probed earlier by using CLK_OF_DECLARE instead of module_platform_driver. 

But this doesn't works well even if the clocksource get initialized. The problem is that lot of other clock in the imx8mm use clock which aren't initialized. So the kernel stop at the begginnin.

So I guess the only solution is to Defer the probing of this driver. 
I tried to return EPROBE_DEFER without any success. 

0 Kudos
Reply
1,954 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @c_guerr,

I hope you are doing well.
 
Support for input capture in GPT is not available in the latest Linux BSP from NXP.
 
One can declare timer-imx-gpt.c as a module to load after the clk-imx8mm.c driver at boot time in /etc/modules-load.d/.
CONFIG_CLKSRC_IMX_GPT=m 
 
Thanks & Regards,
Dhruvit Vasavada.
1,952 Views
c_guerr
Contributor III

 

I'm good thanks, hope you too!

Thanks for your fast reply!

Any other solution to count the rising edge of a signal using IMX8mm ?

Is the input capture function something we can suspect arriving in the next Linux bsp version?

 

Thanks again 

0 Kudos
Reply
1,911 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @c_guerr,

I hope you are doing well.
 
We don't have any information about the upcoming Linux BSP Release yet.
 
Alternatively, one can use the M4 core for input capture.
Please refer to the example at SDK_2_13_0_EVK-MIMX8MM/boards/evkmimx8mm/driver_examples/gpt/capture in MCUXpresso SDK.

 

Thanks & Regards,

Dhruvit Vasavada.

1,907 Views
c_guerr
Contributor III

Is there anything to figure out when doing Input capture by the M4 Core ?

Is there things to enable/disable from Linux part on cortex A53?

And by the way, does it affect the pinout of the board ? I mean, i've done a bit of hardware arround the pin for GPT1 Input Capture.  I assume they share the same pin right?

Thanks again for your fast reply!

0 Kudos
Reply
1,872 Views
c_guerr
Contributor III

I managed to make the GPT working on the CORTEX M4 instead of using the CORTEX-A53 through Linux.

Thanks for the support.

I would do new topics if I encounter other problems (rpmsg, gpt hang on linux boot etc).


0 Kudos
Reply