I am new to the Beaglebone, and was moving along at a pretty good click until this strange problem popped-up. I spent all weekend trying to figure it out before posting here.
I am trying to read analog input using multiple sensors from a beaglebone with Angstrom 3.2.5+ and I have a problem that I think might be a hardware issue.
Using this Python script and Alexander Hiam's PyBBIO I have been able to test a photoresistor with success (the value responds to more and less incidental light):
# Import PyBBIO library:
from bbio import *
# Create a setup function:
def setup(): pass # Nothing to do here
# Create a main function:
def loop():
print "-----"
print "AIN0 [P9.39] - " + str(analogRead(A0))
print "AIN1 [P9.40] - " + str(analogRead(A1))
print "AIN2 [P9.37] - " + str(analogRead(A2))
print "AIN3 [P9.38] - " + str(analogRead(A3))
print "AIN4 [P9.35] - " + str(analogRead(A4))
print "AIN5 [P9.36] - " + str(analogRead(A5))
print "AIN6 [P9.33] - " + str(analogRead(A6))
print "AIN7 [P9.39] - " + str(analogRead(A7))
delay(500)
# Start the loop:
run(setup, loop)
But, any other analog-in (AINx(2-7)) I read with the script above always shows the same value of the photo resistor I have plugged-into AIN1
And, possibly related, I am unable to read any of the AINx(1-7) using cat with an error
cat /sys/bus/platform/devices/tsc/ain1
Segmentation fault
Any ideas? I am really stuck. Thanks in advance.
PS: More info...
My circuit consists of a 10k resistor and a photoresistor. My pin connections are:
- Header P9 Pin 32 (VDD_ADC(1.8V)) to one end of photocell
- Header P9 Pin 34 (GNDA_ADC) to the other end of the resistor
- Header P9 Pin 39 (AIN0) to the other side of the photocell along with one end of pull-down resistor
Here is an image which matches my own circuit:
The results from all of the AINx(1-7)'s and then some...
# cat /sys/bus/platform/devices/tsc/ain0
cat: /sys/bus/platform/devices/tsc/ain0: No such file or directory
# cat /sys/bus/platform/devices/tsc/ain1
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain2
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain3
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain4
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain5
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain6
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain7
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain8
Segmentation fault
# cat /sys/bus/platform/devices/tsc/ain9
cat: /sys/bus/platform/devices/tsc/ain9: No such file or directory
UPDATE 1
I edited the analog_test_simple.py file to show all ADC ports on the BeagleBone. This is the result from the shell with no sensors plugged-in.
-----
AIN0 [P9.39] - 3948
AIN1 [P9.40] - 4016
AIN2 [P9.37] - 4002
AIN3 [P9.38] - 3934
AIN4 [P9.35] - 4001
AIN5 [P9.36] - 3935
AIN6 [P9.33] - 3968
AIN7 [P9.39] - 4005
-----
AIN0 [P9.39] - 3946
AIN1 [P9.40] - 4005
AIN2 [P9.37] - 3945
AIN3 [P9.38] - 3957
AIN4 [P9.35] - 4018
AIN5 [P9.36] - 3945
AIN6 [P9.33] - 3967
AIN7 [P9.39] - 3955
...
And if I plug the sensor back in I get a change in value, but again, they are all the same:
-----
AIN0 [P9.39] - 2836
AIN1 [P9.40] - 2836
AIN2 [P9.37] - 2837
AIN3 [P9.38] - 2831
AIN4 [P9.35] - 2840
AIN5 [P9.36] - 2837
AIN6 [P9.33] - 2837
AIN7 [P9.39] - 2837
-----
AIN0 [P9.39] - 2834
AIN1 [P9.40] - 2834
AIN2 [P9.37] - 2829
AIN3 [P9.38] - 2825
AIN4 [P9.35] - 2826
AIN5 [P9.36] - 2817
AIN6 [P9.33] - 2815
AIN7 [P9.39] - 2815
...