Hi!
IMX6ULL in LINUX how to set GPT2 to input capture mode to capture the external PWM signal frequency? I have tried to write a driver for Capture myself, but I cannot trigger a capture interrupt. Please tell me how to configure it correctly.
Please answer any questions. Thank you!
Hi @rainho
Thanks for your answer, my friend!
I used Method two, which is already in the attachment file of my post, using JTAG_TMS pin multiplexing CAPTURE1, but could not capture external signals, in other words, capture interrupts did not occur, however, what is the problem, because GPT1 is a Linux system timer, So I'm not going to add capture code for Method one.
Please answer my questions, have a good day!
Hi @rainho,
Thank you for your answer!
I have solved it. I just put the pin of the device tree in the hog pinctrl, but I don't know why I have to put it in this pinctrl-hog. Can you answer my question?
Thank you! Wishing you a happy life
There is another big question, can you answer my question, it can be captured under the hog node, but the result of custom multiplexing node is not acceptable! It's like I just replied to someone else's file which described what I failed, but I don't understand how the reuse position affects
Thanks
Hi @rainho
Hello, I defined the gpt pinctrl node separately, but I have shielded the sai2 node. Furthermore, I checked my device tree and only the multiplexing node I defined uses capture2, which should not cause any impact.
Hi @rainho
pinctrl_gpt2cap: capgrp{
fsl,pin=<
MX6UL_PAD_JTAG_TMS__GPT2_
>;
};
Hi @rainho
I hope you are doing well.
There seems to be another typing mistake in gpt2 node in the device tree file dev-tree.dts shared by you
Hi,Sanket Parekh!
ok, I overlooked this before, but I still can't capture the interrupt after I changed it, the attachment is my device tree file.
The following is the capture driver startup log I personally wrote:
gpt 20e8000.gpt: res start is 0x20e8000
gpt 20e8000.gpt: gpt->base is a0a68000
gpt 20e8000.gpt: gpt ipgclk is 24000000HZ
gpt 20e8000.gpt: gpt perclk is 3000000HZ
And the register value after starting the work:
gpt 20e8000.gpt: MXC_TCTL is 0x1006b
gpt 20e8000.gpt: V2_IR is 0x28
After checking the manual, there is no wrong configuration register, I hope you can answer my doubts, thank you!
Since the pinctrl_hog_1 node is referenced under the iomuxc node, the iomuxc driver in the Linux kernel automatically initializes all pins under the pinctrl_hog_1 node . So in the previous program, you might not have initialized the capture pin. I'm also using IMX6ULL GPT2 to capture the PWM ,Could you please show me your gpt_capture.h and the device tree file.I can't find any information about the V2_IR_IM1EN register,did you name it yourself?
Hello, FrankLiu
The following is the file you want, V2_TCTL_IM1_RISING is what you said to enable input capture, and I have blocked the multiplexing of the hog node in the device tree. The multiplexed IO can not be captured if it is placed in the pinctrl_gpt2cap node defined by itself, and it is replaced by hog It can be captured in the node!
So if it is placed in the node defined by itself, do I need to initialize IO in the gpt_capture.c driver? Do you still need to add IO initialization yourself? If so, how to initialize it?
Thank you for your answer, I hope it can be answered!
Hi rainho
GPT2 CAPTURE1 needs to be initialized by gpio subsystem.
,You may need to create a child node under the root node and then use linux API to initialize the IO.I'm debugging this feature and it's not quite done yet.I see your code has comments in Chinese, if you are a Chinese developer, you can add mywechat,1239543898,We can work on this problem together.