beagleboard / kernel

Kernel for the beagleboard.org boards
172 stars 159 forks source link

Issue with Analog Inputs pins when BBB is connected to LCD7 Cape. #69

Open ilovetogetspamed opened 10 years ago

ilovetogetspamed commented 10 years ago

I'm running "Linux beaglebone 3.8.13 #1 SMP Thu Sep 12 08:10:59 EDT 2013 armv7l GNU/Linux" on Angstrom on a Beaglebone Black (Rev A5C) with LCD Cape7 (Rev A3) and have the following issue with Analog Inputs pins:

My uEnv.txt contains:

BeagleBone Black:

Disable HDMI/eMMC

optargs=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G

When the LCD7 Cape is connected to Beagle Bone Black i cannot get analog input:

root@beaglebone:~# echo cape-bone-iio > /sys/devices/bone_capemgr.9/slots
[ 1343.672188] bone-capemgr bone_capemgr.9: part_number 'cape-bone-iio', versio' [ 1343.682095] bone-capemgr bone_capemgr.9: slot #7: generic override
[ 1343.688875] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at7 [ 1343.696908] bone-capemgr bone_capemgr.9: slot #7: 'Override Board Name,00A0,' [ 1343.707652] bone-capemgr bone_capemgr.9: slot #7: Requesting part number/vero [ 1343.718288] bone-capemgr bone_capemgr.9: slot #7: Requesting firmware 'cape-' [ 1343.732555] bone-capemgr bone_capemgr.9: slot #7: dtbo 'cape-bone-iio-00A0.de [ 1343.748055] bone-capemgr bone_capemgr.9: slot #7: #1 overlays
[ 1343.767075] bone-iio-helper helper.16: Could not get AIN0 analog input
[ 1343.782645] bone-capemgr bone_capemgr.9: slot #7: Applied #1 overlays.

When the LCD7 Cape is connected to Beagle Bone Black i CAN get analog input:

root@beaglebone:~# echo cape-bone-iio > /sys/devices/bone_capemgr.9/slots
[ 19.252104] bone-capemgr bone_capemgr.9: part_number 'cape-bone-iio', versio' [ 19.263682] bone-capemgr bone_capemgr.9: slot #7: generic override
[ 19.270230] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at7 [ 19.278247] bone-capemgr bone_capemgr.9: slot #7: 'Override Board Name,00A0,' [ 19.292926] bone-capemgr bone_capemgr.9: slot #7: Requesting part number/vero [ 19.307751] bone-capemgr bone_capemgr.9: slot #7: Requesting firmware 'cape-' [ 19.327110] bone-capemgr bone_capemgr.9: slot #7: dtbo 'cape-bone-iio-00A0.de [ 19.341143] bone-capemgr bone_capemgr.9: slot #7: #1 overlays
[ 19.357104] bone-iio-helper helper.15: ready
[ 19.371048] bone-capemgr bone_capemgr.9: slot #7: Applied #1 overlays.
root@beaglebone:~#

Am I missing something simple? Or is this a bug?

mspicer commented 10 years ago

I too am having this issue. I found here that it looks like the AIN0 through AIN3. I have tried to get a handle on AIN4 or AIN5 without success using the Adafruit_BBBIO library. http://elinux.org/Beagleboard:BeagleBone_LCD7

Let me know if you get anywhere.

ZubairLK commented 10 years ago

LCD Cape uses AIN0-3 for Touchscreen. You can't use those. And what does your device tree file look like. Are the rest of the channels enabled?

nancynguyen commented 9 years ago

hi all, This problem is caused by LCD cape because it takes AIN0, AIN1, AIN2, AIN3. However, you can use AIN4,5,6,7. Instead of taking analog input from /sys/devices/ocp.2/helper.14/AIN_, you can take the value of analog in following path: /sys/bus/iio/devices/iio:device0/in_voltage__raw. I did and successful display analog value on LCD7 ^^. Hope to help you guys.

timkalinowski commented 9 years ago

@ngocnguyen87 thanks for the work around.

Anyone know if its possible to enable AIN4/5/6/7 via /sys/devices/ocp.2/helper.*/ in the device tree overlay with a LCD cape?

Gonz1903 commented 9 years ago

@timkalinowski I'm having the same issue, I'm trying to write a program that will continuously take a reading from one the ADC's that are left over, but I can't seem to find the correct answer on how to get it to work.

Gonz1903 commented 9 years ago

@RobertCNelson sir, can you help us out with this? I'm trying to python and the Adafruit library but I'm guessing since our AINs are not in /helper.*/ we can't use it? Can we bypass this?

RobertCNelson commented 9 years ago

Well, 4 pins are used by the touchscreen and other 4 are used by iio.. https://github.com/beagleboard/linux/blob/3.8/firmware/capes/BB-BONE-LCD7-01-00A3.dts#L150

So you should see them under: /sys/bus/iio/devices/iio:deviceX/

Regards,

Gonz1903 commented 9 years ago

@RobertCNelson So how can we get continuous readings from the other ADC pins that are left unused while using Adafruit?

timkalinowski commented 9 years ago

@Gonz1903 You can fork and modify the adafruit library or write something in python to read /sys/bus/iio/devices/iio:device0/in_voltage_raw as per @ngocnguyen87 suggestion. Although after further research the issue is because the BBB has one ADC chip with the multiple analog inputs, its slow to poll and the touch screen actually interferes with the readings as well so they fluctuate and aren't overly reliable while the touch screen is connected. I ended up ordering a seperate ADC that connects over i2c and will see how that goes instead as I have more confidence in the readings.

saurabhkale93 commented 8 years ago

@timkalinowski Have you tried and succeeded with idea that you had suggested? Does the sampling rate in the new arrangement good enough? I know its been long time and no updates yet, but at least can we come to a conclusion that ordering a separate ADC that connects over i2c is the only possible solution?