I need to read all 7 analog pins in the BBB every 5 milliseconds. I'm doing so with the following C code:
void main(){
char value_str[7];
long int value_int = 0;
FILE* f0 = fopen("/sys/bus/iio/devices/iio:device0/in_voltage0_raw", "r");
while(1){
fread(&value_str, 6, 6, f0);
value_int = strtol(value_str,NULL,0);
printf("0 %li\n", value_int);
fflush(stdout);
usleep(5000);
rewind(f0);
}
Hoever, the cpu usage goes up really high (20%). Is there any way to read the analog inputs differently so that it doesn't use as much CPU? Someone suggested "DMA" but I'm completely lost on that regard...
Any help will be appreciated.
I would replace "printf("0 %li\n", value_int); fflush(stdout);" by
saving the converted values into an array, and print the values only
when the measurement ist finished.
Any help will be appreciated.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Any help will be appreciated.
--
--
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/9NYdGWOT_Mg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
thanks for your complete installation instructions. I plan to include them in the next version of the documentation, if you don't mind (at least I like to add a link to your post here).
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/9NYdGWOT_Mg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Or is the dtbo file doing all the magic?
/* Minimal device tree overlay to activate PRUSS
Licence: GPLv3
(C) 2014 by Thomas{ DoT ]Freiherr[ aT ]gmx[ dOt }net
compile with
dtc -O dtb -o PRUSSDRV-00A0.dtbo -b 0 -@ PRUSSDRV.dts
*/
/dts-v1/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "PRUSSDRV";
version = "00A0";
fragment@0{
target = <&pruss>;
__overlay__ {
status = "okay";
};
};
};
What kernel version is needed for this to work?
How to build kernel for pruss support?
I got the following:/usr/bin/ld: cannot find -lncursescollect2: ld returned 1 exit statusmake: *** [all] Error 1
sudo apt-get install libncurses5-dev
I am setting the libpruio library to read from the all the 7 analog pins with a sampling rate of 40KHz at least for each pin. You're help os appreciated. Thanks.