OnOff Shim wont stay on

hi,

i’ve just purchased the OnOff shim and i’ve wired up the shim (via breakout to breadboard) to 5v and ground as well as connecting up the status and power off pins.

when i press the button, the Pi will power up, but the moment i release the button the power will immediately shut off (no graceful shutdown), does not matter how long the button was originally pressed for.

i’ve tried just connecting the power and no logic signals but still the same result.

is there something i am missing?

regards,
Sean

Have to ask the obvious question, power going in the micro USB on the shim?

I do believe the software is only for shut down. So it should latch the power on when you press the power button the first time. Are you just doing a quick button press? If yes, it sounds like its defective.

yes, power is going in the micro usb on the shim. the Pi gets power just fine when i press the button, but only when its pressed, the moment its released, the power is lost.

this is the first Pimoroni product ive bought (through a local vendor). a real shame if its a dud, is this common?

I don’t think so? I don’t own one myself. There were some other threads on the on off shim, don’t think it was the same issue though. Duds happen sometimes. The few times its happened to me I got quick replacements.

Do you have 1-Wire enabled?

See: On/Off Shim Instant Shut Down

What are you referring to when you say “1 wire enabled”. Currently I have tested with just the 5v and ground connected and separately with the two logic signals. Is there anything more than the 5v, ground and two logic signals involved to used this?

Some more thorough documentation on this shim would be helpful. So far I’ve only found directions listed on the shopping blurb as any sort of guide as to how this works. If I don’t want to mount it directly, what do I need to connect up to make this work?

Cheers,
Sean

Pinout can be found here, https://pinout.xyz/pinout/onoff_shim#
You need GPIO 4 and 17 wired up along with GPIO Pin 2 for 5V to the Pi and GPIO Pin 6 for Ground.
Software install is listed there too, run the following from terminal.
curl https://get.pimoroni.com/onoffshim | bash

1 Wire is a GPIO Interface you can enable to connect sensors etc. It also uses GPIO Pin 4. If you don’t know what it is, its likely its not an (the) issue. If you had enabaled it for something else you were using with that Pi it would interfere with how the on of shim works. Well I think it would @gadgetoid would know better than I would.

thanks,
seeing as iv been testing without the two logic pins connected, this does not sound like this is the issue (as an aside, even with the logic pins connected, im not using 4 and 17, ive moved them to 23 and 24 using the setup file, hence why i have not mounted the shim directly).

does it matter which ground/5v pins you use?

i should be receiving a second on/off shim tomorrow which should let me know if it has been a faulty unit all along. i will report back how it goes.

cheers,
Sean

No as far as I know it doesn’t matter what 5V or ground Pin you connect to on the GPIO. All the Grounds will be a common connection anyway. The two 5V will be a common connection too.

Hopefully the second one gets you all sorted.

Could you possibly post a photo of your wiring/setup? Could be worth me trying to recreate it.

Just a thought- have you connected 3.3v? It needs the 3.3v from the Pi as a reference to feed into the low-voltage comparator. Without this reference, it’ll simply think the battery is depleted and shut down.

That will be it, it’s not connected. I will have to try that tomorrow. Though this is the first I’ve read of this requiring the 3v. Everything else has only mentioned the 5v ground and logic

Thanks, I’ll report back with hopefully good news

Oh wait, sorry, OnOff SHIM not Zero LiPo. I’m clearly confused. I don’t believe 3v3 is used.

new shim arrived, some progress:

  1. with the 3.3v connected, the red led on the shim will light up when i press the button (for the duration of the button press
  2. the power can stay on but only after i have held down the button for around 10seconds before releasing.
  3. the ‘trigger pin’ works and will send the shutdown command to the Pi.
  4. if at anypoint the ‘shutdown pin’ is connected, power is cut, it does not wait for the shutdown daemon.

i have the adafruit dpi Kippah using up most the GPIO pins but it states i am free to use 22-27.

some extra info that may help:

cleanshutd.conf

daemon_active=1
trigger_pin=23
led_pin=25
poweroff_pin=24
hold_time=1
shutdown_delay=0
polling_rate=1

BANK0 (GPIO 0 to 27):
GPIO 0: level=0 fsel=6 alt=2 func=PCLK
GPIO 1: level=1 fsel=6 alt=2 func=DE
GPIO 2: level=1 fsel=6 alt=2 func=LCD_VSYNC
GPIO 3: level=0 fsel=6 alt=2 func=LCD_HSYNC
GPIO 4: level=1 fsel=6 alt=2 func=DPI_D0
GPIO 5: level=0 fsel=6 alt=2 func=DPI_D1
GPIO 6: level=0 fsel=6 alt=2 func=DPI_D2
GPIO 7: level=0 fsel=6 alt=2 func=DPI_D3
GPIO 8: level=0 fsel=6 alt=2 func=DPI_D4
GPIO 9: level=0 fsel=6 alt=2 func=DPI_D5
GPIO 10: level=0 fsel=6 alt=2 func=DPI_D6
GPIO 11: level=0 fsel=6 alt=2 func=DPI_D7
GPIO 12: level=0 fsel=6 alt=2 func=DPI_D8
GPIO 13: level=0 fsel=6 alt=2 func=DPI_D9
GPIO 14: level=0 fsel=6 alt=2 func=DPI_D10
GPIO 15: level=0 fsel=6 alt=2 func=DPI_D11
GPIO 16: level=0 fsel=6 alt=2 func=DPI_D12
GPIO 17: level=0 fsel=6 alt=2 func=DPI_D13
GPIO 18: level=0 fsel=6 alt=2 func=DPI_D14
GPIO 19: level=0 fsel=6 alt=2 func=DPI_D15
GPIO 20: level=0 fsel=6 alt=2 func=DPI_D16
GPIO 21: level=0 fsel=6 alt=2 func=DPI_D17
GPIO 22: level=0 fsel=6 alt=2 func=DPI_D18
GPIO 23: level=1 fsel=0 func=INPUT
GPIO 24: level=0 fsel=1 func=OUTPUT
GPIO 25: level=1 fsel=1 func=OUTPUT
GPIO 26: level=0 fsel=0 func=INPUT
GPIO 27: level=0 fsel=0 func=INPUT

current dt-blob setup (i added in pin 24, is this correct?)

pin_config {
pin@default {
polarity = “active_high”;
termination = “pull_down”;
startup_state = “inactive”;
function = “input”;
}; // pin
// GPIOCONFIG: configure GPIO for 24-bit DPI interface
pin@p0 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // CLK
pin@p1 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // DEN
pin@p2 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // VSYNC
pin@p3 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // HSYNC
pin@p4 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B0
pin@p5 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B1
pin@p6 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B2
pin@p7 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B3
pin@p8 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B4
pin@p9 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B5
pin@p10 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B6
pin@p11 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // B7
pin@p12 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G0
pin@p13 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G1
pin@p14 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G2
pin@p15 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G3
pin@p16 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G4
pin@p17 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G5
pin@p18 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G6
pin@p19 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // G7
pin@p20 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R0
pin@p21 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R1
pin@p22 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R2
pin@p23 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R3
pin@p24 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R4
pin@p25 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R5
pin@p26 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R6
pin@p27 { function = “dpi”; termination = “no_pulling”; drive_strength_mA = < 8 >; }; // R7
// end GPIOCONFIG; leave the rest untouched!

    //pin@p14 { function = "uart0";  termination = "no_pulling"; drive_strength_mA = < 8 >; }; // TX uart0
        //pin@p15 { function = "uart0";  termination = "pull_up"; drive_strength_mA = < 8 >; }; // RX uart0
        pin@p46 { function = "input";  termination = "no_pulling"; polarity = "active_low"; }; // Hotplug
        pin@p47 { function = "output"; termination = "pull_up"; polarity="active_low"; }; // activity LED
        pin@p48 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CLK
        pin@p49 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD CMD
        pin@p50 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D0
        pin@p51 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D1
        pin@p52 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D2
        pin@p53 { function = "sdcard"; termination = "pull_up";    drive_strength_mA = < 8 >; }; // SD D3
     }; // pin_config

is there anything i should set in the dt-blob file?

cheers,
Sean

The pin you’re using for triggering a shutdown should output high initially and be pulled low to initiate a shutdown.

Shouldn’t the daemon take care of that? Or is there more Setup that need to be done?

okey dokey,

so ive change the dt-blob tree to have my trigger pin set as a pull up output, startup_state = active and that is now working. oddly enough, the shutdown configuration seems to set the other pins from the setup file correctly but this one i had to manually change the dt-blob tree.

the only remaining issue is the long press required at startup, but i can live with this i think, unless there is a solution out there (software or use a certain kind of switch etc.).

to summarize the whole thread thus far

-OnOff shim requires 5V, GND, 3.3V to function on a basic level
-if not using the default trigger pin, the config of the trigger pin needs to be set accordingly in the dt-blob tree: pullup, output, startup active (other pins are set correctly by the configuration file)
-extended press is still required at startup to avoid instant shutdown (solution would be much appreciated)

thanks for all the help thus far, despite being frustrated at the amount of work this has taken, at least ive learnt quite a bit.

/Sean

Yean, most of the time learning can be fun. Sometimes not so much. Usually though there is a reward of great satisfaction at the end when you finally get it working. ;)

OnOff SHIM has a weak ~10Mohm onboard pull-up resistor to prevent the need for a long press. Otherwise without the shutdown pin connected it would be floating and potentially subject to random noise induced shutdowns.

You should be able to change your pin in the device tree overlay to an input with no pull, and allow it to be set up and asserted by the shutdown script only. I’m guessing it being set up as an output is what caused your problems - in retrospect I wasn’t paying as much attention to your overlay as I should have.

I’ve updated the Pinout.xyz documentation to reflect the need for 3.3v which, despite my disagreeing with myself, it actually does require.