raspberrypi / utils

A collection of scripts and simple applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to read values from ADCs with pinctrl?

rafael2k opened this issue · comments

I realize that with vcgencmd I can read some ADC values in the Pi 5. Can the same be done through pinctrl?

Rafael, the short answer is no. The slightly longer answer is no and, even if you could, it wouldn't be of much use unless you want to monitor VBUS because they are dedicated pins on RP1 (you can't enable ADC on regular GPIOs) and the Pi 5 board design doesn't make the spare channels available.

If you are still curious, the ADC values can be read from sysfs:

$ grep . /sys/class/hwmon/hwmon1/in*_input

Thanks @pelwell! Among these 4 ADC inputs, are any of those available to the outside world (even if it involves reworking in the board - for experimentation purposes)?

Define available.

Some pin in RP1 I can tap / solder to outside the chip.

The unused channels will be totally unconnected - just balls on the bottom of the chip. The used channels have pull-up and pull-down resistors that would have to be located and removed - I have schematics, but not the layout.

Thanks @pelwell! Are these docs public - RP1 layout, and the board schematics?

No they aren't.

OK. So by balls on the bottom of the chip it means no connection pads of the chip expose the signals, right?

I believe that is the case. The bottom of the board under RP1 is so congested that it would be counterproductive to connect any "pins" that aren't needed.

Where can I find the list of the the used ADC channels? Are they all listed in "vcgencmd pmic_read_adc" output?

The PMIC ADC channels are completely separate - they provide feedback on the various power rails. As I said earlier, the RP1 ADCs are readable from /sys/class/hwmon/hwmon1/in*_input.

Sorry the mix-up from my side. So in your opinion, is having an externally accessible ADC in the Pi 5, be it using any PMIC ADC or RP1 ADC, something feasible to pursue using amateur-grade lab equipment?

Or better I just keep using an ATTiny for my analog readings, connected over i2c...

Although much is possible with enough information and soldering skills, I can't recommend butchering a Pi 5 in a way I wouldn't feel comfortable doing myself (or asking one of our hardware guys to do for me).

Fair enough. Thanks @pelwell!
: )

Last question - Which is the purpose of the used RP1 ADC lines?

These are the ones I can read from these device files, right?
/sys/class/hwmon/hwmon1/in*_input

VBUS monitoring, and RAM size detection.