GPIO Interrupt latency

I am trying to use GPIO as input trigger to my system.
I am using shell command before I am running my code:

echo in          >/sys/class/gpio/gpio443/direction
echo falling  >/sys/class/gpio/gpio443/edge

and also a C code:

void gpio_test()
    if ((fd = open("/sys/class/gpio/gpio443/value", O_RDWR)) < 0)
        fprintf(stderr, "Failed, gpio %d not exported.\n", gpioPin);
        return -1;

    pfd.fd = fd; = POLLPRI;

    lseek(fd, 0, SEEK_SET); /* consume any prior interrupt */
    read(fd, buf, sizeof(buf));
    rc = poll(&pfd, 1, timeoutMS); /* wait for interrupt */

    if (rc < 0)

    lseek(fd, 0, SEEK_SET); /* consume interrupt */
    read(fd, buf, sizeof(buf));

I see that the interrupt arrived with ~15 ms latency after the GPIO fall down.
The program runs in user space.

There is any way to decrease the latency?

hello almog1,

could you please check Topic 192147 for the steps to improve GPIO interrupt performance.

Hey Jerry,
I have tried to use attached commands:

sudo su
cat /sys/kernel/debug/bpmp/debug/clk/axi_cbb/max_rate # 408000000

cat /sys/kernel/debug/bpmp/debug/clk/axi_cbb/max_rate > /sys/kernel/debug/bpmp/debug/clk/axi_cbb/rate
echo 1 > /sys/kernel/debug/bpmp/debug/clk/axi_cbb/mrq_rate_locked 

cat /sys/kernel/debug/bpmp/debug/clk/axi_cbb/rate # 408000000
cat /sys/kernel/debug/bpmp/debug/clk/axi_cbb/max_rate # 408000000
cat /sys/kernel/debug/bpmp/debug/clk/axi_cbb/mrq_rate_locked # 1

I am still get the interrupt with ~15ms latency.

root@nvidia:/home/nvidia# cat /proc/interrupts | grep gpiolib
 353:       8767          0          0          0          0          0          0          0  tegra-gpio  155 Edge      gpiolib

may I know how you evaluate 15ms latency,
are you probing the signal or adding kernel logs to check the timestamp?

Hey Jerry,
You right, Actually I have checked it via log file.
In case of checking it with oscilloscope it actually works fine.
Thank you

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.

hello almog1,

would you please use $ nice to set higher process priority to confirm the behavior?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.