Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isr doesn't work on raspberry os 12.5 #604

Open
cedricboudinet opened this issue May 14, 2024 · 3 comments
Open

Isr doesn't work on raspberry os 12.5 #604

cedricboudinet opened this issue May 14, 2024 · 3 comments

Comments

@cedricboudinet
Copy link

Hello
I am trying to use interrupts on a raspberry 3b+ with this piece of code:

#include <stdio.h> 
#include <stdlib.h>

#include <thread>
#include <signal.h>
#include <sys/time.h>
#include <pigpio.h> 
#include <unistd.h>
const int PA= 4; //broche 7
const int port=13;
void onISR(int gpio, int level, uint32_t tick)
{
	static int st=0;
	gpioWrite(PA, st);
	st=1-st;
}
int main(int argc, char **argv) {
	if (gpioInitialise() == PI_INIT_FAILED) {
		printf("ERROR: Failed to initialize the GPIO interface.\n");
		return 1;
	}
	sleep(1);
	int st = gpioSetISRFunc(port, EITHER_EDGE, 1, onISR);
	printf("gpioSetISRFunc=%d\n", st);
	while (1) {
		time_sleep(100);
	}
	gpioTerminate();
}

When I run the code with raspberry os 11, the code runs fine and the isr occurs.
However when using raspberry os 12 (with a new installation), gpioSetISRFunc returns -123 (PI_BAD_ISR_INIT).

Can you help me to fix this?

@guymcswain
Copy link
Collaborator

I've been away for a while. Are you still seeking help?

@cedricboudinet
Copy link
Author

I gave up using ISR with pigpio, I use libgpiod instead.

But if you have a solution to make it working for bookworm, I will try again.

@tomplus
Copy link

tomplus commented Jul 7, 2024

It looks like ISR works via an interface "/sys/class/gpio/" which is already removed :/
Ref: https://www.thegoodpenguin.co.uk/blog/stop-using-sys-class-gpio-its-deprecated/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants