how to read ADC analog value in newer kernel 4.1.3-ti-r6

After I upgrade my kernel to 4.1.3-ti-r6.

I try to use ADC utility in adafruit-beaglebone-io-python, the following error popups, but GPIO utility of the library is okay.

anything wrong?

import Adafruit_BBIO.ADC as ADC
ADC.setup()
Traceback (most recent call last):
File “”, line 1, in
RuntimeError: Unable to setup ADC system. Possible causes are:

  • A cape with a conflicting pin mapping is loaded
  • A device tree object is loaded that uses the same name for a fragment: helper

Anything I need to migrate if the kernel is migrated to 4.1.3-ti-r6 from 3.8.13.bone73 ??

thanks

Ivan

Have you activated (PinMuxed) the pins correctly? Use the dtb-rebuilder of Robert Nelson if not.
https://github.com/RobertCNelson/dtb-rebuilder/blob/4.1.x/src/arm/am335x-boneblack.dts

1.) Add the following lines within the am335x-boneblack.dts file to activate all ADC pins.
& tscadc {
status = " okay ";
};
& am335x_adc {
ti , adc - channels = <0 1 2 3 4 5 6 7 >;
};

  1. Make and Make install command within the dtb-rebuilder folder

After a reboot you can check if the ADC pins are activated properly by the following procedure:

root@arm : cd / sys / bus / iio / devices / iio : device0
root@arm :confused: sys / bus / iio / devices / iio : device0 # ls -l

-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage0_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage1_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage2_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage3_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage4_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage5_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage6_raw
-rw -r - -r - - 1 root root 4096 Aug 13 15:45 in_voltage7_raw

If you see something like that, the pins are activated correctly. you can measure them with cat in_voltageX_raw…

Regards
Benjamin

The Adafruit library isn't ready for v4.1.x...

Make sure you install:

https://github.com/beagleboard/bb.org-overlays

and run:

./dtc-overlay.sh
./install.sh

Then you just:

sudo sh -c "echo 'BB-ADC' > /sys/devices/platform/bone_capemgr/slots"

Regards,