Software shutdown??

Started by roman, August 20, 2013, 03:29:23 PM

roman

I installed ATXRaspi and the shutdown via the button is working fine.

Now I want to turn of the machine via a remote too and I was wondering if it is even possible to make ATXRaspi shut down from the pi?

I assumed it o be possible but it seems to me this is somehow not? Somehow it seems strange to me if this is not the case as it should not make any exxtra work for such a controller?

As there is no schematics it is a bit hard for me to tell what to do if I wanted to introduce such a feature by myself. I found out that the outer of the button pin has to be on ground for the button to be on. The proble is that it is on 5V - thus I must not connect it to a pi GPIO port without any ado.

Any ideas?


Felix

MisterFab shared a little mod that allowed him to shutdown from software, using a transistor to pull down the button pin (simulate a press), by pulling up a GPIO from the Pi side:
http://lowpowerlab.com/forum/index.php/topic,17.msg128.html#msg128

The button is pulled up and when pressed will pull down that pin. So I think you might even be able to connect that directly to another GPIO (I will try this myself tonight if I get a chance) and pull that down for ~4.5 sec and start a shutdown.

So yeah it's possible, the Pi just doesn't have a good way to indicate that the system is shutting down, at least not that I know of.

roman

Thanks for the fast reply!

After some googling yesterday I allready thought that a transistor and a 1k resistor would work - but its still much better to have a schematic from somebody who made it work.

It should be easy to add a universal shutdown. I would do it this way:

Add a shutdown script that gets called at the beginning of the shutdown process (I would probably add a script to init.d that gets called at K00).

In this script I would:
- check if this is a hardware shutdown (from ATX Raspi) by looking at the gpio
- if this is not the case start a process that pulls a gio for 5 seconds

I will post the schematic and the soruce here when its done.

I have no idea what kind of controller you are using on the ATXRaspi but maybe adding another input with 3.3V that starts shutdown instantly (not after 4 seconds) would be somehing for a V3. Then one would just have to connect that to a GPIO

Felix

A few things could be improved in every version. Although this board has gone through several revisions, and was designed for a commercial application that had certain requirements. Hence the ~4sec delay. The controller is a bit limited in I/O so that's why there aren't more options, but I think it covers 90% of the needs.
I may move to another controller if it makes sense or if RaspberryPi will offer new opportunities in firmware.

mynick

Hi Felix,

I'm already have one of your ATXRaspi R2 boards which is a very good stuff from my opinion.
I like use it. It works fine while I reboot my RPi.
But it not cut off the power after I shut the RPi down from console (IR remote).
I thought it will shut down the power after some time when ATXRaspi can be sure about the BootOk signal not will recovered (not a reboot was issued).

So I would like to reprogram the MCU on the board to support this option too.

If I'm right the chip on the board is an ATTiny45, am I right?
Is it possible to reprogram the MCU which is already on the board?
Can I use the onboard ISP header to do this?

Regards, Viktor

Felix

Viktor,
Yes it's a tiny45, you can reprogram using the ISP connector using your own program. I suggest testing on another tiny on a breadboard before you do it. Don't forget you have to power the target independently when you program through ISP.
That being said, do it at your own risk. There's a possibility the tiny will get bricked if not done correctly.