Beaglebone ADC readings always near maximum voltage

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?

See below:

`
root@omap:modprobe ti_tscadc

root@omap:/sys/devices/platform/omap/tsc# cat ain3; echo
3966
root@omap:/sys/devices/platform/omap/tsc# cat ain3; echo
3963
root@omap:/sys/devices/platform/omap/tsc# cat ain3; echo
3963

`

For the record, I am pretty much following this tutorial.

OMAP Tutorial

Thanks,
Dave …

I have measured the voltage at the expansion connector and it is definitely showing up in the 0V to 1.8V range.

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!

Sunny

Dave H.於 2012年8月4日星期六UTC+8上午7時54分51秒寫道:

Thanks for your help, Sunny.

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

`

Any thoughts?

Dave …

No! It is very weird! ain7 is grounded in Bone Rev A3.
Need to see this kernel source code!

2012/8/5 Dave H. <pkpdjh10@gmail.com>

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.