Page 1 of 9

Under-voltage warnings

Posted: Sun Jul 20, 2014 4:08 pm
by dom
The B+ has an under voltage detect trigger which results in the power led going off when voltage drops below about 4.65V.
The signal is also available on a gpio line (GPIO35).

Latest firmware update will display a warning symbol in top right of display when this is detected.
It will also disable turbo mode while the warning is displayed to try to reduce the chances of crashing.

I've also added a warning symbol to the existing over-temperature condition (> 85'C), which also disabled turbo mode.

Currently the symbols are:
Red square: over-temperature
Rainbow square: under-voltage

As usual you can override the behaviour in config.txt if you understand the risks:
avoid_warnings=1 removes the warning overlay.
avoid_warnings=2 additionally allows turbo when low-voltage is present.

For testing you can make the temperature warning trigger more easily with "temp_limit=50".
You can probably trigger the under-voltage check by using an insufficient power supply (perhaps USB socket from PC), or a dodgy micro-usb cable from ebay.

Run rpi-update and report back if it behaves as expected.
You will need a B+ to test the under-voltage state. The over-temperature should work on any Pi.


EDIT: with firmware from 12 September 2016 or later, the warning symbols have changed:

Image
Under voltage

Image
Throttling arm due to temperature (80-85'C)

Image
Throttling arm and gpu due to temperature (85+'C)

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 5:12 pm
by drgeoff
Nice. :)

(We are getting closer to the LED that comes on when you have forgotten to power up the RPi. :lol: )

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 5:24 pm
by mahjongg
We are getting closer to the LED that comes on when you have forgotten to power up the RPi. :lol: )
And a LED that comes up when the battery starts to fail that powers the LED that comes on when you have forgotten to power up the RPi. :D

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 5:41 pm
by notro
If there's a short under-voltage dip, does the icon stay or does it go away when normal voltage is back?

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 5:46 pm
by mahjongg
Note that dips can be very short, but can still be fatal by "flipping a bit" in memory, in this way they can also indirectly cause SD-card corruption.
It would be best if under-voltage warnings were taken seriously, and do not disappear in the same blink of an eye they may last.

It would be best to program the GPIO35 so a brownout causes an interrupt, and to keep the error flag visible until cleared by the user.

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 5:57 pm
by drgeoff
mahjongg wrote:And a LED that comes up when the battery starts to fail that powers the LED that comes on when you have forgotten to power up the RPi. :D
Battery not required. Works from Ragiant Energy (TM) from angry user. The more furious the user that the RPi is not working, the brighter the LED. :lol:

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 6:18 pm
by MrEngman
dom wrote:The B+ has an under voltage detect trigger which results in the power led going off when voltage drops below about 4.65V.
The signal is also available on a gpio line (GPIO35).

Latest firmware update will display a warning symbol in top right of display when this is detected.
....
You can probably trigger the under-voltage check by using an insufficient power supply (perhaps USB socket from PC), or a dodgy micro-usb cable from ebay.
My B+ has two wifi modules connected to it, a TP-Link TL-WN727N and an Edimax EW-7811Un. Voltage measured between J8/39 and J8/2, as TP1-2 appear to have disappeared, is 4.88V. No adjustments to the B+ config to increase USB current.

I am running my B+ from a USB socket on my laptop, an Asus 8943G. No sign of any undervoltage problems. :o :D

Must find a crappy laptop or USB cable to see what happens :lol:


MrEngman

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 6:21 pm
by dom
notro wrote:If there's a short under-voltage dip, does the icon stay or does it go away when normal voltage is back?
The icon persists for about 3 seconds. It actually fades out, so you should be able to distinguish a blip every couple of seconds from a continuous under-voltage condition.

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 6:53 pm
by MrEngman
A silly question perhaps, but will the icon appear if using CLI or SSH with CLI? I would think not but ....


MrEngman

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 7:10 pm
by drgeoff
MrEngman wrote:A silly question perhaps, but will the icon appear if using CLI or SSH with CLI? I would think not but ....


MrEngman
I suspect the icon(s) is/are inserted by the GPU and the OS and X are blissfully unaware.

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 7:33 pm
by dom
drgeoff wrote:I suspect the icon(s) is/are inserted by the GPU and the OS and X are blissfully unaware.
Yep.

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 7:47 pm
by MrEngman
dom wrote:
drgeoff wrote:I suspect the icon(s) is/are inserted by the GPU and the OS and X are blissfully unaware.
Yep.
Sorry, that doesn't mean anything to me. Taking a guess I presume this means I need a display directly connected to the Pi and I won't see them if using SSH.


MrEngman

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 7:51 pm
by drgeoff
MrEngman wrote:
dom wrote:
drgeoff wrote:I suspect the icon(s) is/are inserted by the GPU and the OS and X are blissfully unaware.
Yep.
Sorry, that doesn't mean anything to me. Taking a guess I presume this means I need a display directly connected to the Pi and I won't see them if using SSH.


MrEngman
Yes, they are only on the video output from HDMI or composite port. GPU is the graphics processing unit which "draws" everything that appears on those video outputs.

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 8:09 pm
by MrEngman
Thanks, that makes sense. And I've learnt a little more about the PI :)


MrEngman

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 8:49 pm
by paulie
dom wrote:The B+ has an under voltage detect trigger which results in the power led going off when voltage drops below about 4.65V.
The signal is also available on a gpio line (GPIO35).

Latest firmware update will display a warning symbol in top right of display when this is detected.
It will also disable turbo mode while the warning is displayed to try to reduce the chances of crashing.
For anyone running headless, is it worth writing these errors to e.g. /var/log/syslog ?
Perhaps a software switch to write/not write them to log file...

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 9:56 pm
by blachanc
paulie wrote: For anyone running headless, is it worth writing these errors to e.g. /var/log/syslog ?
Perhaps a software switch to write/not write them to log file...
or maybe having a routine that display a message in all terminal like a shutdown signal does.
having it in /var/log is good, but if you do not monitor it, I suppose you won't see it.
(I honestly have no clue if this is feasable or not)

ben

Re: Under-voltage warnings

Posted: Sun Jul 20, 2014 10:02 pm
by dom
paulie wrote:For anyone running headless, is it worth writing these errors to e.g. /var/log/syslog ?
Perhaps a software switch to write/not write them to log file...
This particular scheme is running on the GPU, so not easy to add to /var/log/syslog.

However the GPIO is visible from the ARM (and events like a falling edge can be triggered), so an ARM app could be written to notify you through your favorite means.

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 9:41 am
by mahjongg
I would not recommend writing to the SD-card just when a brownout is happening, as it could strongly increase the chance of sd-card corruption!

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 10:13 am
by Burngate
dom wrote:The signal is also available on a gpio line (GPIO35).
Should I take this to mean that (on the Raspberry-Pi-B-Plus-V1.2-Schematics.pdf, top right) PWR_LOW_N also feeds GPIO35, which is set as an input?

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 10:33 am
by mikerr
I don't suppose it's possible to turn off the red power light by software is it ?

I ran my B+ undervoltage and quite liked the "stealth mode" with the red light off ;)

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 10:52 am
by dom
mikerr wrote:I don't suppose it's possible to turn off the red power light by software is it ?

I ran my B+ undervoltage and quite liked the "stealth mode" with the red light off ;)
Running something GPU heavy (like hello_triangle2) will make it more likely that the power light will go out.
It's a bit like a software switch...

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 10:55 am
by Burngate
mikerr wrote:I don't suppose it's possible to turn off the red power light by software is it ?
One of the things I might try when my + arrives - set GPIO35 to o/p, low

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 11:13 am
by hippy
mikerr wrote:I don't suppose it's possible to turn off the red power light by software is it ?
It should be looking at the circuit and knowing that it also connects to a GPIO line.

This mechanism could also be used to detect brownouts and then flash the LED continually until reset which might be helpful in some situations.

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 11:20 am
by MrEngman
Burngate wrote:
mikerr wrote:I don't suppose it's possible to turn off the red power light by software is it ?
One of the things I might try when my + arrives - set GPIO35 to o/p, low
Just what I was thinking. I think you are possibly correct in thinking signal POWER_LOW_N connects to GPIO35 set as an input otherwise how could the Pi determine power is low and display the icon indicating it is.

I think there should be no issue if GPIO35 is set as an output active low, not so sure though if it gets set high. Depends on whether there is a resistor between GPIO35 and signal POWER_LOW_N. I would expect there is but it's not shown on the schematic.



MrEngman

Re: Under-voltage warnings

Posted: Mon Jul 21, 2014 11:28 am
by Burngate
My reading of the info we've got is that it should be okay.
The APX803 can handle 20mA max according to its datasheet. If the GPIO is connected at the FET gate, the 470R will limit that to 7mA extra.

So we should be able to switch the LED on, even without power ... hang on ... err ...