imx8mp IO control

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx8mp IO control

跳至解决方案
1,621 次查看
lxy
Contributor II

I tried to use the A core of imx8mp to control GPIO1-IO8, so that this port could be set and cleared quickly, with the minimum interval of 300ns between set and clear, but my actual test seemed to be unable to respond so quickly. I would like to ask what is the response speed of io set, or what is the minimum time interval for controlling io 1-0.

char bit = byte & (1 << (7 - j));
if (bit) {
gpio_set_value(LED_GPIO_PIN, 1);
ndelay(HIGH_DELAY_NS);
gpio_set_value(LED_GPIO_PIN, 0);
ndelay(LOW_DELAY_NS);
} else {
gpio_set_value(LED_GPIO_PIN, 1);
ndelay(LOW_DELAY_NS);
gpio_set_value(LED_GPIO_PIN, 0);
ndelay(HIGH_DELAY_NS);
}

 

0 项奖励
回复
1 解答
1,585 次查看
lxy
Contributor II

dts:

&gpio1 {
gpio-line-names = "gpio1_io08";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio1>;
label = "led-gpio08";
};

pinctrl_gpio1: gpio1 {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO08__GPIO1_IO08 0x00000116
>;
};

ko:

char bit = byte & (1 << (7 - j));
if (bit) {
gpio_set_value(LED_GPIO_PIN, 1);
ndelay(HIGH_DELAY_NS);
gpio_set_value(LED_GPIO_PIN, 0);
//ndelay(LOW_DELAY_NS);
} else {
gpio_set_value(LED_GPIO_PIN, 1);
//ndelay(LOW_DELAY_NS);
gpio_set_value(LED_GPIO_PIN, 0);
ndelay(HIGH_DELAY_NS);
}

微信图片_20240314154631.jpg

dts as above configuration, and then write a driver, the driver layer to control the io action, can achieve about 380ns response, thank you for your support!!

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,598 次查看
Chavira
NXP TechSupport
NXP TechSupport

Hi @lxy!
Thank you for contacting NXP Support!

I will send you an email with a gpio example in c.

You have to remove the delay function and change the gpiochip and line that you want to use.

Best Regards!
Chavira

0 项奖励
回复
1,594 次查看
lxy
Contributor II

Thanks for your support, I tried the code in the example and annotate sleep. I wanted to test the fastest flipping speed of IO. I actually measured it with an oscilloscope (as shown below), and found that the fastest time of continuous action was 960ns, while the time of action response was 150-450ns. Is there any other way to achieve faster response speed?

MX8MP_IOMUXC_GPIO1_IO08__GPIO1_IO08 0x00000116

 

微信图片_20240313201142.jpg

0 项奖励
回复
1,589 次查看
Chavira
NXP TechSupport
NXP TechSupport

Hi @lxy !

As your configuration is the faster way to do it in A core.

Maybe you can get better results on M core but you have to try it.

Sorry for the mistake!

Best Regards!
Chavira

0 项奖励
回复
1,586 次查看
lxy
Contributor II

dts:

&gpio1 {
gpio-line-names = "gpio1_io08";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio1>;
label = "led-gpio08";
};

pinctrl_gpio1: gpio1 {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO08__GPIO1_IO08 0x00000116
>;
};

ko:

char bit = byte & (1 << (7 - j));
if (bit) {
gpio_set_value(LED_GPIO_PIN, 1);
ndelay(HIGH_DELAY_NS);
gpio_set_value(LED_GPIO_PIN, 0);
//ndelay(LOW_DELAY_NS);
} else {
gpio_set_value(LED_GPIO_PIN, 1);
//ndelay(LOW_DELAY_NS);
gpio_set_value(LED_GPIO_PIN, 0);
ndelay(HIGH_DELAY_NS);
}

微信图片_20240314154631.jpg

dts as above configuration, and then write a driver, the driver layer to control the io action, can achieve about 380ns response, thank you for your support!!

0 项奖励
回复