-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Proper way to get voltage and log VALUES into dmesg #5584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The log message was originally triggered from the output of an APX803-46SAG microprocessor supervisor chip, not a direct voltage sampling, therefore it was not possible to report an exact voltage. It detects even very brief brown-out conditions though. IIRC that was introduced on the Pi3B. The 5V rail is browning out below 4.6V as measured at the Pi. The voltage supplied to USB peripherals is therefore going to be dropping below that, which is outside of the USB spec of 5V +/-5% (ie 4.75 - 5.25V), hence warning as USB devices are likely to malfunction. |
From the code we clearly can see it's a matter of changing the message and value is there. But the main point was I'm running Pi4 connected to DC UPS with cheap USB multimeter in the middle to always read current and voltage. And voltage is never falls below 5.35V. So either multimeter is lying or hwmon lying. Undervoltage also happens with USB stick (1W) |
There is no voltage value in the code, it just reads bit state from controller and if bit is triggered it write message to the log. That's it. So, it works as expected. I think CPU doesn't have access to +5V power line and cannot measure it.
That's incorrect way to measure voltage, because you're don't take into account voltage drop on your USB cable. In many case the reason for undervoltage is a cheap USB cable which cannot handle high current. I recommend to use USB cable rated for at least 2.4 Amps. The proper way to measure voltage is to connect your DMM to pins +5V and GND on RPI GPIO header. But be careful, because there is 3V pin near 5V, if you accidentally short +5V and +3V it can lead to RPI damage. It's better to connect DMM with reliable wires when RPI is powered off to avoid accidental shortening during connection. |
Please enlighten us as to where? A multimeter won't pick up momentary dropouts due to bad regulation in the supply. |
According to my measurements, under-voltage bit is set when voltage drops below 4.4372 V. Just don't allow voltage to drop below 4.5 V |
Thanks, this makes complete sense now, i think everything said should be documented because the issue is super common. |
https://www.raspberrypi.com/documentation/computers/compute-module.html#under-voltage-detection The spec sheet for APX803 lists the trigger threshold voltage to be +/-1.5% (4.6V +/-0.69V), hysteresis to be 0.01Vth (4.64V), and will trigger on a drop within 20usecs. I would therefore treat 4.6V to be an absolute minimum, and get a decent power supply and supply cables. |
yes, 4.6 V is the minimum, because with 4.5V under-voltage bit may never be cleared, because it is cleared at 4.566 V. |
Describe the bug
https://github.com/raspberrypi/linux/blob/rpi-6.1.y/drivers/hwmon/raspberrypi-hwmon.c#L52
When diagnosing the problem with voltage this message doesn't make much sense when reading dmesg. We need to read the voltage value, not meaningless junk!!! Also what about overvoltage?
Also we need to read voltage from lm-sensors, not this:
Steps to reproduce the behaviour
Attach the USB SSD drive and write large files, undervoltage happens
Device (s)
Raspberry Pi 4 Mod. B
System
DietPi actual
vcgencmd version
Mar 17 2023 10:50:56
Copyright (c) 2012 Broadcom
version 82f3750a65fadae9a38077e3c2e217ad158c8d54 (clean) (release) (start_cd)
Linux DietPi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
Logs
Additional context
No response
The text was updated successfully, but these errors were encountered: