MrEngman
Posts: 3779
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Under-voltage warnings

Mon Jul 21, 2014 11:51 am

My concern was if GPIO35 was connected directly to the FET gate and it was set high, not that there was a problem with the connection to the APX803, as you say there is the 470R resistor which takes care of that. It's just that I have no clue how FETs work so I'm not sure what happens if you connect it directly to a GPIO output that is set high with no resistor in the way. I would expect there is one but there's nothing on the schematic re GPIO35 to show there is.


MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

User avatar
[email protected]
Posts: 2014
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Under-voltage warnings

Mon Jul 21, 2014 12:12 pm

Tried to write a little program to use the wiringPi ISR function on it, so I could log brown-outs, but it's not working )-:

I can poll for the pin change and that works fine:

Code: Select all

[email protected] ~/wiringPi/examples $ while true; do echo -n "`gpio -g read 35`" ; done
000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000^C
(yes, I'm doing something to deliberately trip low-power - don't ask)

but my little test program isn't picking it up.

I'm wondering if something in the kernel isn't passing interrupts back to userland on the 2nd bank of gpio pins?

The program is:

Code: Select all

#include <stdio.h>
#include <time.h>
#include <wiringPi.h>


#define LOW_POWER       35

/*
 * lowPower:
 *      This is an ISR that waits for the low-power signal going low and
 *      prints the result.
 *********************************************************************************
 */

void lowPower (void)
{
  time_t t ;

  time (&t) ;
  printf ("%s: LOW POWER DETECTED\n", ctime (&t)) ;
}


/*
 *********************************************************************************
 * main
 *********************************************************************************
 */

int main (void)
{
  wiringPiSetupSys () ; 

  wiringPiISR (LOW_POWER, INT_EDGE_FALLING, &lowPower) ;

  for (;;)
    delay (1000) ;

  return 0 ;
}
It works fine is I use pin 17 then toggle it using gpio -g mode 17 up ; gpio -g mode 17 down (uses the internal pull-up/down to trigger the interrupt)

The B+ has the latest kernel/firmware from apt-get update/upgrade rather than rpi-update if that makes a difference.

-Gordon
--
Gordons projects: https://projects.drogon.net/

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5230
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Under-voltage warnings

Mon Jul 21, 2014 12:16 pm

I've checked with James Adams, and he says setting GPIO35 to an output and driving it low or high is supported.

MrEngman
Posts: 3779
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Under-voltage warnings

Mon Jul 21, 2014 12:34 pm

dom wrote:I've checked with James Adams, and he says setting GPIO35 to an output and driving it low or high is supported.
Thanks Dom, that clears that point then.



MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

notro
Posts: 695
Joined: Tue Oct 16, 2012 6:21 pm
Location: Drammen, Norway

Re: Under-voltage warnings

Mon Jul 21, 2014 1:37 pm

It would be nice if a watchdog driver could notify these events to the kernel message log:

Code: Select all

watchdog: Power supply under-voltage detected
watchdog: Power supply voltage is back to normal
watchdog_device has a status property that can include info about under-voltage: WDIOF_POWERUNDER
We could also (mis)use the bootstatus property to indicate that an under-voltage event has taken place during this runtime.

Userspace API: https://www.kernel.org/doc/Documentatio ... og-api.txt
Kernel API: https://www.kernel.org/doc/Documentatio ... el-api.txt

Maybe the driver also could stall flushing to disk while under-voltage? Don't know if that is possible though.

rotwang
Posts: 243
Joined: Sat Dec 07, 2013 1:12 pm

Re: Under-voltage warnings

Mon Jul 21, 2014 6:28 pm

Is GPIO35 broken out on a B+? Doesn't seem to be from the reduced schematic. Does the same thing happen with the Compute Module, where GPIO35 IS broken out?, and should it therefore be documented.

User avatar
[email protected]
Posts: 2014
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Under-voltage warnings

Mon Jul 21, 2014 6:42 pm

rotwang wrote:Is GPIO35 broken out on a B+? Doesn't seem to be from the reduced schematic. Does the same thing happen with the Compute Module, where GPIO35 IS broken out?, and should it therefore be documented.
The compute module doesn't have the low-power detection circuit - on the CM, gpio 35 is just another gpio.

The B+ does use some of the otherwise unused GPIOs for it's own uses - I suspect its just going to be a matter of time until the foundation can finish the documentation on them all.

I think we have all the documentation for the CM though - probably because there's really not much to document!

-Gordon
--
Gordons projects: https://projects.drogon.net/

boyoh
Posts: 1263
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Under-voltage warnings

Mon Jul 21, 2014 11:00 pm

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.

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.

Reading these post on" Under-Voltage Warnings" is very interesting
But there is a lot of " IFF's or Butts " in some of the posts.
Detecting under voltage in critical situations ,and correcting it is
very important, That's when stand by power supply's kick in.
So having Having no back up, is not the answer to the problem

Using a Pi in a remote situation , un-attended showing a warning
signal, with out back-up, is not a very good idea,
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

drgeoff
Posts: 9205
Joined: Wed Jan 25, 2012 6:39 pm

Re: Under-voltage warnings

Mon Jul 21, 2014 11:27 pm

To be fair I think the main intention was to help the troubleshooting of power supply problems. Other uses such as enabling backup supplies, holding off SD card writes etc are possible bonuses.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Under-voltage warnings

Mon Jul 28, 2014 10:20 pm

dom wrote:I've checked with James Adams, and he says setting GPIO35 to an output and driving it low or high is supported.
Groovy 8-)

Code: Select all

$ echo 35 | sudo tee /sys/class/gpio/export
35
$ echo out | sudo tee /sys/class/gpio/gpio35/direction
out
$ echo 1 | sudo tee /sys/class/gpio/gpio35/value
1
$ echo 0 | sudo tee /sys/class/gpio/gpio35/value
0
$ echo 1 | sudo tee /sys/class/gpio/gpio35/value
1

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 21884
Joined: Sat Jul 30, 2011 7:41 pm

Re: Under-voltage warnings

Tue Jul 29, 2014 7:41 am

boyoh wrote:
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.

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.

Reading these post on" Under-Voltage Warnings" is very interesting
But there is a lot of " IFF's or Butts " in some of the posts.
Detecting under voltage in critical situations ,and correcting it is
very important, That's when stand by power supply's kick in.
So having Having no back up, is not the answer to the problem

Using a Pi in a remote situation , un-attended showing a warning
signal, with out back-up, is not a very good idea,

If you are using a Raspi in a critical situation, with possible power issues, then the Pi itself it not the best way of handling the problem - you need a UPS. This warning stuff is irrelevant to that situation and is for attended power issue debugging during setup, rather than ongoing usage.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

ivoangelico
Posts: 1
Joined: Mon Aug 04, 2014 11:41 am

Re: Under-voltage warnings

Mon Aug 04, 2014 2:56 pm

drgeoff wrote:To be fair I think the main intention was to help the troubleshooting of power supply problems. Other uses such as enabling backup supplies, holding off SD card writes etc are possible bonuses.
How can we hold off SD card writes? :)

Gadgetguy
Posts: 93
Joined: Fri Aug 15, 2014 2:55 am

Re: Under-voltage warnings

Fri Aug 15, 2014 3:06 am

Perhaps posting my small frustrating problem with low voltage shutdowns on the new Pi B+ model may elicit a response that will help not only me, but others with such problems.
My original model Raspberry Pi B has run Openelec with no low voltage problems for nearly a year. I use two well reviewed , stable power supplies, the ne plus ultra - Adafruit 5.25 v 1a, and a Belarc 5v 2a . I have been using on the original Pi B with no problems, the Milhouse test builds of OE that have optimized and enhanced performance of Openelec up to the very latest August release.
I recently acquired a Pi B+ ( I do like the small footprint and extra usb! ).I should emphasize that my new B+ does run Noobs 1.39 loaded with both Raspbian and Openelec official releases 4.05 (and upgraded to 4.07) with no apparent problem with either power supply and even with usb ports loaded with flash drives ,a wireless mouse and keyboard and even wi fi adapter. The new Pi B+ also runs stand alone versions of not only openelec official releases up to the latest 4.07 official release but also standalone and noobs versions of openelec Milhouse test builds of OE up to and including the July 19th release (build #0719). However the moment I upgrade to subsequent Milhouse builds my PI B+ model (but not original pi) flashes the rainbow pixel low voltage warning and ceases to operate. In release notes Milhouse states the July 24th builds #0724 and later incorporate new firmware that give a low voltage warning and refers to the following discussion thread in this forum on under voltage warnings : http://www.raspberrypi.org/forums/viewt ... 98#p582098.
So it seems clear to me that up untill this new firmware I had no undervoltage problems in either the pi B or the pi B+ or in the unlikely event I did they were not sufficient to prevent it running normally. Therefore either my Pi B+ is defective or there is something in this new firmware or its implementation in the Milhouse build of OE that must not only be triggering a low voltage warning but also causing an under voltage problem in the PI B+ . I should point out that the B+ will not load these new firmware builds of openelec even with empty usb ports. I will also note that I tried without success inserting " avoid_warnings=1 " in config.txt Obviously I would like to run the latest versions of Milhouse openelec builds and any other applications that use the new firmware with undervoltage warning. I am almost a total "noob" with linux and know nothing about computer architecture,electricity or programming so the less technical the response the better.Help?!

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Under-voltage warnings

Fri Aug 15, 2014 9:39 am

Gadgetguy wrote:So it seems clear to me that up untill this new firmware I had no undervoltage problems in either the pi B or the pi B+ or in the unlikely event I did they were not sufficient to prevent it running normally. Therefore either my Pi B+ is defective or there is something in this new firmware or its implementation in the Milhouse build of OE that must not only be triggering a low voltage warning but also causing an under voltage problem in the PI B+ .
Nope, that is not a logical conclusion. If you use the older build, does the red LED on the board remain constantly on all the time, even when booting or playing movies?

Gadgetguy
Posts: 93
Joined: Fri Aug 15, 2014 2:55 am

Re: Under-voltage warnings

Fri Aug 15, 2014 12:31 pm

by ShiftPlusOne wrote:


.

Nope, that is not a logical conclusion. If you use the older build, does the red LED on the board remain constantly on all the time, even when booting or playing movies?


Thank you for you response. I am afraid I need to be castigated for not taking the time to learn the intricacies of the diagnostic leds. However here is my observation : on my original Pi B running a pre " low voltage warning " firmware of Openelec (Milhouse July 19 build) installed on a " noobs 1.39 " the red led remains steady playing movies etc, and of the two green leds one is steady and the other flickers. Using the same sd on my new Pi B+ while everything seems to run fine no AV sync problems etc., the red led flickers - it is usually off but occasionally flickers on, and both green leds flicker. The case on my new Pi B+ is no longer transparent and led visibility is less than perfect. I reiterate both aforementioned power supplies have received excellent reviews for usage with the Pi.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Under-voltage warnings

Fri Aug 15, 2014 12:37 pm

Gadgetguy wrote: Thank you for you response. I am afraid I need to be castigated for not taking the time to learn the intricacies of the diagnostic leds. However here is my observation : on my original Pi B running a pre " low voltage warning " firmware of Openelec (Milhouse July 19 build) installed on a " noobs 1.39 " the red led remains steady playing movies etc, and of the two green leds one is steady and the other flickers. Using the same sd on my new Pi B+ while everything seems to run fine no AV sync problems etc., the red led flickers - it is usually off but occasionally flickers on, and both green leds flicker. The case on my new Pi B+ is no longer transparent and led visibility is less than perfect. I reiterate both aforementioned power supplies have received excellent reviews for usage with the Pi.
The regular B does not have undervoltage detection, so it's no surprise that the red LED is constantly on on the B, but flickers on the B+.

On a B+, if the red led goes off, that means the voltage has dropped below 4.6V, which is bad.

It does not matter what the reviews are, since you otherwise. We don't have to blame the power supply straight away, as the cable from the supply to the pi can make a massive difference. Is this cable easy to unplug and replace or is it permanently attached?

Gadgetguy
Posts: 93
Joined: Fri Aug 15, 2014 2:55 am

Re: Under-voltage warnings

Fri Aug 15, 2014 2:28 pm

ShiftPlusOne wrote:

The regular B does not have undervoltage detection, so it's no surprise that the red LED is constantly on on the B, but flickers on the B+.

On a B+, if the red led goes off, that means the voltage has dropped below 4.6V, which is bad.

It does not matter what the reviews are, since you otherwise. We don't have to blame the power supply straight away, as the cable from the supply to the pi can make a massive difference. Is this cable easy to unplug and replace or is it permanently attached?

Again, thanks for your speedy reply and Eureka and congratulations!- you nailed the problem! Both power supplies - the Belkin slim port usb hub 5v 2a and the adafruit 5.25v 1a- have usb slots so it was easy to switch the usb power cable and when I did the red power led was rock solid so I took a leap of faith and successfully upgraded my Openelec to the latest Milhouse build with the undevoltage warning firmware and it ran without a hitch.While I had previously read and was aware that the usb power cables could make a difference I had used both cables successfully on both pi's until the latest firmware with under voltage warning and had assumed they were ok. It is probably useful to note that the usb cable that worked was the Samsung cable that came with my phone, whereas the one that failed to transmit sufficient voltage was a generic that I had purchased in a local dollar store.
However this experience seems to emphasize that when using operating systems that incorporate the new firmware with low voltage warning that the new B+ model will be less tolerant of low voltage than the original model B. Perhaps the importance of not only power supplies but also usb cables should be re-emphasized to users of the new B+, who I have noted have been reporting boot and usb problems . Perhaps a database of " good " cables can be added to the RPI Linux hardware site.
Since this undervoltage problem did not manifest itself in an obvious way to us dullards who ignore flickering leds is there a way to circumvent not only the warning pixel but also the subsequent shutdown? Why did the B+ not shutdown with the pre-warning builds? Note I tried without success inserting " avoid_warnings=1 " in config.txt Does it harm the Pi to run it undervoltage? Thanks again for your incisive insights and quick solution to my problem. Hopefully airing this minor hiccup will be useful to others.

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5607
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Under-voltage warnings

Fri Aug 15, 2014 2:48 pm

Excellent, glad I could help.
Gadgetguy wrote:However this experience seems to emphasize that when using operating systems that incorporate the new firmware with low voltage warning that the new B+ model will be less tolerant of low voltage than the original model B.
Not necessairly. It's not a matter of being more or less tolerant of low voltages. The pi requires 5v PERIOD. If your particular B continued to work at a low voltage, that's not a good thing. It just means it was waiting to crash at the most inconvenient time.
Gadgetguy wrote:Perhaps the importance of not only power supplies but also usb cables should be re-emphasized to users of the new B+, who I have noted have been reporting boot and usb problems .
It's one of the first things I advise people to check when they're having pi problems. However, the USB problems people report are much more likely to be caused by out of date firmware.
Gadgetguy wrote:Perhaps a database of " good " cables can be added to the RPI Linux hardware site.
These lists are terrible. If such a list existed and you wanted to contribute to it, it's likely that a week ago you would've put your 'bad' cable down as 'good'. People also tend to misappropriate blame and are likely to say a good cable is bad. Just take a look at the working/non-working sd card list... It's not accurate at all. The rule of thumb is that if you bought the cheapest thing on ebay or from poundland... it just can't be good. Copper costs money, so they just make the wire itself very thin and use thicker plastic, to give the impression of quality.

The sure way to get a supply and cable that's good enough is to buy something like this http://swag.raspberrypi.org/products/ra ... wer-supply
Pimoroni and adafruit are also good places to buy pi stuff from.
Gadgetguy wrote:Since this undervoltage problem did not manifest itself in an obvious way to us dullards who ignore flickering leds is there a way to circumvent not only the warning pixel but also the subsequent shutdown? Why did the B+ not shutdown with the pre-warning builds? Note I tried without success inserting " avoid_warnings=1 " in config.txt Does it harm the Pi to run it undervoltage?
Why would you want to circumvent it? It's there for a reason. The pi did not shut down before because operating on low voltages gives very unpredictable behaviour. Expect network trouble, random freezing, resetting, poor performance and sd corruption and everything in between. It's not bad for the pi itself, it's just bad in general.

Mr.blinky
Posts: 1
Joined: Sat Sep 13, 2014 2:25 am

Re: Under-voltage warnings

Sat Sep 13, 2014 3:06 am

Just got my RPi B+ about a week ago and running it 24/7 headless since then. Would be great if the bright power LED off could be turned off. Reading the above posts I had a look at the schematic and the APX803 datasheet and realized it is doable. So there's a first project :D
Here are some python scripts I wrote to turn the power LED off and on again: https://github.com/MrBlinky/Raspberry-Pi-Power-LED Make sure you run them from the terminal with superuser rights.

grant_bailey
Posts: 1
Joined: Mon Nov 10, 2014 3:45 am

Re: Under-voltage warnings

Mon Nov 10, 2014 3:50 am

Don,

Would you mind suggesting a means of having the Pi report a low-voltage problem for users who don't use the GUI. I'm not a Linux guru by any means!

Many thanks,

Grant Bailey

abramq
Posts: 83
Joined: Sat Jul 26, 2014 10:47 pm

Re: Under-voltage warnings

Mon Nov 10, 2014 8:04 am

Helo,
Hope this is the right place for my question.
I finally connected my external HDD (with config.txt modified for 1.2A) but there seems to be a problem with voltage - when I write files to that external HDD a little rainbow square is displayed next to clock (I use xbmc distro).
I don't know why, I use good 5V 2A supply...
Doest that rainbow square means that something coud damage my Pi B+ ?

Greetings!

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5230
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Under-voltage warnings

Mon Nov 10, 2014 11:46 am

abramq wrote:Doest that rainbow square means that something coud damage my Pi B+ ?
Not really. But it does mean the voltage is out of spec, and crashes or disk corruption could be possible.
I suspect the hard disk is consuming significant current, and your power supply is not sufficient.

User avatar
joan
Posts: 13871
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Under-voltage warnings

Sun Dec 14, 2014 9:58 am

Is there any power warning for a non B+? I've seen one report of a red/orange warning on the top right of a screen connected to an ordinary B. Is this erroneous?

User avatar
Burngate
Posts: 5836
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Under-voltage warnings

Sun Dec 14, 2014 12:26 pm

It has to be erroneous. Either:
- The poster got it wrong
- The software driving the top-right flag got it wrong
- GPIO 35 is wrongly set to out and being driven low, has its Pull-Up_Down set to down, or configured to ALT0 (spi0-ce1) or ALT1 (SWE_N/SRW_N whatever that is)
Other than on B+ or A+ there's no connection to GPIO 35
EDIT: 4th option: I've got it wrong :(
Last edited by Burngate on Sun Dec 14, 2014 5:38 pm, edited 1 time in total.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5230
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Under-voltage warnings

Sun Dec 14, 2014 1:52 pm

joan wrote:Is there any power warning for a non B+? I've seen one report of a red/orange warning on the top right of a screen connected to an ordinary B. Is this erroneous?
The red warning is over-temperature as does work on a model B. It means the chip has reached 85'C (and overclock has been disabled).
Try locating the Pi elsewhere (e.g. not on top of a receiver that generates a lot of heat), ensuring case has ventilation, or mounting the Pi vertically.

Return to “Advanced users”