A Raspberry Pi running a camera and a USB disk reboots at random and the disk keeps dropping out, with nothing in the application logs. How do you check whether power is the cause?
answer
- the application never sees this
- ask the firmware, not the OS
- one mask, two halves
- now versus since boot
- volts under load, not amp rating
basics
~20 sRead the firmware's throttle flags with vcgencmd get_throttled and check the kernel log for under-voltage messages. The bitmask separates a current problem from one that has occurred since boot, and distinguishes low voltage from thermal throttling.
solid answer
~50 sAsk the firmware, not the application. `vcgencmd get_throttled` returns a hex bitmask: the low bits report what is happening *right now* — under-voltage detected, ARM frequency capped, currently throttled, soft temperature limit active — and bits 16 upward are sticky, meaning the same conditions have occurred at any point since boot. So `throttled=0x0` after a week of uptime clears power, and `0x50000` tells you it happened earlier even though things look fine now. Cross-check `dmesg` or the journal for the kernel's under-voltage messages, and run `vcgencmd measure_temp` to separate a power problem from thermal throttling, which starts around 80 °C and hard-caps near 85 °C. The usual root cause is not the supply's amp rating but voltage sag: a thin or long USB cable, a marginal phone charger, or peripherals drawing through the board. Powered hubs and an adequately specified supply fix it.
code
bash · 4 linesvcgencmd get_throttled
vcgencmd measure_temp
vcgencmd measure_volts core
dmesg | grep -i voltagego deeper
Know that the board reports power problems itself: run vcgencmd get_throttled, and treat a non-zero result as a real hardware condition rather than an application bug.
Explain the bitmask: low bits are the current state, bits 16 and above are sticky since boot, and they cover under-voltage, frequency capping, throttling and the soft temperature limit. Know that a reboot clears the sticky half.
Show a diagnostic sequence: capture the sticky bits before restarting, correlate kernel under-voltage entries with reboot timestamps, rule out thermal throttling with a temperature reading, then change the electrical setup and prove the bits stay clear through a full load cycle.
Own the deployment standard — specify supply, cable and peripheral powering as part of the build, and export the throttle flags into fleet monitoring so power degradation is a tracked signal rather than a field mystery that gets misattributed to software.
## Why the application logs are empty The symptom set — spontaneous reboots, USB devices disappearing and reappearing, SD card read errors, a board that feels sluggish under load — has one thing in common: none of it is the application's doing, so nothing appears in its log. Undervoltage on a small board is a *hardware* condition that the firmware detects and reports through its own channel, and if you do not know where that channel is you can spend days blaming software. ## The throttle bitmask The firmware exposes the condition through `vcgencmd get_throttled`, which prints something like `throttled=0x50005`. It is a bitmask with two halves: - **Bits 0–3 — happening now.** Bit 0: under-voltage detected. Bit 1: ARM frequency capped. Bit 2: currently throttled. Bit 3: soft temperature limit active. - **Bits 16–19 — has occurred since boot.** The same four conditions, sticky. Bit 16: under-voltage has occurred. Bit 17: ARM frequency capping has occurred. Bit 18: throttling has occurred. Bit 19: soft temperature limit has occurred. That split is the whole diagnostic value. A board being interviewed at a calm moment reports `0x0` in the low bits while the high bits still testify to what happened during last night's load spike. `throttled=0x0` on a machine with meaningful uptime is a genuine all-clear; anything with bit 16 set is a power problem regardless of how healthy it looks right now. ```bash vcgencmd get_throttled # e.g. throttled=0x50005 vcgencmd measure_temp # SoC temperature vcgencmd measure_volts core dmesg | grep -i voltage ``` The kernel also logs under-voltage events, so the journal carries a timestamped history you can line up against your reboots — far more useful than a single instantaneous reading. On a desktop session the same condition draws a lightning-bolt indicator on screen. ## Under-voltage is not the same as thermal throttling Both reduce performance and both set bits in the same mask, but the fixes are opposite. Thermal throttling begins when the SoC approaches roughly 80 °C, with a hard cap near 85 °C; the answer is airflow, a heatsink or a case with a fan. Under-voltage means the 5 V rail has sagged below the firmware's threshold; the answer is electrical. Check `measure_temp` before you buy a fan for a problem that was a cable. ## Why the supply's amp rating misleads people The most common wrong conclusion is "I'm using a 3 A supply, so it can't be power." Undervoltage is about *volts under load*, not the label on the brick. Three things cause a supply that is nominally adequate to sag: - **Cable resistance.** A long, thin USB cable — especially one sold for charging rather than power delivery — drops a meaningful fraction of a volt at 2 A. The supply is fine; the voltage arriving at the board is not. - **Transient draw.** A camera starting up, a spinning disk seeking, or a Wi-Fi transmit burst pulls current in short spikes. A supply that holds 5 V at steady state may dip below threshold for milliseconds, which is enough for the firmware to flag it and enough to knock a USB device off the bus. - **Peripherals powered through the board.** Bus-powered disks and hubs pull their current through the Pi's own regulator and connector. That is what a powered hub or a self-powered enclosure is for. On the Raspberry Pi 5 there is an extra wrinkle worth knowing: the board negotiates over USB Power Delivery, and with a supply that cannot deliver the higher current it restricts the total current available to downstream USB peripherals. A board that runs a bare workload fine but cannot keep a disk alive is exactly that scenario. ## The shape of a good answer An interviewer asking this is checking whether you reach for platform-specific evidence before rewriting code. The strong answer is a sequence: read the sticky throttle bits, correlate the kernel's under-voltage log entries with the reboot times, check the temperature to rule out the other cause, and only then change the electrical setup — a known-good supply, a short thick cable, peripherals on their own power — and re-check that the sticky bits stay clear over a full load cycle. Fixing it and *proving* it stayed fixed with the same bitmask is what separates a real diagnosis from a guess that happened to coincide with a quiet week.
- get_throttled reports 0x50000 but the board looks completely healthy. What do you conclude?Only the sticky bits are set — bit 16 (under-voltage has occurred) and bit 18 (throttling has occurred) — while the low bits are clear, so the board is fine at this instant but was not earlier. That is exactly the evidence you want when the failure is intermittent: correlate the kernel's under-voltage log entries with the reboot times. Reboot clears the sticky bits, so read them before restarting.
- How do you tell under-voltage apart from thermal throttling, and why does it matter?Check `vcgencmd measure_temp` alongside the mask. Thermal throttling starts as the SoC approaches roughly 80 °C with a hard cap near 85 °C and is fixed with a heatsink, a fan or better airflow. Under-voltage means the 5 V rail sagged, and is fixed electrically — better supply, shorter and thicker cable, peripherals on their own power. Both slow the board down, so treating one as the other wastes the fix.
- Why can a 3 A supply still cause under-voltage?Because the flag is about the voltage arriving at the board under load, not the current the supply could theoretically deliver. A long thin cable drops several hundred millivolts at load; transient draws from a camera, a disk seek or a Wi-Fi burst dip the rail for milliseconds; and bus-powered peripherals pull their current through the Pi's own connector and regulator. Short thick cable, adequate supply, externally powered peripherals.
saying these in an interview costs you the question
- My supply is rated 3 A so it cannot be power
- Random reboots mean the SD card is dying
- get_throttled returning zero proves it never happened
- Undervoltage and overheating are the same condition
- A USB phone charger is equivalent to a proper supply