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

Not working with lastest Raspberry pi OS 64bits (Bookworm) #154

Open
lavoiekeven opened this issue May 4, 2024 · 7 comments
Open

Not working with lastest Raspberry pi OS 64bits (Bookworm) #154

lavoiekeven opened this issue May 4, 2024 · 7 comments

Comments

@lavoiekeven
Copy link

I had a projet with this library and It was working well last year. Now I'm setuping a new raspberry pi with Raspberry OS Lite 64 bits and I got this error:

Error: pigpio error -123 in gpioSetISRFunc
at Gpio.enableInterrupt (/home/cdl/gateopener2/server/node_modules/pigpio/pigpio.js:264:12)
at new Gpio (/home/cdl/gateopener2/server/node_modules/pigpio/pigpio.js:173:12)

It happen here:

this._gpio = new Gpio(gpioPin, { mode: Gpio.INPUT, pullUpDown: Gpio.PUD_DOWN, edge: Gpio.EITHER_EDGE });

I tried many pin all the same result.

I also start my app sudo.

Any ideas of what can be my problem?

@lavoiekeven
Copy link
Author

Ok by removing "edge: Gpio.EITHER_EDGE" it is working.

@optikalefx
Copy link

@lavoiekeven could you share any sample code you're using? I'm trying to get a simple button working and I had the same error as you. The error goes away when making the change you suggested, but the button doesn't seem to do anything.

I'm doing this

const Gpio = require('pigpio').Gpio;

const button = new Gpio(4, {
  mode: Gpio.INPUT,
  pullUpDown: Gpio.PUD_DOWN,
});

button.on('interrupt', (level) => {
  console.log('level', level);
});

Button is plugged into GPIO4 and GND

The log never happens

@lavoiekeven
Copy link
Author

lavoiekeven commented May 7, 2024

Hi,
interrupt is not working ether.

So I used alert instead

exemple in TS

`
import { Device } from "./Device";
const Gpio = require('pigpio').Gpio;

type AlertCallback = (level: 0 | 1) => void;

export class ContactSensor extends Device {
    private _gpioPin: any;
    private _gpio: any;
    private _alertCallback: AlertCallback;
    /**
     * 
     * @param {*} name 
     * @param {*} gpiopin 
     */
    constructor(name: string, gpioPin: number, callback: AlertCallback | null) {
        super(name, "sensor", false)
        this._gpioPin = gpioPin;
        this._gpio = new Gpio(gpioPin, { mode: Gpio.INPUT, pullUpDown: Gpio.PUD_DOWN });
        this._alertCallback = callback

        this._gpio.on('alert', (level) => {
            console.log(this.name + ' triggered');

            if (this._alertCallback)
                this._alertCallback(level);

            console.log(this.name + ' level changed ' + level);
        });

        this._gpio.enableAlert();
    }

    get gpioPin(): number {
        return this._gpioPin;
    }

    getLevel(): 0 | 1 {
        return this._gpio.digitalRead();
    }
}

`

@grevelle
Copy link

Is this project being maintained at this point?

@lavoiekeven
Copy link
Author

I guess not, but once i used alert rather than interrupt, the library work well in my case on. Personaly, I didn't find other library that worked that well for what I wanted to do.

@grevelle
Copy link

grevelle commented Jun 22, 2024

I am a huge fan of this library - it's the most powerful for hardware pwm IMHO. I use it extensively. The march bookworm update put me in a boot loop and I need to figure out the problem. I use alerts in my code already so glad to hear that's not the problem.

UPDATE:
The boot loop problem I refer to above is due to a change in how the RPI deals with config.txt. This line worked in the December 2023 pi OS release, but would not boot in the March 2024 release. After some research I learned that this code, which puts the i2c and SPI pins into alt0 mode, is not necessary as it is handled separately by the OS config for those functions.

# Select Alt0 for GPIO pins
gpio=0-3,8-11=a0

@grevelle
Copy link

grevelle commented Sep 5, 2024

I am having the same issue w/ interrupt vs. alert. I can get alerts to work but not interrupts.

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