Author Topic: BootOK output/General feedback  (Read 281 times)

CaptainSandwich

  • NewMember
  • *
  • Posts: 4
BootOK output/General feedback
« on: May 10, 2021, 09:40:00 AM »
Hi Felix,

I've just today finished installing my ATXRaspi R3 into a 3D printer running Klipper on a Pi. It's nice being able to safely shutdown the Pi from the machine without having to login to the webui first. In this application, I have a couple of questions/points of feedback.

First, I was hoping to use the "BootOK" signal to interface with a relay. This would turn off power to the other controllers when the Pi is off since they're unable to function without it. Unfortunately, the PWM (?) output on this signal while the Pi is starting/shutting down was unexpected and makes this much more complicated. I personally don't feel it's particularly necessary either, at least on this signal. In my case, it would be preferred that the BootOK signal was purely high/low to indicate the 'ready' state of the Pi.

This kind of leads into the second item as well. The dimmed BootOK LED is nice in that it shows the Pi is on but not yet 'ready', but I feel like this would be better suited to the status LED since it's more likely to be visible. The various flashing states of the status LED on shutdown/reboot are quite effective.

Are these things that could be modified in the firmware?

Finally, I have no idea if this is frowned upon, however I followed a post here (https://askubuntu.com/questions/1010120/intercept-shutdown-call-and-run-script-to-allow-or-prevent-shutdown) to replace the original shutdown script with the soft power off script. It works fantastically so selecting shutdown from the webui runs the soft power off.

Anyway, thanks for your efforts Felix. Such a simple function but really makes the user experience a lot better.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6605
  • Country: us
    • LowPowerLab
Re: BootOK output/General feedback
« Reply #1 on: May 11, 2021, 10:30:56 AM »
First, I was hoping to use the "BootOK" signal to interface with a relay. This would turn off power to the other controllers when the Pi is off since they're unable to function without it. Unfortunately, the PWM (?) output on this signal while the Pi is starting/shutting down was unexpected and makes this much more complicated. I personally don't feel it's particularly necessary either, at least on this signal. In my case, it would be preferred that the BootOK signal was purely high/low to indicate the 'ready' state of the Pi.
What other controllers do you refer to?
The BOOTOK signal is explained in the guide. It is set by the Pi to HIGH once the OS boots up. It's how the ATXRaspi knows everything is OK and it can request a SHUTDOWN. It is a Green led to let the user know the script has issued that BOOTOK signal and all is good. It is not designed or intended to be used in any other way.
While the Pi boots up the bootOK may be open drain or some other state that makes the LED very faint but not enough to be a HIGH as required by the Pi, it's a known artifact but has no effect on the functionality of ATXRaspi or the Pi.

This kind of leads into the second item as well. The dimmed BootOK LED is nice in that it shows the Pi is on but not yet 'ready', but I feel like this would be better suited to the status LED since it's more likely to be visible. The various flashing states of the status LED on shutdown/reboot are quite effective.

Are these things that could be modified in the firmware?
The bootOK is an input to ATXRaspi, and the BOOTOK green LED is hardwired to it, so it cannot be changed in firmware.

Finally, I have no idea if this is frowned upon, however I followed a post here (https://askubuntu.com/questions/1010120/intercept-shutdown-call-and-run-script-to-allow-or-prevent-shutdown) to replace the original shutdown script with the soft power off script. It works fantastically so selecting shutdown from the webui runs the soft power off.
ATXRaspi triggers a OS shutdown and then cuts power off completely, which the Pi cannot do on its own. You can see the guide for a soft shutdown that triggers Atxraspi to then do the hard shutdown instead.

Anyway, thanks for your efforts Felix. Such a simple function but really makes the user experience a lot better.
You're welcome!

CaptainSandwich

  • NewMember
  • *
  • Posts: 4
Re: BootOK output/General feedback
« Reply #2 on: May 12, 2021, 09:48:36 AM »
What other controllers do you refer to?

In this case, it's a pair of SKR 1.4's.

While the Pi boots up the bootOK may be open drain or some other state that makes the LED very faint but not enough to be a HIGH as required by the Pi, it's a known artifact but has no effect on the functionality of ATXRaspi or the Pi.

Great, thanks for the info. A pulldown resistor solves the issue of the dim LED (undefined logic level). I had been measuring 2.3v on this input until the Pi output high (3.3v). I use this signal as an input to a SSR to control power to the SKRs.

The bootOK is an input to ATXRaspi, and the BOOTOK green LED is hardwired to it, so it cannot be changed in firmware.

Altering the state of the status LED during the bootup process (dim/flashing) would be possible via firmware though?

ATXRaspi triggers a OS shutdown and then cuts power off completely, which the Pi cannot do on its own. You can see the guide for a soft shutdown that triggers Atxraspi to then do the hard shutdown instead.

Understood. What I was referring to was replacing Raspbian's built-in shutdown script with a new script containing a portion of your code that triggers the ATXRaspi (depending on arguments). This way, any call to shutdown the Pi results in the ATXRaspi doing its business and the Pi completely powering off. This is great because it allows me to perform a complete power off from Fluidd (the interface I'm using for Klipper) without having to modify the source to call a different shutdown script/alias.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6605
  • Country: us
    • LowPowerLab
Re: BootOK output/General feedback
« Reply #3 on: May 12, 2021, 01:56:57 PM »
Altering the state of the status LED during the bootup process (dim/flashing) would be possible via firmware though?
The firmware would need to keep BootOK as an output. But we need BootOK as an input to decide when to flip the internal state and know the Pi has booted. Perhaps the pulldown would be more appropriate if it really bothers you.

Understood. What I was referring to was replacing Raspbian's built-in shutdown script with a new script containing a portion of your code that triggers the ATXRaspi (depending on arguments). This way, any call to shutdown the Pi results in the ATXRaspi doing its business and the Pi completely powering off. This is great because it allows me to perform a complete power off from Fluidd (the interface I'm using for Klipper) without having to modify the source to call a different shutdown script/alias.
That can be made possible but I have not tried. If you're successful and it's something that is reliable and easy to change I can add the details in the guide.

CaptainSandwich

  • NewMember
  • *
  • Posts: 4
Re: BootOK output/General feedback
« Reply #4 on: May 14, 2021, 05:30:43 AM »
The firmware would need to keep BootOK as an output. But we need BootOK as an input to decide when to flip the internal state and know the Pi has booted.

Sorry, going back to the original second point I was referring to the status LED (see attached). This is already an output and shows solid when the Pi is booting/on and flashes at some frequency when it's shutting down/rebooting. I was just saying it would be nice if it also had a state to indicate the Pi is still booting, rather than solid on which can make it hard to distinguish whether the Pi is on & booting vs on & ready.

That can be made possible but I have not tried. If you're successful and it's something that is reliable and easy to change I can add the details in the guide.

It is working well for me currently, however I don't imagine it's very robust in this format. Regardless of the arguments passed to the shutdown script, it will shutdown immediately. The exception is if a reboot argument is passed, where it will bypass the ATXRaspi. The original shutdown script in /sbin was renamed to shutdownoriginal. A new shutdown script was created per below and made executable. Ultimately it would be preferable to only trigger the ATXRaspi for certain arguments and pass all others through to shutdownoriginal.

Code: [Select]
#!/bin/bash

BUTTON=10

arg="${1}"

case $arg in
        -r)
                shutdownoriginal -r now
        ;;

        *)

                #setup GPIO 10 as output and set to HIGH
                echo "$BUTTON" > /sys/class/gpio/export;
                echo "out" > /sys/class/gpio/gpio$BUTTON/direction
                echo "1" > /sys/class/gpio/gpio$BUTTON/value

                /bin/sleep 1

                #restore GPIO 10
                echo "0" > /sys/class/gpio/gpio$BUTTON/value
        ;;

esac


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6605
  • Country: us
    • LowPowerLab
Re: BootOK output/General feedback
« Reply #5 on: May 14, 2021, 09:18:02 AM »
This is the first time someone asks the status button to do something other than it always did so ... I'm afraid I will leave it as is. It's a matter of personal preference. Maybe in the future if I get around to remaking this board and adding features, it will be possible to configure things like that through a serial port.

If the shutdown script will work with a different argument to only trigger the ATXRaspi and not also trigger a shutdown, then it would be OK. It can then be referenced in the soft-shutdown guide.

CaptainSandwich

  • NewMember
  • *
  • Posts: 4
Re: BootOK output/General feedback
« Reply #6 on: May 23, 2021, 10:05:42 PM »
Hi Felix,

I had a couple of issues with the Pi turning itself back on after a shutdown. I also found I could run my finger over the softbtn/btn/led pins and the Pi would turn on.

After probing around a little, there's a base resistor but don't appear to be any pull-down resistors on this pin. I added an external 10k pull-down and resolved the power-ups after shutdown and ability to turn the Pi on by touching pins.


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6605
  • Country: us
    • LowPowerLab
Re: BootOK output/General feedback
« Reply #7 on: May 24, 2021, 11:30:53 AM »
Thanks for the feedback, I am aware about this potential issue, will be resolved in a future version. It has generally not been a problem and where it does manifest it is easily resolved with a pulldown to GND resistor of any value (ever a wire/jumper).