Analog IO with C/C++ code

Hi guys,
Alright I submit, I give in and come to you and now ask for help. I am amiss as to how this has been so magically elusive, but it has!

Question

How can you do Analog Input and Analog Output of discrete values from either a terminal or C/C++ code?

Specific Hardware

BeagleBone Black Rev. C, Debian Jessie 8.4

Research

I have found discussions claiming AIO support for the BBB, but these both were greater than 3 years old and referenced non-existant directories in the file system!

I have also found a plethora of Bonescript solutions

I am still amiss as to how this is not BBB-101 and the first example code you encounter!

Please let me know where to look for reference and example, and get this in action!

Thanks :slight_smile:
Justin Reina

See the answer to your posting from yesterday.

Regards,
John

Hi John,
I hope you know how dang excited I was to brush into your code response earlier this week, whilst at work as I browsed my Gmail inbox - sheesh & wow!!! I got home though and could not find these search paths!

Issue: I cannot find /iio or /device0 on my BBB

Useful Context:

root@beaglebone:/# pwd
/
root@beaglebone:/# find / -type d -name iio
/lib/modules/4.4.9-ti-r25/kernel/drivers/iio
/lib/modules/4.4.9-ti-r25/kernel/drivers/staging/iio
/usr/src/linux-headers-4.4.9-ti-r25/tools/iio
/usr/src/linux-headers-4.4.9-ti-r25/drivers/iio
/usr/src/linux-headers-4.4.9-ti-r25/drivers/staging/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/config/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/config/hid/sensor/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/config/sensors/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/linux/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/dt-bindings/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/uapi/linux/iio
/opt/source/dtb-4.4-ti/Bindings/iio
/opt/source/dtb-4.4-ti/Bindings/staging/iio
/opt/source/dtb-4.4-ti/include/dt-bindings/iio
root@beaglebone:/# find / -type d -name device0
root@beaglebone:/# find / -type d -name device0
root@beaglebone:/# find / -type d -name scan_elements

Question: What is the cause here of these paths not showing up? I am running Jessie 8.4, grabbed and flashed earlier this week!

Thanks again for your help here John :slight_smile:

-Justin
justinmreina@gmail.com

Here is a case where iio was not installed by default -

-J

in /boot/uEnv.txt, add:

cape_enable=bone_capemgr.enable_partno=BB-ADC

and reboot..

Regards,

Robert, thank you!!! Here is my new report running the same find tests -

steps today

  1. opened up /boot/uEnv.txt copy on local PC, inspected contents
  2. Pulled a copy of uEnv.txt to PC, updated with recommendation, reloaded, rebooted
  3. Did same terminal test

root@beaglebone:~# cd …
root@beaglebone:/# pwd
/
root@beaglebone:/# find / -type d -name iio
/lib/modules/4.4.9-ti-r25/kernel/drivers/iio
/lib/modules/4.4.9-ti-r25/kernel/drivers/staging/iio
/usr/src/linux-headers-4.4.9-ti-r25/tools/iio
/usr/src/linux-headers-4.4.9-ti-r25/drivers/iio
/usr/src/linux-headers-4.4.9-ti-r25/drivers/staging/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/config/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/config/hid/sensor/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/config/sensors/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/linux/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/dt-bindings/iio
/usr/src/linux-headers-4.4.9-ti-r25/include/uapi/linux/iio
/sys/bus/iio
/sys/kernel/debug/iio
root@beaglebone:/# find / -type d -name device0
root@beaglebone:/# find / -type d -name scan_elements
/sys/devices/platform/ocp/44e0d000.tscadc/TI-am335x-adc/iio:device0/scan_elements

This ROCKS!

I will post up my final results this weekend - but thank you for this fix Rob!!!

-J :)!

uEnv - new.txt (1.31 KB)

uEnv - Original.txt (1.17 KB)