How to read RTC battery voltage on Jetson Orin Nano under Ubuntu?

Hi NVIDIA team,

I’m using a Jetson Orin Nano on Ubuntu and want to read the RTC battery voltage.

I couldn’t find a direct way. Could anyone advise:

  1. Is there a sysfs path or driver to read it?
  2. If only via PMIC I2C, which registers to read?
  3. Any example commands or scripts to show the voltage in volts?

Thank you.

*** Please note that this reply is generated by LLM automatically ***

To read the RTC battery voltage on a Jetson Orin Nano, you can use the sysfs interface to access the power monitor’s data. The Jetson Orin NX series and Jetson Orin Nano series modules have a 3-channel INA3221 power monitor at the 0x40 I2C address.

You can find the sysfs nodes to read for rail names, voltage, current, and the instantaneous and average current limit at:

/sys/bus/i2c/drivers/ina3221/1-0040/hwmon/hwmon<x>

Where <x> and <y> are dynamic hwmon indexes.

To read the RTC battery voltage, you need to find the correct rail name and then read the corresponding voltage value. You can list the available rails and their corresponding voltage values using the following command:

ls /sys/bus/i2c/drivers/ina3221/1-0040/hwmon/hwmon<x>/ | grep voltage

Replace <x> with the actual hwmon index.

Once you find the correct rail name, you can read the voltage value using the following command:

cat /sys/bus/i2c/drivers/ina3221/1-0040/hwmon/hwmon<x>/voltage_<rail_name>

Replace <x> with the actual hwmon index and <rail_name> with the actual rail name.

For example, if the RTC battery voltage is available on rail “VDD_RTC”, you can read the voltage value using the following command:

cat /sys/bus/i2c/drivers/ina3221/1-0040/hwmon/hwmon<x>/voltage_VDD_RTC

This will give you the voltage value in millivolts. To convert it to volts, you can divide the value by 1000.

Alternatively, you can use a script to read the voltage value and convert it to volts. Here is an example script:

#!/bin/bash

# Find the correct hwmon index
hwmon_index=$(ls /sys/bus/i2c/drivers/ina3221/1-0040/hwmon/ | grep hwmon)

# Find the correct rail name
rail_name="VDD_RTC"

# Read the voltage value
voltage_mv=$(cat /sys/bus/i2c/drivers/ina3221/1-0040/hwmon/$hwmon_index/voltage_$rail_name)

# Convert the voltage value to volts
voltage_v=$(echo "scale=2; $voltage_mv / 1000" | bc)

echo "RTC battery voltage: $voltage_v V"

Make sure to replace the <x> and <rail_name> placeholders with the actual values.

Note that the above script assumes that the RTC battery voltage is available on rail “VDD_RTC”. You may need to modify the script to match the actual rail name on your system.

If you prefer to use the PMIC I2C interface to read the voltage value, you can use the i2cget command to read the corresponding register value. However, this approach requires more knowledge of the PMIC’s register layout and may be more complex.

I hope this helps! Let me know if you have any further questions.

*** Please give the thumbs up if you get answers you like. Or provide feedback to help us improve the answer. ***

I checked /sys/bus/i2c/drivers/ina3221/1-0040/hwmon/hwmon<x> but couldn’t find any voltage files.

PMIC_BBAT (RTC battery voltage) is not connected to ADC/INA3221 and so voltage cannot be monitored/read.

1 Like