Schnoogle
Posts: 58
Joined: Sun Feb 11, 2018 4:47 pm

Low voltage detection, read voltage level

Thu Dec 20, 2018 8:14 am

Hi there,
I've seen in the linux device tree for RPi that the GPIO35 seem to indicate low voltage in case the RPi is driven by battery.
Is this GPIO also mapped to low voltage indication in baremetal?

If this is not the case, is there any way to detect voltage drops or to retrieve voltage levels the RPi is running with in baremetal?
I've seen some mailbox property messages with respect to voltage but I guess they are to retrieve and configure the voltage levels for different peripherals.

Any idea on how to retrieve this in bare metal would be much appreciated.

Thx in advance.
Br
Schnoogle

User avatar
Ultibo
Posts: 158
Joined: Wed Sep 30, 2015 10:29 am
Location: Australia
Contact: Website

Re: Low voltage detection, read voltage level

Thu Dec 20, 2018 9:30 am

Schnoogle wrote:
Thu Dec 20, 2018 8:14 am
Any idea on how to retrieve this in bare metal would be much appreciated.
Hey Schnoogle,

I'm not sure if the GPIO35 stuff is actually still valid, so far never found a way to make use of it for low voltage detection.

The current way that Raspbian does it seems to be by using a fairly recent mailbox function called RPI_FIRMWARE_GET_THROTTLED which returns a bitmask that indicates a number of things including whether an under voltage has occurred since startup and if an under voltage is occurring right now.

This is done by a driver whose name I cannot remember right now but if you grep the Raspbian source for RPI_FIRMWARE_GET_THROTTLED you should find the right one and the details of the various bits returned.

Hope that helps.
Ultibo.org | Make something amazing
https://ultibo.org

Threads, multi-core, OpenGL, Camera, FAT, NTFS, TCP/IP, USB and more in 3MB with 2 second boot!

Schnoogle
Posts: 58
Joined: Sun Feb 11, 2018 4:47 pm

Re: Low voltage detection, read voltage level

Fri Dec 21, 2018 5:19 pm

Hi Ultibo,

well thx for the reply. This seem to be what I was looking for. I'll try this.

BR
Schnoogle

Return to “Bare metal, Assembly language”