Controling sample rate

Helllo guys,

I am a total begginner with BeagleBone.
I would like to ask how can I control the sample rate of BeagleBone Black.
Is there a minimal example?

Thank you for the attention!
Frederico

I'm going to assume you mean the ADC inputs...

  What programming language? If using Python, you might want to start
here: https://adafruit-beaglebone-io-python.readthedocs.io/en/latest/ (or
download as PDF from
https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/overview
[link on left middle of page]).

  Granted, that simplified interface is a one-shot read, so sample rate
doesn't apply. For more complex uses (from C/C++ say) you might want to
read the applicable section of the TI TRM (SPRUH73P -- Google it, and
download the PDF). The ADC is covered under "Touchscreen Controller" (and
for your OTHER post, SPI is under "Multichannel Serial Port Interface".

  I don't really see an obvious "sample rate" parameter for the ADC, just
delays at the start of "conversion" to allow (if needed) voltages to settle
down). There is a clock divider register.

  For SPI from Python, again see the BBIO documents for setting up the
channel, and the documents for the slave device for the commands to send.
(I don't find many examples for a SPI pot, lots for an I2C pot). You might
also want to look at Arduino code, and map it's C(++) library calls into
Python BBIO calls. (example:
https://www.arduino.cc/en/Tutorial/DigitalPotControl )

Hello Frederico,

I assume you want to create a fixed sampling rate so that you can use the BeagleBone as a controller for a feedback system.
If this is the case, I advise you to run it via Linux with an RTOS patch, preferably Xenomai:
https://cvra.ch/blog/2015/xenomai-installation-on-a-beaglebone-black

Barkan

If it’s the ADC you want to control, I have some note’s here[1] on how to change the sampling rate.

–Mark

[1] EBC Exercise 10a Analog In - eLinux.org

libpruio provides full access to all TSC_ADC_SS registers. It offers the most efficient (and most easy) way to controll ADC sampling.

Regards