PowerBlock and GPIO2/3
I'd like to use my PowerBlock in my PiDP-11 system (https://obsolescence.wixsite.com/obsolescence/pidp-11) so that the key-lock powers on and off the Pi.
The PiDP software uses almost all of the GPIO pins. The only free pins are GPIOs 19, 2 and 3.
Now, GPIO2 and 3 are nominally used for I2C, In my brief testing last night, the PowerBlock behaved strangely (reboot loops, shutdown during boot, status LED never going to steady-on) when testing with those pins connected to S1 and S2.
According to the pinout, these pins include a fixed, 1.8 kΩ pull-up to 3.3v. Would this make them incompatible with the PowerBlock? These pins default to HIGH at power-on, which seems like it would indeed mess with the PowerBlock, if I understand how it works correctly (which I'm having to extrapolate from the service's code).
I'm going to try adding some gpio= statements to my boot.txt file to force these pins low at start-up, but if the PowerBlock relies on pins going to a floating state, then clearly this won't be enough to fix the problem. Plus, I wonder if these pins will bounce back to a pulled-up state once the system's shut down, which might also mess up the PowerBlock.
Incidentally, it'd be great to see a flow diagram of what the PowerBlock signals do and how the device responds to them. It'd really help diagnose these sorts of issues!
Thanks for any help,
Hmm. Maybe I'm making this too difficult?
I could attach an MCP23017 I2C GPIO expander to the Pi's two I2C pins. That'll give me 16 additional 'normal' GPIO pins to play with.
I could then attach the PowerBlock to those pins. I'd need to rewrite the PowerBlock Service in Python, using WiringPi to access those additional pins, but that'd be straightforward.
I'll test my config.txt changes tonight, and I'll have an MCP23017 arriving tomorrow to try too.
Got it working without the GPIO expander,
I used GPIO19 for the status pin, which really needs a 'regular' GPIO, not an I2C pin.
Then I used a
config.txtto set GPIO3 (which is an I2C pin) to low on bootup. GPIO3's then used as the shutdown pin for the PowerBlock.
This arrangement works fine.
@petrockblog -- perhaps the documentation could be updated to make clear that GPIOs with hardwired pullup resistors (such as the I2C pins) cannot be used as the status pin?