USB-PD Interface Monitoring

Modified on Fri, 14 Nov at 2:12 PM

TABLE OF CONTENTS

Overview

The Cardshark’s USB-PD interface allows the system to monitor power delivery parameters through sensor readings provided by a hardware monitoring (hwmon) driver. Once the TPS25762 driver is loaded via jetpack-tools, it creates a hwmon device under the sysfs hierarchy. Note that the specific hwmon device (e.g., hwmon3) may vary between systems.
Identifying the Correct hwmon Device

To determine which hwmon device corresponds to the USB-PD interface, list the devices under /sys/class/hwmon:

ls -l /sys/class/hwmon


A typical output might be:

lrwxrwxrwx 1 root root 0 Feb 19 10:23 hwmon0 -> ../../devices/platform/pwm-fan/hwmon/hwmon0
lrwxrwxrwx 1 root root 0 Feb 19 10:23 hwmon1 -> ../../devices/platform/bus@0/c240000.i2c/i2c-1/1-0040/hwmon/hwmon1
lrwxrwxrwx 1 root root 0 Feb 19 10:23 hwmon2 -> ../../devices/platform/bus@0/39c0000.tachometer/hwmon/hwmon2
lrwxrwxrwx 1 root root 0 Feb 19 10:23 hwmon3 -> ../../devices/platform/bus@0/c240000.i2c/i2c-1/1-0022/hwmon/hwmon3
lrwxrwxrwx 1 root root 0 Feb 19 10:23 hwmon4 -> ../../devices/platform/soctherm-oc-event/hwmon/hwmon4


The correct device for the USB-PD interface is the one that resolves to a path similar to:

../../devices/platform/bus@0/c240000.i2c/i2c-1/1-0022/hwmon/...

Remember, the hwmon number (for example, hwmon3) may differ on your system.


Accessing Sensor Data

To view the sensor data, you use commands to view their contents such as:

cat /sys/class/hwmon/hwmon3/curr1_input
cat /sys/class/hwmon/hwmon3/curr1_label
cat /sys/class/hwmon/hwmon3/in0_input
cat /sys/class/hwmon/hwmon3/in0_label
cat /sys/class/hwmon/hwmon3/in1_input
cat /sys/class/hwmon/hwmon3/in1_label


Sensor Data Files

Within the correct hwmon device directory (e.g., /sys/class/hwmon/hwmon3), you will typically find the following files:

  • curr1_input: Contains the raw current sensor reading (e.g., 184).
  • curr1_label: Provides the label for the current sensor (e.g., “Vbus”).
  • in0_input: Contains the raw reading for the first voltage sensor (e.g., 5096).
  • in0_label: Provides the label for the first voltage sensor (e.g., “Vbus”).
  • in1_input: Contains the raw reading for the second voltage sensor (e.g., 16320).
  • in1_label: Provides the label for the second voltage sensor (e.g., “Vin”).


Interpretation

Files ending with *_input provide the numeric sensor readings (such as voltage in millivolts or current in milliamps), while the corresponding *_label files offer descriptive names for the sensors. In this example:

  • The current sensor reads 184 and is labeled Vbus.
  • The first voltage sensor reads 5096 and is labeled Vbus.
  • The second voltage sensor reads 16320 and is labeled Vin.
  • These readings help monitor the USB-PD interface’s power conditions on the Cardshark.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article