Closed jsimmonds2 closed 5 years ago
Are you getting the initial message on the GPIO.set_interrupts call?
Then, if you disconnect the RTC and just manually short GPIO 12 to ground, are you still not getting the interrupt message?
Are you getting the initial message on the GPIO.set_interrupts call?
Only when GPIO 12 is tied to GND and not when tied to +3V3.
Then, if you disconnect the RTC and just manually short GPIO 12 to ground, are you still not getting the interrupt message?
That is so.
Sure looks like there's a :pulldown
on that GPIO.
I can take that lead from GND and dab it onto the +3V3 rail and I get :falling
edge interrupts, with pin value 0.
I don't own an RPi 4. I hope nothing has changed in the GPIOs. I'll take a closer look when I have more time this evening (US Central TZ).
Sorry, unable to verify if issue exists on my setup or not. Will try again tomorrow evening. I have ordered an RPi 4. I will test with that, also.
Wow ! Thanks for digging deeper . . I was actually thinking about offering to send you an RPi4 to test with.
First I verified that the internal pull-up and pull-down resistors are still working as expected with Circuits.GPIO on the RPi3. I tried the same on an RPi4, and indeed, it appears the internal pull-up resistors (I only tried on GPIOs 12 and 23 so far) are not being switched in via the pullmode pullup option. I don't know what is wrong and not sure what it will take to fix it yet. Hopefully, you can get by with an external pull-up resistor for now. Just in case the pullmode option is doing something undefined on the RPi4, I would also take out that option, when opening an input pin. Thanks for bringing this to our attention.
Oh wow, the GPIO interface changed on the BCM2711 (RPi4)!
Here's the best of what I was able to find quickly on the new way: https://github.com/RPi-Distro/raspi-gpio/blob/master/raspi-gpio.c#L476-L492. The peripheral spec that's currently on the Raspberry Pi site doesn't seem to talk about this or I haven't found it.
Would either of you like to take a crack at updating https://github.com/elixir-circuits/circuits_gpio/blob/master/src/hal_rpi.c#L85?
Thanks for finding that new code. I was not able to find anything about that myself. I'll take a look at updating the code.
FYI: I found this code too https://github.com/raspberrypi/linux/blob/e2a6ce9ff7c94cce5c1d40d2c79a2cd0498d5f88/drivers/pinctrl/bcm/pinctrl-bcm2835.c#L933-L954
Hi Mark. Could you edit your link to put the URL inside the parentheses rather than the brackets. :)
That reference you provided explains what I'm seeing, I think.
Done. Thanks!
I updated src/hal_rpi.c to include RPi4 pull modes code (branch: implement_rpi4_pullmodes). Tested pull-up and pull-down modes on one GPIO pin (12) on the RPi4 and it worked OK. Still need to do more testing including regression tests on other Pi models, before submitting PR.
Fixed in #63. Thanks @mdsebald.
Appreciate your fixes, @mdsebald 👍 I'm now "one happy end-user", getting the ( Active Low ) Alarm interrupts from the DS3231 RTC exactly as described 🙂 . . without any external pullup resistor.
Thanks to @fhunleth for pushing it over the finish line too, Glad we were able to resolve this issue.
Have a simple app which uses GPIO 12 as
input
connected to an open-drain output on a DS3231 RTC. Have tried setting:pull_mode
in theGPIO.open
options according to the documentation but cannot get a:falling
edge interrupt.As I don't have a scope, I'm going to try a 47k external pullup and see if that helps . . now off to order that resistor :)