imx8mp IO control

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

imx8mp IO control

Jump to solution
808 Views
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 Kudos
Reply
1 Solution
772 Views
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!!

View solution in original post

0 Kudos
Reply
4 Replies
785 Views
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 Kudos
Reply
781 Views
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 Kudos
Reply
776 Views
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 Kudos
Reply
773 Views
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 Kudos
Reply