imx8mp IO control

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,684件の閲覧回数
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,648件の閲覧回数
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,661件の閲覧回数
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,657件の閲覧回数
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,652件の閲覧回数
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,649件の閲覧回数
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 件の賞賛
返信