Raspberry Pi lockup

From Noah.org
Jump to: navigation, search


LEDS

echo 1 > /sys/class/leds/led0/brightness
echo heartbeat > /sys/class/leds/led0/trigger

Turns off power LED (led1)

echo none > /sys/class/leds/led1/trigger
echo 0 > /sys/class/leds/led1/brightness

Turn off power LED at boot time. Put the following in /boot/config.txt (mount /dev/mmcblk0p1).

# Don't use the PWR LED (red led1).
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off

# Don't use the ACT LED (green led0).
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

To see what triggers are available for a given LED

cat /sys/class/leds/led1/trigger
cat /sys/class/leds/led0/trigger

Raspberry PI Lockup

Is your Raspberry Pi locking up when you try to boot? Does it sometimes just lockup after booting? Does it lockup when you plug in a USB WiFi device or USB camera? Does it lockup when you try to use one of these devices even after they are plugged in? All of these problems are most often caused by a problem in the USB power supply. The Raspberry Pi is very finicky when it comes to power. It is the most finicky USB powered device I have ever used.

I am using a Raspberry Pi 3 Model B (not the Raspberry Pi 3 Model B+). The problem I am seeing may have been fixed in the Raspberry Pi 3 Model B+ version, or maybe not. I have not tested it with the B+ model.

Don't assume boot parameters must be the problem

At first I thought it had something to do with dwc_otg.fiq_fix_enable=2 in my boot config, which does actually seem to be wrong, but is actually harmless. The MicroSD disk image I was using had it set to 2 by default. It should be 0 or 1 because those are the only values documented. Yes, I know 2 should be the same as 1 if the OS interprets this as a boolean stored in an integer, but why screw around and make people wonder if 2 implies something else? I can't find a value of 2 documented anywhere. When I finally noticed this error I thought "I found it!", but then I wonder why this disk image was apparently being used by so many people if this was a fatal error. Sure enough, fixing this parameter didn't help. I finally decided to stop looking for a problem in the disk image or boot parameters.

So ignore that distracting rant and read on...

You are using a crappy USB power supply or a marginal USB cable or a USB cable that is too long

It turned out that the problem was due to the USB cable I was using to power the Raspberry Pi 3 Model B. I seems that this makes a huge difference. I was actuallying using a very short cable (only 12 inches) and it looked beefy (can't trust looks). It seems that my crappy cable added too much resistance and so the voltage drop under heavy load was too much for the Raspberry Pi and it would just lock up during boot. The situation immediately improved after I simply changed the USB cable. After doing this the Raspberry Pi 3 model B would boot about 75% of the time (much better than 0%). And when I changed the power supply it would boot 100% of the time; although after booting to the desktop I would still get an occasional yellow lighting bolt warning flashing in the upper right corner of the desktop screen. This apparently indicates that power supply voltage is dangerously low. This would happen most often when I would plug in a USB device (especially a WiFi device or camera). Sometimes the Raspberry Pi would lock up when I activated the USB WiFi device through the OS. I finally found a power supply that claimed to be specifically designed for the Raspberry Pi featuring a beefy high power capacity, a very low resistance USB cable, and delivered slightly over spec for voltage (I guess that would make it out of USB spec, technically). That finally got rid of the lock up problems and yellow lightning bolt warnings for good. Well, mostly for good. When I fill all the USB port on the Raspberry Pi and power up a bunch of power hungry devices, and then set the CPU to a high processor load, then I have still seen rare lockups that I am pretty sure are due to power problems and not heat -- oh, yes, because the Raspberry Pi doesn't like to get too hot either! I don't overclock my CPU... But overheating should not cause the Raspberry Pi to lockup or freeze (ha! A pun! I meant to do that!). Overheating should only cause the system to slow down. The CPU and GPU should automatically throttle down their clocks until the temperature returns to a specified limit. I think you may be able to even circumvent this safety feature, but that may permanently set a warranty void flag in the CPU. I guess that would only help the vendor if you don't manage to completely destroy the CPU because how else are they going to read the flag if the chip is dead? For lots more info see Boot Configuration Overclocking.

So the Raspberry Pi is extremely sensitive to power supply voltage and current. I would not trust the Raspberry Pi 3 Model B to be reliable when powered through any given random USB port or cable. I would trust it to be reliable only with a USB power supply that claims to be specifically designed for the Raspberry Pi to account for these power issues.

Perhaps soldering in a high value capacitor across the power rail of the USB port might help account for voltage drop during moments of high power demand (such as when powering up a USB WiFi device or USB Camera). A web search shows that the capacitor marked C6 next to the micro-USB socket is responsible for smoothing the input power. It is specified as 220 μF with a voltage rating of 16V. Anything with a larger capacitance, the same or higher voltage rating should work. Look for a capacitor that claims to be low ESR; although, I doubt even a high ESR capacitor would really cause a problem. One might be tempted to use a super-capacitor or ultra-capacitor, but these might cause a significant delay in booting while a high ESR and high capacitance capacitor charges up, or if using a low ESR capacitor then it might make the USB hub think it has been shorted out. In theory an ultra low ESR ultra-capacitor could actually function as a sort of emergency power in case of total power loss, but you'd have to know what you are doing to limit power below USB specs during a first cold boot. You'll still have the problem of a slight or significant delay in power up.

Power Spikes trigger PTC fuses that are meant to protect the Raspberry Pi

A bit of web searching shows that another problem seems to be bad hubs passing power spikes that trip the PTC fuse protection. I am not sure, but I think if that were my problem then my Raspberry Pi would power cycle and reset. Instead, I've always had the Raspberry Pi lockup. That makes me suspect it's a problem with voltage drop under load, not power spikes triggering the PTC; although, I would have thought the CPU would also reset under a low voltage condition rather than locking up! I have not thoroughly investigated this problem... And I think that PTC protection devices are latching, so they don't reset themselves until the input power goes low for a specified period of time. Having an automatic reset after a power spike triggers a PTC would requires extra circuitry. This also dangerously assumes that the power supply spike that triggered the PTC was transient. If someone simply supplied the wrong voltage then then Raspberry Pi would sit there endlessly cycling power while attempting to boot. I think PTC devices have a limited trigger cycle life, but I am not sure if that would be a practical problem.