juanma_cab
Posts: 27
Joined: Fri Mar 26, 2021 3:56 pm

Supply start Control

Thu May 06, 2021 11:44 am

Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!

User avatar
B.Goode
Posts: 12068
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Supply start Control

Thu May 06, 2021 12:06 pm

juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!


"I want to control the start with a external button, is this possible by software?"

You seem to have a conundrum there: if the RPi board hasn't been switched on then it can't be running any software... ?

bjtheone
Posts: 1292
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Supply start Control

Thu May 06, 2021 12:46 pm

The standard way is to introduce an switch inline between the AC power and the Pi. Can either switch on the AC side before the adaptor or put a switch inline between the adaptor and the Pi.

I have both options on various Pis. The AC side switch works better but is often in a more inconvenient location. The inline option is typically easier to access. However it comes with more issues. Many inline switches are very poorly designed, with thin wires and shoddy connectors. These issues can result in a large voltage drop and odd intermittent issues with the Pi due to power problems. If you go with the inline option, ensure you have a well made switch/cable.

There are also various solutions that allow software shutdown and startup initiated by an external switch and the GPIO pins.

Also note: A power side switch is not a substitute for the correct software shutdown. Just removing power from a Pi runs the risk of corrupting the SD card.

juanma_cab
Posts: 27
Joined: Fri Mar 26, 2021 3:56 pm

Re: Supply start Control

Fri May 07, 2021 11:33 am

B.Goode wrote:
Thu May 06, 2021 12:06 pm
juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!


"I want to control the start with a external button, is this possible by software?"

You seem to have a conundrum there: if the RPi board hasn't been switched on then it can't be running any software... ?
I mean if there is any way to plug in the raspberry to supply and it doesn't switch on (with device trees maybe or similar). You are right, maybe it is not the best way to explain the stuff :D

juanma_cab
Posts: 27
Joined: Fri Mar 26, 2021 3:56 pm

Re: Supply start Control

Fri May 07, 2021 11:37 am

bjtheone wrote:
Thu May 06, 2021 12:46 pm
The standard way is to introduce an switch inline between the AC power and the Pi. Can either switch on the AC side before the adaptor or put a switch inline between the adaptor and the Pi.

I have both options on various Pis. The AC side switch works better but is often in a more inconvenient location. The inline option is typically easier to access. However it comes with more issues. Many inline switches are very poorly designed, with thin wires and shoddy connectors. These issues can result in a large voltage drop and odd intermittent issues with the Pi due to power problems. If you go with the inline option, ensure you have a well made switch/cable.

There are also various solutions that allow software shutdown and startup initiated by an external switch and the GPIO pins.

Also note: A power side switch is not a substitute for the correct software shutdown. Just removing power from a Pi runs the risk of corrupting the SD card.
Thank you so much! Yes, I'm using a button for switch on and switch off (correctly), I was asking if there is some way to plug the USB C and Raspberry starts on halt mode (like when it is switched off from Raspbian).

twostage
Posts: 105
Joined: Sun May 07, 2017 6:31 pm
Location: Northumberland

Re: Supply start Control

Sun May 09, 2021 10:49 am

A bit like the BIOS settings in some PCs/servers where you can set whether it boots when power is supplied or waits for the power button to be pressed ?

drtechno
Posts: 229
Joined: Fri Apr 09, 2021 6:33 pm

Re: Supply start Control

Sun May 09, 2021 12:20 pm

I wired up a standard power switch circuit on my 4B. Since it had a mxl7704 chip, and usb power turned off when holding global_en pin low more than 5 seconds. I also made a circuit that allowed me to run my Nautica PWM fan at 50% speed because I wanted to run at low speeds but don't care about thermally controlling the speed. and control the system with a simple on-off-on toggle switch, that the device automatically is off when you plug in the usb.. And yes, it does shut down the gpio and everything else at os shutdown.
The schematic:

Image

I had to solder wires onto the board to bring the voltages I needed on a small riser board I mounted over the the power/video/audio side of the board. I did this intentionally so that I would have the GPIO connector free for electronics exploration. The circuit is simple. I take the 5V_VBUS from TP3 (add a wire) and the 5V_USB_PWR from the usb 2.0 port (which is software controlled) and soldered a 2 pin header on the Global_EN and GND (next to the Global_EN pad) and started building the circuit enclosed. The Power_Btn is the main power switch and is a normal power switch for this kind of digitally controlled regulator. (hold down power switch to turn on like some tablets, and other portable devices) The DEBUG Power_OFF is a switch I added just in case I lock up the OS with programming errors. It kills the power to the 3.3V and USB 5V in the event of a project failure too. The PWM_FAN_CTRL fallows the 5V USB status and shuts down the fan when the software powers down. Diode D1 isolates the USB 5V power from the power switch so when the button is pushed, it does not inject stray voltages back into the 5V usb circuits. A 4.7K resistor is in series on the Global_En to protect the existing gate of the reset circuit soldered on the main board from current surges.


The backside soldering- I solder a wire on the usb5V pins, and another wire to tp3 to bring it up to my power switch riser board that I created:
Image

Then on the top side, I installed a 2 pin header in where the global_en and gnd pads are next to the processor:
Image

Then I chose a 10K resistor array to make the power switch circuit, since two 10K resistors in parallel is 5K which worked for this power switch circuit: I had a couple of 4.7K-1/2W resistors around left over from a tube audio build, but any type of 1/8w or greater resistor will work. I also placed a corck piece on one side to stabilize the board mounting, as well as installed a socket for the pin header to plug into:
Image

I don't have the best camera around, sorry about the blurred images.

drtechno
Posts: 229
Joined: Fri Apr 09, 2021 6:33 pm

Re: Supply start Control

Sun May 09, 2021 1:20 pm

juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!
I don't know which pi you are using. The one I posted is for a 4b ONLY. but a similar affair would be like the 3+ but the switching logic would be 1/2 cmos (1.7V high) instead of TTL (5V high) and so the circuit would be slightly different.

User avatar
rpdom
Posts: 18699
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Supply start Control

Sun May 09, 2021 8:28 pm

drtechno wrote:
Sun May 09, 2021 1:20 pm
juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!
I don't know which pi you are using. The one I posted is for a 4b ONLY. but a similar affair would be like the 3+ but the switching logic would be 1/2 cmos (1.7V high) instead of TTL (5V high) and so the circuit would be slightly different.
What are you talking about????

The GPIO levels on the 4B are the same (3.3V) as every other Pi made so far. The power supply voltage on all models is 5V.
Unreadable squiggle

User avatar
thagrol
Posts: 4942
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Supply start Control

Sun May 09, 2021 9:52 pm

juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!
Not a software solution.

In the past I've prevented Pi from starting when power is supplied by holding the RUN pin low. Release it to get a low to high transition and start the Pi.

I've no idea whether that's a sensible thing to do or whether long term use can damage the PI but it worked for me. A simple SPST switch wired between RUN and ground should be enough.

One caveat: don't pull RUN low unless the Pi has already performed a safe shutdown. Bad things may happen to your SD card if you do.
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

cleverca22
Posts: 3750
Joined: Sat Aug 18, 2012 2:33 pm

Re: Supply start Control

Sun May 09, 2021 10:59 pm

thagrol wrote:
Sun May 09, 2021 9:52 pm
juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!
Not a software solution.
i can picture how i might create a software solution

in theory, i could have a custom start4.elf on the fat32 partition, that will simply wait for an edge on a gpio pin (even the pin used to wake from shutdown)
and then upon receiving that edge, it use the noobs/pinn api, to reboot into a second fat32, with the official firmware, where it boots as normal

the only downside, is that the dram controller is up that whole time, so its not good for battery life, and a normal reboot may instead shutdown and require the pin to wiggle again

juanma_cab
Posts: 27
Joined: Fri Mar 26, 2021 3:56 pm

Re: Supply start Control

Tue May 11, 2021 6:43 am

Thank you so much for all the replies, I will think about all of them if there is any way to do.

fruitoftheloom
Posts: 26829
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Supply start Control

Tue May 11, 2021 7:08 am

juanma_cab wrote:
Tue May 11, 2021 6:43 am
Thank you so much for all the replies, I will think about all of them if there is any way to do.

http://www.uugear.com/product/witty-pi- ... pberry-pi/
The information is out there....you just have to let it in.

My other Linux machines: ChromeBox
https://www.aliexpress.com/item/32966393971.html
& Stone Desktop Intel CoreDuo circa 2010

bjtheone
Posts: 1292
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Supply start Control

Wed May 12, 2021 1:57 pm

juanma_cab wrote:
Tue May 11, 2021 6:43 am
Thank you so much for all the replies, I will think about all of them if there is any way to do.
I am curious why you want to power the Pi up but keep it in a halt state? Just controlling the power supplied keeps it powered off (obviously) and switching it on powers up and botts the Pi. What is the advantage of having a secondary control, on top of the input power switch? It adds complexity.

drtechno
Posts: 229
Joined: Fri Apr 09, 2021 6:33 pm

Re: Supply start Control

Wed May 12, 2021 2:32 pm

rpdom wrote:
Sun May 09, 2021 8:28 pm
drtechno wrote:
Sun May 09, 2021 1:20 pm
juanma_cab wrote:
Thu May 06, 2021 11:44 am
Hi everyone, Is there any way to control the start of the Raspberry when is plugged to 5v supply? I mean, I want to Raspberry doesn't switch on when is plugged, I want to control the start with a external button, is this possible by software?

Thank you so much!
I don't know which pi you are using. The one I posted is for a 4b ONLY. but a similar affair would be like the 3+ but the switching logic would be 1/2 cmos (1.7V high) instead of TTL (5V high) and so the circuit would be slightly different.
What are you talking about????

The GPIO levels on the 4B are the same (3.3V) as every other Pi made so far. The power supply voltage on all models is 5V.
The global enable pin is on the 1/2 cmos side of the chip. As like all the Broadcom processors are. Look at a Broadcom datasheet. You'll also notice these 1/2 cmos is on the 5v side of the processor, which the tattle tale sign of that is the voltage divider. The 3b just has a voltage divider to 1/2 cmos hi, which would be 1.7V. The 4B has a mosfet in its ground circuit of the voltage divider that switches this logic by a gate tied to Global_enable line to control both the Broadcom and the mxl7704.

That is why the 3+ would be different from my solution for the 4b I don't own a 3+ to determine if they do something different with the mxl7704 chip. All Broadcom chips in this family have 1/2 cmos logic on the clock, chip enable, and clock enable pins. Unless you can physically prove otherwise, never assume a higher voltage bigger than the smallest voltage applied to the cpu.

The difference is I set up the gate circuit of the mosfet of the 4b. 3+ is a different circuit, so it would be way different, and I would have to have one physically so I can trace and make a partial schematic of it to hardware debug it for a power switch. I don't trust schematics compared to physically looking at it. Because mis-prints happen. Looking quickly the enable pin on the mxl7704 does not go anywhere but to a test point. So looking at that you would have to build the circuit up.

Oh btw, GPIO is a different section of this Broadcom chip, that runs off a different regulated supply internally

drtechno
Posts: 229
Joined: Fri Apr 09, 2021 6:33 pm

Re: Supply start Control

Mon May 24, 2021 8:14 pm

thagrol wrote:
Sun May 09, 2021 9:52 pm


One caveat: don't pull RUN low unless the Pi has already performed a safe shutdown. Bad things may happen to your SD card if you do.
The way I use the run pin is actually for hardware reset. Or the reset button that is normally on the computer and of course, like a normal computer, you don't really use it unless the os is locked up.

I like my circuit. as it should be incorporated into anyone's lower mezzanine board and robotics especially.

I have a real power switch like a computer, a reset switch, and a emergency stop.

User avatar
thagrol
Posts: 4942
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Supply start Control

Tue May 25, 2021 9:37 am

drtechno wrote:
Mon May 24, 2021 8:14 pm
thagrol wrote:
Sun May 09, 2021 9:52 pm


One caveat: don't pull RUN low unless the Pi has already performed a safe shutdown. Bad things may happen to your SD card if you do.
The way I use the run pin is actually for hardware reset. Or the reset button that is normally on the computer and of course, like a normal computer, you don't really use it unless the os is locked up.
Yes, that's its intended use. But there's no "reset button that is normally on the computer" on any PI. Or were you talking about PCs again?
I like my circuit. as it should be incorporated into anyone's lower mezzanine board and robotics especially.

I have a real power switch like a computer, a reset switch, and a emergency stop.
That's relevant to the post you quoted how exactly?
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

drtechno
Posts: 229
Joined: Fri Apr 09, 2021 6:33 pm

Re: Supply start Control

Tue May 25, 2021 6:39 pm

thagrol wrote:
Tue May 25, 2021 9:37 am

Yes, that's its intended use. But there's no "reset button that is normally on the computer" on any PI. Or were you talking about PCs again?

That's relevant to the post you quoted how exactly?
Well after hardware debugging:

The hardware process of "Off" is the condition: Global_en being low and stay low when run is high.
The hardware process of "ON" is the condition: run low and Global_en ttl logic high (greater than 2V no more than 5.5V)
The hardware process of "Restart" is the condition of: Global_en High (greater than 2V) with Run being low.

By default the gate circuit of Global_en is left uncircuited, so it will always be "Not Low", or greater than 2V

The hardware circuit loop I built achieves all functions in OS software control except restart. Which I think I can fix that by setting up the OS side of the apci manager differently since it is still setup for an external apci controller. So I will try configuring it hw.acpi.disable_on_reboot. to see if that bypasses the S5 hardware trap I configured in hardware. and keep Global_en high but trigger the run pin to pulse low for processor reboot.

If the change is valid, I will send it upstream through my Ubuntu development channel for peer review. Then the rewrite of the default setting will be applied downstream on the "debugging/unstable" distros till it is accepted into LTS channel.

You see, this processor is new, so all the bus calls to hardware are not routed in apci, and still sends the intel apci controller calls to nowhere in the background. Some of these OS calls are part of the processor, some are part of a circuit that is not installed or the registers are not the same as the intel acpi controller. So, in this adventure for me, the hardware debugging is paused for the moment, to switched over to OS APCI Management debugging.

I almost have it. Right now, it powers on like some servers and notebook, and tablets, and phones with holding Global_en high for more than 4 seconds (default soft turn on for the mxl7704 regulator chip). But OS software reboot and shutdown are both shutdown now.

Basically we don't have an Intel APCI controller, but it is configured right now as such and the only commands I see are working is the monitor controls, and S5 call (shutdown). So an new APCI profile needs to be debugged and setup so other things like cpu_throttling and HDD_Spindown are either routed correctly, or sent to NULL so the process don't accidently hang in the background in all the distributions (which it could cause the window manager to lock up)

User avatar
thagrol
Posts: 4942
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Supply start Control

Tue May 25, 2021 9:36 pm

drtechno wrote:
Tue May 25, 2021 6:39 pm
thagrol wrote:
Tue May 25, 2021 9:37 am

Yes, that's its intended use. But there's no "reset button that is normally on the computer" on any PI. Or were you talking about PCs again?

That's relevant to the post you quoted how exactly?
Well after hardware debugging:

The hardware process of "Off" is the condition: Global_en being low and stay low when run is high.
The hardware process of "ON" is the condition: run low and Global_en ttl logic high (greater than 2V no more than 5.5V)
The hardware process of "Restart" is the condition of: Global_en High (greater than 2V) with Run being low.

By default the gate circuit of Global_en is left uncircuited, so it will always be "Not Low", or greater than 2V

The hardware circuit loop I built achieves all functions in OS software control except restart. Which I think I can fix that by setting up the OS side of the apci manager differently since it is still setup for an external apci controller. So I will try configuring it hw.acpi.disable_on_reboot. to see if that bypasses the S5 hardware trap I configured in hardware. and keep Global_en high but trigger the run pin to pulse low for processor reboot.

If the change is valid, I will send it upstream through my Ubuntu development channel for peer review. Then the rewrite of the default setting will be applied downstream on the "debugging/unstable" distros till it is accepted into LTS channel.

You see, this processor is new, so all the bus calls to hardware are not routed in apci, and still sends the intel apci controller calls to nowhere in the background. Some of these OS calls are part of the processor, some are part of a circuit that is not installed or the registers are not the same as the intel acpi controller. So, in this adventure for me, the hardware debugging is paused for the moment, to switched over to OS APCI Management debugging.

I almost have it. Right now, it powers on like some servers and notebook, and tablets, and phones with holding Global_en high for more than 4 seconds (default soft turn on for the mxl7704 regulator chip). But OS software reboot and shutdown are both shutdown now.

Basically we don't have an Intel APCI controller, but it is configured right now as such and the only commands I see are working is the monitor controls, and S5 call (shutdown). So an new APCI profile needs to be debugged and setup so other things like cpu_throttling and HDD_Spindown are either routed correctly, or sent to NULL so the process don't accidently hang in the background in all the distributions (which it could cause the window manager to lock up)
Another complete failure to answer a direct question.

And another bunch of dubious information.

If you're going to quote me again please make sure what you post is related to what you quoted. The above isn't.

Oh, I noticed you weren't around for a while. Did you get hit with the ban hammer?
I'm a volunteer. Take me for granted or abuse my support and I will walk away

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Advanced users”