Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Nov 2018
    Posts
    4

    piCorePlayer + Pimoroni OnOff Shim

    Hello,
    I have installed a "Pimoroni onoff shim" for a completely shut on and off of my Raspberry with a hardware momentary button. The switch works fine with Raspbian, but the original software doesn't run with piCorePlayer.

    The switch needs a trigger script to initiate shutdown by button press (GPIO17 set to 0) and a gpio-shutoff code (GPIO4 set to 0), which is executed at the end of the poweroff-function when piCorePlayer is shutdown.

    The trigger script works fine with typing "/home/tc/pcp-powerbutton.sh -i -17 --low" as user command #1 on the tweaks page. Is there any possibility to set GPIO4 to 0 when piCorePlayer is shutdown so that the shim realises the shutdown and cuts off completely?

    Regards George

  2. #2
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    1,505
    Quote Originally Posted by George_ View Post
    Hello,
    I have installed a "Pimoroni onoff shim" for a completely shut on and off of my Raspberry with a hardware momentary button. The switch works fine with Raspbian, but the original software doesn't run with piCorePlayer.

    The switch needs a trigger script to initiate shutdown by button press (GPIO17 set to 0) and a gpio-shutoff code (GPIO4 set to 0), which is executed at the end of the poweroff-function when piCorePlayer is shutdown.

    The trigger script works fine with typing "/home/tc/pcp-powerbutton.sh -i -17 --low" as user command #1 on the tweaks page. Is there any possibility to set GPIO4 to 0 when piCorePlayer is shutdown so that the shim realises the shutdown and cuts off completely?

    Regards George
    Using a program to drive an output high is going to be tricky, since the shutdown kills all processes. You can try the gpio-poweroff overlay, which will do this at the firmware/kernel level.

    in your config, set
    dtoverlay=gpio-poweroff,gpiopin=4,active_low=1

    I have a feeling that a reboot will trigger a the power off event too, as there is notes in the help info

    Code:
    Name:   gpio-poweroff
    Info:   Drives a GPIO high or low on poweroff (including halt). Enabling this
            overlay will prevent the ability to boot by driving GPIO3 low.
    Load:   dtoverlay=gpio-poweroff,<param>=<val>
    Params: gpiopin                 GPIO for signalling (default 26)
    
            active_low              Set if the power control device requires a
                                    high->low transition to trigger a power-down.
                                    Note that this will require the support of a
                                    custom dt-blob.bin to prevent a power-down
                                    during the boot process, and that a reboot
                                    will also cause the pin to go low.
            input                   Set if the gpio pin should be configured as
                                    an input.
            export                  Set to export the configured pin to sysfs
    I'm have not found how to generate the "custom" dt-blob.bin. The new audiophonics power module that is active high, works just fine.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  3. #3
    Junior Member
    Join Date
    Sep 2018
    Posts
    6
    Quote Originally Posted by paul- View Post
    The new audiophonics power module that is active high, works just fine.
    Sorry for the interruption, but are you talking about the AUDIOPHONICS PI-SPC II Power Management / Power supply for Raspberry Pi.

    IĹm currently on the lookout for on/off shims.

    Thanks!

  4. #4
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    1,505
    Referring to this, not sure if it is fully released yet.

    https://forums.slimdevices.com/showt...tdown-overlays
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  5. #5
    Junior Member
    Join Date
    Nov 2018
    Posts
    4
    Thank you Paul-,
    that's the trick. The onoff-shim works as it should be. In case of a reboot, I have to push the button again, no problem.
    @badkarmaboy: I built in the onoff shim from Pimoroni. And this shim uses the same GPIO17 for triggering the shutdown as the audiophonics device. So the audiophonics sketch does the job for the Pimoroni shim.

  6. #6
    Junior Member
    Join Date
    Sep 2018
    Posts
    6
    Thank you!

  7. #7
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    1,505
    I found the procedure to set the initial state of the GPIO pins, this would prevent a reboot from powering off you shim.

    https://www.raspberrypi.org/document...nfiguration.md

    It might be simplest to burn a raspbian image and set everything up using raspbian, then transfer the custom dt-blob.bin to your pCP boot disk.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •