Closed kdbdallas closed 6 years ago
Do you have a switch attached to the Powerblock?
Yes. A switch and an LED
Can you send me the link to the Raspbian image that you are using? I can take a look into that from my site then.
Thanks, I will take a look into that!
I'm getting the same behavior as well! (Don't know if that's good or bad...)
Her's exactly what's happening to me. The Raspberry Pi boots normally and reaches the login prompt. It then waits at the auto-login shell for ~3 seconds before power is cut (this is not a clean shutdown, but an unclean power cut from the Power Block). If the switch is in the "off" position before the power cut, the power is not cut and the powerblock
service triggers a normal shutdown.
Here is what I've figured out so far:
powerblock
is run as a service on boot and the power switch is "on".powerblock
service functions normally.main
still causes the power cut in the usual time (which is below 10 seconds).I'm not sure exactly what is wrong with it, but it seems to act differently when run as a service on boot. Any help would be appreciated!
I recreated the problem using just a sh
startup script. When the script below is run on boot (by the Systemd service file below), the same behavior of a hard power cut. The hard power cut also happens when the script below is run twice at any time. In essence, I've narrowed the problem down to the GPIO ping being set on boot.
startup.sh
#!/bin/sh
cd /sys/class/gpio
echo "Begin startup gipo"
echo 17 > export
echo out > gpio17/direction
echo 18 > export
echo 1 > gpio17/value
echo "Startup gpio worked?"
Systemd Unit file
[Unit]
Description=Simple way to boot-loop your pi!
[Service]
ExecStart=/home/pi/startup.sh # Or some other path...
[Install]
WantedBy=multi-user.target
All right, I tried to reproduce the issue. Here is the hardware setup:
I have tested it on the RPi 3 in this case.
After logging in as user pi
I followed these steps on the command-line:
sudo apt-get update; sudo apt-get upgrade -y
sudo apt-get install cmake git
git clone git://github.com/petrockblog/PowerBlock
cd PowerBlock; make; sudo make install; sudo make installservice
As soon as the driver is installed, the flashing of the LED switches to be constantly on. The switch can be used to turn off the Pi and on and off again, just as intended.
On what RPi version are you observing the issue?
I am using a RPi Model B Rev2 with Raspbian Jessie
The implemented logic on the PowerBlock expects the switching behavior of a toggle (i.e., non-momentary) switch: As soon as the state machine is in the "ON" state and observes a low signal level on the switch pin, it initiates the shutdown.
I have been observing the behavior when using a continuous toggle switch as well as when testing with a wire directly connecting the two pins.
I have been using a Pi 2 and a toggle switch (https://www.radioshack.com/products/spst-toggle-sw?variant=5717513797) (not this exact one but very similar)
@kdbdallas The PowerBlock is working with the RPi 2. To opt-out the toggle switch as cause for that, you can use a jumper to short the "switch pins". As long as the pins are shorted, the "ON" state of the toggle switch is observed by the PowerBlock. Alternatively, you can use a wire and short the "switch pins". You need to make sure that the pins stay shorted, though. Otherwise the PowerBlock driver will initiate a shutdown.
I just verified that with a jumper on the 'switch' pins it booted right up... hmmm.... So what about a toggle switch would cause this to happen? I am using this: https://www.radioshack.com/products/dpdt-toggle-switch?variant=5717519557 Would this one work? https://www.radioshack.com/products/spst-toggle-sw?variant=5717513797 (Basically I need one that fits that mounting hole size for my project, and its not easy to find)
Ok, given the observation with the jumper we can conclude that at least the PowerBlock is working. This means that somehow the signaling behavior of the switch is not as intended. Looking at bot switches I would have guessed that both switches would work. Maybe it is a wiring issue with your current switch? If switched to "on" the switch should short the two switch-pins of the PowerBlock (just as the jumper does).
I'm having the same problem with my PowerBlock I just got. Ran the auto-install (you need to update the readme on the homepage to include an extra "/" after "master"):
wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master/install.sh | sudo bash
Waited while it did it's install thing. I then shutdown the Pi, and pulled the plug. Attached the PowerBlock, and connected the power to the PowerBlock. I then used a jumper and connected it to the pins labeled SWITCH. The system comes on, starts loading, then shuts down and reboots.
When I did the initial install, I did see a bit of this in the log:
Scanning dependencies of target jsoncpp_lib_static
[ 15%] Building CXX object src/lib/jsoncpp/src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_reader.cpp.o
[ 21%] Building CXX object src/lib/jsoncpp/src/lib_json/CMakeFiles/jsoncpp_lib_static.dir/json_value.cpp.o
/home/pi/PowerBlock/src/lib/jsoncpp/src/lib_json/json_value.cpp: In constructor ‘Json::Value::Value(Json::ValueType)’:
/home/pi/PowerBlock/src/lib/jsoncpp/src/lib_json/json_value.cpp:346:27: warning: declaration of ‘empty’ shadows a member of 'this' [-Wshadow]
static char const empty[] = "";
^
and
[100%] Generating HTML documentation
Warning: ignoring unsupported tag `GROUP_NESTED_COMPOUNDS =' at line 351, file /home/pi/PowerBlock/build/Doxyfile
Warning: ignoring unsupported tag `HIDE_COMPOUND_REFERENCE=' at line 522, file /home/pi/PowerBlock/build/Doxyfile
Warning: ignoring unsupported tag `WARN_AS_ERROR =' at line 746, file /home/pi/PowerBlock/build/Doxyfile
Warning: ignoring unsupported tag `LATEX_EXTRA_STYLESHEET =' at line 1681, file /home/pi/PowerBlock/build/Doxyfile
Warning: ignoring unsupported tag `LATEX_TIMESTAMP =' at line 1748, file /home/pi/PowerBlock/build/Doxyfile
Warning: ignoring unsupported tag `RTF_SOURCE_CODE =' at line 1814, file /home/pi/PowerBlock/build/Doxyfile
Warning: ignoring unsupported tag `PLANTUML_INCLUDE_PATH =' at line 2346, file /home/pi/PowerBlock/build/Doxyfile
Warning: tag INPUT: input source `/home/pi/PowerBlock/src/controlblock' does not exist
and
warning: source /home/pi/PowerBlock/src/controlblock is not a readable file or directory... skipping.
However, despite these errors/warnings, it does say this at the end:
/home/pi/PowerBlock
[SUCCESS] The PowerBlock driver binary is installed
[SUCCESS] The PowerBlock service is running
You can find the configuration file at /etc/powerblockconfig.cfg.
So it looks like it installed ok. But I wonder if the build is incomplete? Either that, or my PowerBlock is malfunctioning...
Thanks for the hint about the missing /. For now I think it is better to discuss this further in the support forum at https://retropie.org.uk/forum/topic/12259/powerblock-endlessly-reboots/2. We won't have two discussion threads about the same issue then ...
I close this issue with the findings from the forum thread at https://retropie.org.uk/forum/topic/12259/powerblock-endlessly-reboots/27.
This is reproducible every time in my testing. Take a clean install of the latest Raspbian Jessie Lite, (in this case on a 64GB card) run: sudo apt-get update sudo apt-get upgrade sudo apt-get install -y cmake g++-4.9 git clone git://github.com/petrockblog/PowerBlock.git cd PowerBlock make sudo make install sudo make installservice
From here the Pi will either reboot automatically or you do a sudo reboot. Either way what you end up with is a Pi in an endless reboot loop