Re: [beagleboard] Reading analog inputs fast in beaglebone black

2014-05-25 Thread robert.berger
Hi, Please correct me if I'm wrong, but this is my understanding with a 3.14.x or newer kernel: Since it looks like you want continuous sampling you might want to use the hardware buffer in iio. Normally you would use something like the generic_buffer.c [1] as a sample application, but the eve

Re: [beagleboard] Reading analog inputs fast in beaglebone black

2014-05-24 Thread John Syn
From: Rafael Vega Reply-To: Date: Saturday, May 24, 2014 at 1:23 AM To: Subject: [beagleboard] Reading analog inputs fast in beaglebone black > > > I need to read all 7 analog pins in the BBB every 5 milliseconds. I'm doing so > with the following C code: > voi

Re: [beagleboard] Reading analog inputs fast in beaglebone black

2014-05-24 Thread John Syn
From: Rafael Vega Reply-To: Date: Saturday, May 24, 2014 at 1:23 AM To: Subject: [beagleboard] Reading analog inputs fast in beaglebone black > > > I need to read all 7 analog pins in the BBB every 5 milliseconds. I'm doing so > with the following C code: > voi

Re: [beagleboard] Reading analog inputs fast in beaglebone black

2014-05-24 Thread ZubairLK
Christian is correct. Don't use printf. It introduces a significant overhead. remove printf, copy into a variable. Then check and see if you can meet timing. *fingers crossed* Your email mentioned you wanted to acquire all 7 analog inputs for real time audio every 5ms. Depending on your level o

Re: [beagleboard] Reading analog inputs fast in beaglebone black

2014-05-24 Thread Rafael Vega
> > 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. > What do you mean when the measurement is finished? I need to read the inputs every 5 milliseconds forever. Is th

Re: [beagleboard] Reading analog inputs fast in beaglebone black

2014-05-24 Thread Christian Keck
I need to read all 7 analog pins in the BBB every 5 milliseconds. I'm doing so with the following C code: ... while(1){ fread(&value_str, 6, 6, f0); value_int = strtol(value_str,NULL,0); printf("0 %li\n", value_int); fflush(stdout);

[beagleboard] Reading analog inputs fast in beaglebone black

2014-05-24 Thread Rafael Vega
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,