BeagleBone Black Debian 8 ADC voltage readings incorrect

377 views
Skip to first unread message

steven.na...@gmail.com

unread,
Oct 13, 2017, 11:21:01 AM10/13/17
to BeagleBoard

We just purchased a group of BeagleBone Black Rev. C boards.  We’re trying to get the ADC working properly.  We use a Adafruit BeagleBone Proto cape.  We have a pressure sensor connected to pin P9_39 (AIN0).  The pressure sensor produces millivoltage readings.  We only sample the reading hourly in production so we’re not using continuous buffered input.  This setup worked accurately with the previous BBB Rec C boards using Debian 7.  I can’t seem to get an accurate reading under Debian 8 though.  I assume I’m not configuring the AIN overlay correctly.  I get readings but they are not correct.  The values are more than double what I’m reading by using a digital multimeter on P9_39 (202mv digital multimeter 464mv AIN0).  If I move the cape from the new Debian 8 BBB Rev C to an earlier Debian 7 BBB Rev C the readings are correct: same cape, same sensor, same power supply. 


I've tried 3 new BBB Rev C and get the same result

 

I’ve tried both these two tutorials to build ADC into the overlay.  Both tutorial produce working overlays with identical, incorrect readings on AIN0.


https://www.teachmemicro.com/beaglebone-black-adc/ <- specific to Ubuntu 16 but I gave it a whirl

 

https://gist.github.com/matthewmcneely/bf44655c74096ff96475


I tried loading a number of distribution provided dtb's, disabling HDMI and Audio.  In addition, I downloaded Robert Nelsons dtb-rebuilder and compiled new dtbo's using the stanza's suggested in the tutorials above : https://github.com/RobertCNelson/dtb-rebuilder

 

I’ve tried building overlays using the stock out of the box kernel and after running apt dist-upgrade. In each case I can see the overlay loaded but the values I read are always the same and incorrect.


/boot/uEnv.txt

#dtb=am335x-boneblack.dtb
dtb=am335x-boneblack-overlay.dtb
cape_disable=bone_capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN
#cape_enable=bone_capemgr.enable_partno=
cmdline=coherent_pool=1M quiet cape_universal=enable

cat /sys/devices/platform/bone_capemgr/slots

0: PF----  -1

1: PF----  -1

2: PF----  -1

3: PF----  -1

4: P-O-L-   0 Override Board Name,00A0,Override Manuf,univ-emmc

5: P-O-L-   1 Override Board Name,00A0,Override Manuf,BB-ADC

 

uname -a : Linux beaglebone 4.1.15-ti-rt-r43 #1 SMP PREEMPT RT Thu Jan 21 20:13:58 UTC 2016 armv7l GNU/Linux

Robert Nelson

unread,
Oct 13, 2017, 11:34:34 AM10/13/17
to Beagle Board, steven.na...@gmail.com
On Fri, Oct 13, 2017 at 8:13 AM, <steven.na...@gmail.com> wrote:
>
> We just purchased a group of BeagleBone Black Rev. C boards. We’re trying
> to get the ADC working properly. We use a Adafruit BeagleBone Proto cape.
> We have a pressure sensor connected to pin P9_39 (AIN0). The pressure
> sensor produces millivoltage readings. We only sample the reading hourly in
> production so we’re not using continuous buffered input. This setup worked
> accurately with the previous BBB Rec C boards using Debian 7. I can’t seem
> to get an accurate reading under Debian 8 though. I assume I’m not
> configuring the AIN overlay correctly. I get readings but they are not
> correct. The values are more than double what I’m reading by using a
> digital multimeter on P9_39 (202mv digital multimeter 464mv AIN0). If I
> move the cape from the new Debian 8 BBB Rev C to an earlier Debian 7 BBB Rev
> C the readings are correct: same cape, same sensor, same power supply.
>
>
> I've tried 3 new BBB Rev C and get the same result

You can install 3.8.13 in Debian 8..

The easiest way is just:

cd /opt/scripts/tools/
sudo ./update_kernel.sh --bone-channel --stable
sudo reboot

and you'll have 3.8.13-boneX installed..

https://elinux.org/BeagleBoardDebian#Install_Latest_Kernel_Image
Yuck "4.1.x"...

Regards,


--
Robert Nelson
https://rcn-ee.com/

Steven Napolitano

unread,
Oct 13, 2017, 1:58:11 PM10/13/17
to BeagleBoard
Thanks Robert.  I'm running the  3.8.13-bone86 kernel now.  I apologize because this questions is probably below your pay grade but...do I have to compile a custom overlay to get ADC working on this kernel?  I'm confused because our legacy BBB are running 3.8.13-bone70 and the uEnv.txt is simply this:
#dtb=
cmdline=quiet init=/lib/systemd/systemd

##Example
#cape_disable=capemgr.disable_partno=
cape_enable=capemgr.enable_partno=BB-UART4

Somehow ADC is working.  When I use that uEnv.txt on kernel 3.8.13-bone86  i get the dreaded "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"
when using the AdaFruit BBIO library. 

Robert Nelson

unread,
Oct 13, 2017, 2:18:32 PM10/13/17
to Beagle Board, steven.na...@gmail.com
On Fri, Oct 13, 2017 at 12:58 PM, Steven Napolitano
<steven.na...@gmail.com> wrote:
> Thanks Robert. I'm running the 3.8.13-bone86 kernel now. I apologize
> because this questions is probably below your pay grade but...do I have to
> compile a custom overlay to get ADC working on this kernel? I'm confused
> because our legacy BBB are running 3.8.13-bone70 and the uEnv.txt is simply

Hi Steven,

So a lot with 3.8.13, i honestly just don't remember. ;)

> this:
> #dtb=
> cmdline=quiet init=/lib/systemd/systemd
>
> ##Example
> #cape_disable=capemgr.disable_partno=
> cape_enable=capemgr.enable_partno=BB-UART4

Just tested this:

cape_enable=capemgr.enable_partno=BB-UART4,BB-ADC

debian@beaglebone:~$ uname -r
3.8.13-bone80
debian@beaglebone:~$ cat /sys/devices/bone_capemgr.9/slots
0: 54:PF---
1: 55:PF---
2: 56:PF---
3: 57:PF---
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART4
8: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-ADC
debian@beaglebone:~$ cat /sys/bus/iio/devices/iio\:device0/*_raw
3687
2991
3486
1993
1419
1569
1680
3839

>
> Somehow ADC is working. When I use that uEnv.txt on kernel 3.8.13-bone86 i
> get the dreaded "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"
> when using the AdaFruit BBIO library.

Steven Napolitano

unread,
Oct 13, 2017, 2:39:29 PM10/13/17
to BeagleBoard
I guess you remembered!  You're incredible...truly.  That worked...and I get the same incorrect voltage as I did when using Debian 8.  Perhaps this isn't a kernel issue?  I guess this is a hardware issue?  Again I tested the voltage at the P9_39 pin with a multimeter.  Meter reads 200mv ADC raw input on AIN0 is 465mv.

Robert Nelson

unread,
Oct 13, 2017, 2:58:41 PM10/13/17
to Beagle Board, steven.na...@gmail.com
On Fri, Oct 13, 2017 at 1:39 PM, Steven Napolitano
<steven.na...@gmail.com> wrote:
> I guess you remembered! You're incredible...truly. That worked...and I get
> the same incorrect voltage as I did when using Debian 8. Perhaps this isn't
> a kernel issue? I guess this is a hardware issue? Again I tested the
> voltage at the P9_39 pin with a multimeter. Meter reads 200mv ADC raw input
> on AIN0 is 465mv.

Hi Steven,

Was the 465 value directly from reading the "raw" value?

cat /sys/bus/iio/devices/iio\:device0/*_raw

465 * (1.8V / 4096) = 204.3mV

Steven Napolitano

unread,
Oct 13, 2017, 3:29:44 PM10/13/17
to BeagleBoard

<Palm to forehead> Yes that is a raw value.

Reply all
Reply to author
Forward
0 new messages