Using the Gumstix onboard ADCsLast Updated on Wednesday, 17 October 2012 19:52 The Gumstix Overo boards expose 6 Analog to Digital converters from the TPS65950 power management module.
The TPS65950 is backward compatible with the TWL4030 power manager. When you look through the kernel code, look for references to the twl4030.
The TPS65950 is connected to the OMAP on the I2C bus 1. The default Gumstix kernels handle registering the I2C platform data for the "tps65950" device in their board file, arch/arm/mach-omap2/board-overo.c.
The "tps65950" platform device supports numerous functions, most of them power related, but it also supports the twl4030-madc driver.
Kernel 2.6.36 and earlierThe twl4030-madc driver exposes a standard character device to userland called /dev/twl4030-madc for reading the ADCs. You don't need to access the twl4030-madc device using I2C code directly. You should use the registered device driver.
Standard read and write functions are not supported for this device. Instead a single ioctl call is provided to allow reading one ADC channel at a time. See below for a link to an example program using this ioctl.
Kernel 2.6.39 and laterThere is a newer madc driver that exposes the ADCs under /sys/class/hwmon . See below for an example program to read the data.
Of the 16 ADCs on the TPS65950/TWL4030, 7 are available for general purpose use, ADC0 and ADC2-7. Gumstix brings out ADC's 2-7 on their expansion boards as well as an analog ground pin.
The input range of the ADC's is 0 to 2.5v.
ReferencesThe programming manual can be found here http://focus.ti.com/docs/prod/folders/print/tps65950.html. You want the TPS659650 OMAP Power Management and System Companion Device ES 1.2 TRM.
Example for kernel 2.6.36 and earlierThe twl4030-madc device driver can be found in the kernel source here
A simple example to read from the twl4030-madc device : github.com/scottellis/madc
Example for kernel 2.6.39 and laterA simple example to read the new madc kernel driver : github.com/scottellis/polladc.
|
Gumstix ADC