Powerblock conflict with GPIO control (Resolved)
-
Pi4B 4GB
Retropie 4.7.1
Dragon Rise USB button/joystick interface
3A psu from Canakit
3 yr old micro-use Powerblock with 1Kohm resistor mod
Generic USB-C to micro-USB adaptorI am currently rebuilding an arcade cabinet I built 3 years ago that had a Pi3B powering it. At the time, I had the power on and off for the Pi under Powerblock control, and used a ground and a 3.3V GPIO pin to drive an optoisolator-switched power strip from digitalloggers.com that turned on a power strip with the monitor, amplifier etc on when the Pi powered up.
Cut forward to today, and the Pi3B was plundered for another project and replaced by a Pi4B. I modded the power block as required and wired everything up as before using the more powerful psu that came with the Pi4B. At that point I found that unlike on the Pi3B driving the 3.3v pin to ground via the optoisolator just shorted the Pi4, so I looked for a different solution. First I verified that the Powerblock worked as normal, which it did, and then I added
dtoverlay=gpio-poweroff,gpiopin=26,active_low
to /boot/config.txt, and wired GPIO pin 26 and a ground pin to the isolator and it worked perfectly. The problem is when I do that while having the Powerblock software enabled. When I do, on shutdown the system reports a “kernel crisis” and hangs. As soon as I comment out the GPIO instruction, it shuts down correctly.
Is there anything I can do to get the two working together?
Edit: I guess I could just use the same pins as previously and add a resistor into the circuit, but I would prefer a software solution.
-
@douga The issue was not with the Powerblock. I did some googling and found that the way I was switching on and off the gpio pins can be problematic anyway.
I found a more elegant way to switch the pin high at boot, and now it works perfectly. I just added the line below to the end of /boot/control.txt
gpio=26=op,dh
which sets gpio26 to output (op), and drives it high (dh), ie switches it on.
-
@douga Glad to hear that things are working for you now!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.