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);
}
Solved! Go to Solution.
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);
}
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!!
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
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
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
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);
}
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!!