pimoroni / ioe-python

Python library for the Nuvoton MS51 Pimoroni IO Expander Breakout
https://shop.pimoroni.com/products/io-expander
MIT License
8 stars 13 forks source link

Pimoroni RGB I2C rotary encoder not seeing interrupts on an RPi 4B #29

Closed bobrathbone closed 4 months ago

bobrathbone commented 5 months ago

Using product [https://shop.pimoroni.com/products/rgb-encoder-breakout?variant=32236590399571] I have successfully been running these encoders for a couple of years using my own software based up the Pimoroni ioe-python library without problem. However I recently re-installed my software on a Raspberry Pi 4b I then tested using the example code the colour LEDs light up but when I turn the Rotary encoder I don't see any interrupts. This is the same behavior using both Bookworm and Bullseye OS OS. See code from rotary.py below

while True:
    if ioe.get_interrupt():
        count = ioe.read_rotary_encoder(1)
        ioe.clear_interrupt()

The I2C address is 0x0F. I then remembered I had previously running these encoders on a Rasberry Pi model 3B so I tried the same SD card and software on an RPi model 3B and lo and behold the encoders worked. I re-checked on a model 4B and again it would not see the encoder interrupts. Is this a known problem with 4Bs and these encoders?

@bobrathbone

bobrathbone commented 4 months ago

Using interrupt_pin=None does help as the program now sees rotations however it puts the program into polling mode which wasn't what was desired. I wired up both encoders with the interrupt pins wired to two separate GPIOs and which now works fine. So this problem is SOLVED.