adafruit / adafruit-beaglebone-io-python

Adafruit's BeagleBone IO Python Library
http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black
477 stars 218 forks source link

Use libiio to interface with ADC #223

Open pdp7 opened 6 years ago

pdp7 commented 6 years ago

I've been considering if Adafruit_BBIO should be using libiio to interact with the ADC, instead of accessing it via /sys.

@RobertCNelson commented that this could allow Adafruit_BBIO to access more ADC functioality than a single raw read: ADC User Guide: Continuous Mode

pdp7 commented 6 years ago

There is already libiio python binding by @pcercuei . Hopefully, this can be leveraged for Adafruit_BBIO.

thanks to @RobertCNelson for the link!

pdp7 commented 6 years ago

for future reference, this 4.9.0-rc1 kernel patch added DMA support for the BeagleBone's ADC peripheral: drivers: iio: ti_am335x_adc: add dma support

This patch adds the required pieces to ti_am335x_adc driver for DMA support

MarkAYoder commented 4 years ago

The link above needs updating: ADC User Guide: Continuous Mode

MarkAYoder commented 4 years ago

@pdp7 @RobertCNelson I'm trying to understand this project. The Continuous Mode example in the updated link helped a lot. Do you see adding an interface to Adafruit_BBIO that allows Continuous Mode? What would that interface look like?

How fast does the adc sample when running continuous?

I don't see how the libiio python binding fits in.

MarkAYoder commented 4 years ago

@pdp7 I've hacked together a python example that uses continuous analog input. https://github.com/beagleboard/cloud9-examples/blob/v2020.08/BeagleBone/Black/analogInContinuous.py It uses gnuplot to plot the signal.

How do you see BBIO to be changed to implement things such as enabling inputs, changing buffer size, etc.?

pdp7 commented 4 years ago

@MarkAYoder I'm thinking that libiio/bindings/python/ might be useful. Such as bindings/python/examples/iio_readdev.py