WiringPi interrupt firing frequently on raspberry pi 5

May 30, 2024, 16:50

adde9882

I have a RX receiver with the DATA pin connected to the pin GPIO 27 on my Raspberry pi 5. I am enabling a callback for my RF device like this:
pinMode(27, INPUT);
if(wiringPiISR(27, INT_EDGE_BOTH, &rx_callback) < 0){
    printf(ESC_RED_BOLD "RX PROBLEM\n" ESC_WHITE);
    return false;
}

printf("RX Enabled\n");
return true;
I have a simple callback function for my RX device:
void rx_callback(void) {
    struct timespec ts;
    clock_gettime(CLOCK_MONOTONIC, &ts);
    int64_t timestamp = ts.tv_sec * 1000000LL + ts.tv_nsec / 1000LL;
    int64_t duration = timestamp - last_timestamp;
    printf("Duration: %ld\n", duration);
    last_timestamp = timestamp;
}
This callback gets called ~10 000 times each second when I am not even using any RF device. If I only use the falling edge, it rarely gets called except when I actually send RF signals with my RF controller. Yet when I set my callback to fire on INT_EDGE_RISING or INT_EDGE_BOTH, it gets called as frequently as possible. Why is this?