This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Power Down not working as it should
#1
Running a MacArthur Hat, latest version, Openplotter ...

I have the power down enabled through OpenPlotter settings,  GPIO 21 and 26, just as they should be, its made the correct entries in firmware/config.txt

I have a second pi configured the same way for guages/kiosk

When I remove the switched 12V the kiosk takes 3 or 4 seconds to shut down, as it should .. the plotter shuts down in around 1 second ...

Every time a boot, OpenCPN complains it was not shutdown correctly. This frequently cause issues, as OpenCPN like to run with its config file open for writes, which leads to corruption.

I added added a 10 second delay to shutdown.py after the pkil and before the halt ... and it still shuts down in 1 second or so ...  I'm now stumped.  The only way it can know it is supposed to be shutting down is presumably if shutdown.py spots the pin going low and begins the shutdown process .. but that shoud hit the sleep(10) .. which it isnt.

Clues? Ideas?  This is doing my head in ...  to save anyone asking if I have the pins configured correctly:     
Reply
#2
Solved, it was and is an OpenPlotter issue on the Pi5 ... solved it manually on mine.  On a Pi5 there is no pullup on GPIO with the standard OpenPLotter overly line added to config.txt and no hardware pullup on the MacArthur hat ... as a result, when the switched  power was removedthere was no "keep the power alive intil I am done" signal coming out of the Pi and the system shut down instantly.

Sticking a scope on GPIO 26 showed it low at all times.

For anyone that cares you need to add this line on a Pi5 to make your shutdown work as intended, otherwise it will shut down, just a lot faster than it should and not in a nice way!    
Reply
#3
I can not get this to work with my Pi5. It shuts down "ok", but next time I get a warning. OpenCPN user interface closes "normally", then there is about 5 sec pause and then pi powers down. So there is time to close files, but something fails.

dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=up
dtoverlay=gpio,pin26,pull=up
dtoverlay=gpio-poweroff,gpiopin=26,active_low=1

I really do not understand why there are discrepansies in keywords in dtoverlay lines, but that#s the way it is. I have also tried playing with the pin26 line...
Reply
#4
(2025-11-30, 05:50 PM)luu5 Wrote: I can not get this to work with my Pi5. It shuts down "ok", but next time I get a warning. OpenCPN user interface closes "normally", then there is about 5 sec pause and then pi powers down. So there is time to close files, but something fails.

dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=up
dtoverlay=gpio,pin26,pull=up
dtoverlay=gpio-poweroff,gpiopin=26,active_low=1

I really do not understand why there are discrepansies in keywords in dtoverlay lines, but that#s the way it is. I have also tried playing with the pin26 line...

Rolleyes I tried that too, but it still doesn't work. 

I think @sailog will have to intervene.
Reply
#5
(2025-12-02, 11:26 AM)Max1947 Wrote:
(2025-11-30, 05:50 PM)luu5 Wrote: I can not get this to work with my Pi5. It shuts down "ok", but next time I get a warning. OpenCPN user interface closes "normally", then there is about 5 sec pause and then pi powers down. So there is time to close files, but something fails.

dtoverlay=gpio-shutdown,gpio_pin=21,active_low=1,gpio_pull=up
dtoverlay=gpio,pin26,pull=up
dtoverlay=gpio-poweroff,gpiopin=26,active_low=1

I really do not understand why there are discrepansies in keywords in dtoverlay lines, but that#s the way it is. I have also tried playing with the pin26 line...

Rolleyes I tried that too, but it still doesn't work. 

I think @sailog will have to intervene.

I hope he will.
Reply
#6
You don't need to edit the config.txt file. Safe shutdown will work without adding that line.

The problem is that the latest version of OpenCPN no longer shuts down correctly and always displays the warning. You can try opening OpenCPN and safely shutting it down from a terminal:

pkill -15 opencpn

When you open it again, you'll see the warning. This is something you need to report to OpenCPN.
Reply
#7
(2025-12-11, 06:31 PM)Sailoog Wrote: You don't need to edit the config.txt file. Safe shutdown will work without adding that line.

The problem is that the latest version of OpenCPN no longer shuts down correctly and always displays the warning. You can try opening OpenCPN and safely shutting it down from a terminal:

pkill -15 opencpn

When you open it again, you'll see the warning. This is something you need to report to OpenCPN.

If I close OpenCPN from the "x" it shuts down and does not present "safe mode start" dialogue. But if I use pkill, it will complain.
Reply
#8
Yes, using `x` closes OpenCPN from within, which is always safe. Using `pkill -15` closes OpenCPN safely from outside, which used to work, but no longer does. But the MacArthur HAT is working as expected sending pkill -15 opencpn before shutdown.
Reply
#9
Should be corrected in the next release.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)