I am working on the RPI-CM4 board with raspbian buster OS. I am building an application to get interrupt events from the GPIO pin, fluctuating its state @20usec.

I have tried the following things...

  1. Made a sample interrupt read example test with WiringPi library which is based on file IO using poll().
  2. Increased the CPU & CORE clock frequencies to 1100MHz & 550MHz respectively by referring the following tutorial. overclock Raspberry Pi 4

still, I cannot get the resolution of the RPI-GPIO pin @20usec.

I want to access the RPI-GPIO pin directly from the hardware. Will you please help me to know how can I do it?

1 Answer 1


You will not be able to do this using Linux interrupts on the Pi. Linux can not handle sustained interrupts (to user space) at these sorts of rates.

You might be able to achieve what you want using pigpio sampling.

Run piscope. If it catches the signals of interest then pigpio may be what you need.

  • I have made a test case with piscope & able to read the data. Also, I have installed the pigpio library & made a test case with HALL_EFFECT_SENSOR example. this will work for me for fewer milliseconds of interval. I have updated the code by setting the hardware clock using the gpioHardwareClock(HALL, 100000000); function. but I am not able to read the gpio tick in microseconds resolution. will you please help me to know, How can I set the hardware clock to get resolutions in microseconds?
    – shiv patil
    Mar 16, 2022 at 6:24
  • Solved this using the gpioCfgClock(1, 1, 1) to get the 1usec resolution before initializing the GPIOs.
    – shiv patil
    Mar 17, 2022 at 4:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.