I am running Ubuntu 12.04 on my Beaglebone, but the ADC is not giving me correct values when I access them from userspace.
I enable the ADC module with modprobe, but then no matter what voltage I have, the ADC always reports a value near the maximum of 4096. Does anyone have a clue what is going on?
Maybe you need to check the pinmux! If it is polled high, that was correct value in the ain3.
Also you can check ain7, it is connected to ground (Bone rev. A3).
Please check the real voltage output of the ain3!
I checked the voltage at the connector at pin AIN3 using a meter. It is currently +0.76V.
The value of ain3 reported at the Linux shell is around 3960.
The value of ain7 reported at the Linux shell is around 3430.
The pin muxes appear to be set to analog inputs. Unless I’m missing something, those pins only have one possible function. See the shell output below
`
root@omap:/sys/devices/platform/omap/tsc# cat /sys/kernel/debug/omap_mux/ain7
name: ain7.ain7 (0x44e10b10/0xb10 = 0x0020), b NA, t NA
mode: OMAP_PIN_INPUT_PULLDOWN | OMAP_MUX_MODE0
signals: ain7 | NA | NA | NA | NA | NA | NA | NA
root@omap:/sys/devices/platform/omap/tsc# cat /sys/kernel/debug/omap_mux/ain3
name: ain3.ain3 (0x44e10b20/0xb20 = 0x0020), b NA, t NA
mode: OMAP_PIN_INPUT_PULLDOWN | OMAP_MUX_MODE0
signals: ain3 | NA | NA | NA | NA | NA | NA | NA
root@omap:/sys/devices/platform/omap/tsc# cat ain7;echo
3446
root@omap:/sys/devices/platform/omap/tsc# cat ain3; echo
3959
root@omap:/sys/devices/platform/omap/tsc# cat ain7;echo
3430
root@omap:/sys/devices/platform/omap/tsc# cat ain3; echo
3954
Found two problems. One board is damaged electrically. The other problem is that Linux interface uses 1-based numbering. Bone docs use 0-based numbering. Using a fresh board and proper numbering things seem to work okay.