0

I am using pigpio's gpiosetAlertFunc() to listen for a falling edge on a pin but it keeps missing like 80% of the pulses. the pulses are 400ns long that repeats every ~7ms. Im guesing that the pulses are so short for it to detect.

I Increased the sampling rate of the library to the highest possible, it was able to capture more but still not all all of them only 372/600 (~5 seconds)

void aFunction(int gpio, int level, uint32_t tick)
{
    if(!level)
    interruptCount++;
}


int main()
{
    gpioCfgClock(1,1,0);
    gpioInitialise();
    gpioSetAlertFunc(13,aFunction);
    delay_ms(5000);
    gpioTerminate();
}

something is wrong as the pi should have no problem with these sampling rates

2
  • did you connect the grounds? – jsotola Mar 24 at 4:05
  • @jsotola yes of course , vcc,ground and signal pins are all connected – DrakeJest Mar 24 at 9:10
2

See gpioSetAlertFunc. Do the maths to work out how often a 400 nanosecond pulse will be picked up.

For short pulses use gpioSetISRFunc. That will pick up pulses a few nanonseconds long.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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