Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 9 of 9
  1. #1

    PiCore Player and gpio-poweroff / gpio-shutdown overlays

    Hello,

    We are upgrading our power manager board to make it working with native gpio-poweroff and gpio-shutdown overlays instead of the python script you kindly integrated to Picore.
    We succeded to use these overlays under Volumio2 and Dietpi, so now we are looking to use them under Picore.

    Code:
    dtoverlay=gpio-shutdown,gpio_pin=22,active_low=0
    dtoverlay=gpio-poweroff,gpiopin=17
    Good news, after editing config.txt, the gpio-poweroff is working.

    But not gpio-shutdown, as I think a service must be added to monitor shutdown pin.
    On Dietpi it's systemd-logind service, but I have no idea what is the equivalent under Picore.

    Do you think Picore player could care these overlays later ?

    Thanks !

    Code:
    Name:   gpio-shutdown
    Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
            is configured as an input key that generates KEY_POWER events.
            This event is handled by systemd-logind by initiating a
            shutdown. Systemd versions older than 225 need an udev rule
            enable listening to the input device:
    
                    ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                            SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                            ATTRS{keys}=="116", TAG+="power-switch"
    
            This overlay only handles shutdown. After shutdown, the system
            can be powered up again by driving GPIO3 low. The default
            configuration uses GPIO3 with a pullup, so if you connect a
            button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
            you get a shutdown and power-up button.

  2. #2
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,163
    Obviously we don't run systemd, but anything is possible. Listening to a GPIO pin is rather easy. And then integration of the overlays into our interface. Please drop us a PM or an email, and we can discuss the specifics.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  3. #3
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,228
    Moving a discussion over from here, to avoid spamming that sbpd thread with unrelated issues.

    Trying to use gpio-shutdown with GPIO3, so that a single button can halt the system or wake-from-halt.

    With the following settings the shutdown works occasionally - the wake-up always works.



    Another user, meq123, reported success using a different pin for the shutdown. Possible reasons for the difference are that I2C uses GPIO3, and GPIO3 has a hardwired (1k8) pull-up resistor.

  4. #4
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,163
    GPIO3 is the only one that can work without a SHIM or power relay board. But as you noted, i2c runs on gpio3, so if you use i2c, or a DAC that uses i2c, then you cannot use it.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  5. #5
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,228
    In the case where I2C isn't being used for anything else, is there an obvious reason why the shutdown doesn't work 100% reliably with GPIO3? The hardwired resistor value of 1k8 is quite a lot lower than the value suggested for external pull-up resistors (e.g. 10k), and it's not possible without a bit of surgery to add another resistor. I understand this low value is the minimum required to limit the current sufficiently, whilst also allowing the pin to handle high speed voltage changes.

    But I wonder if a bit of downstream resistance (i.e. between the pin and GND) would be enough to split the 3v3 voltage so that GPIO3 doesn't actually go low enough to register '0'. I can't see an obvious way to do anything about that if that is the case, and also it doesn't explain why the wake-from-halt function works reliably. Maybe some measurements will throw light on this. Actually, it would need about 500 Ohms between the pin and ground to keep GPIO3 up around the 'zero' threshold of 0.8V, so I doubt this is the problem.
    Last edited by chill; 2019-05-08 at 08:36.

  6. #6
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,163
    Have you turned off i2c in your config.txt?
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  7. #7
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,228
    I haven't! Didn't even know that was an option!

  8. #8
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,228
    Quote Originally Posted by paul- View Post
    Have you turned off i2c in your config.txt?
    That's fixed it, thanks for the suggestion. Completely reliable now.

    Code:
    #dtparam=i2c_arm=on,spi=on,i2s=on
    dtparam=i2c_arm=off,spi=on,i2s=on
    I have a couple of pCP devices running LMS. One is mounted in my DIY amplifier and is powered 24/7, but a way to shut it down cleanly is still good to have. The other is in my camper van, so is powered down often. Good to know that I now have a way to power it down without having to log in to access the pCP web page on some device, and without risk of corrupting the SD card.

  9. #9
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,163
    Cool. Glad it's working.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

Posting Permissions

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