adafruit-beaglebone-io-python icon indicating copy to clipboard operation
adafruit-beaglebone-io-python copied to clipboard

Use libiio to interface with ADC

Open pdp7 opened this issue 6 years ago • 6 comments

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 avatar Jan 12 '18 20:01 pdp7

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

thanks to @RobertCNelson for the link!

pdp7 avatar Jan 12 '18 20:01 pdp7

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

pdp7 avatar Jan 12 '18 20:01 pdp7

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

MarkAYoder avatar Jul 03 '20 18:07 MarkAYoder

@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 avatar Jul 03 '20 19:07 MarkAYoder

@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.?

MarkAYoder avatar Jul 08 '20 14:07 MarkAYoder

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

pdp7 avatar Jul 09 '20 16:07 pdp7