That is because this the the incorrect way to read ADC values. The ADC driver 
is based on the IIO framework, so instead of reading ADC values via sysfs, you 
should read the values from /dev/iio:device0. Search for "generic_buffer.c IIO” 
to see how to do this correctly. 

Regards,
John




> On Jun 1, 2016, at 11:11 AM, [email protected] wrote:
> 
> 
> I've been using Blacklib (http://blacklib.yigityuce.com/index.html 
> <http://blacklib.yigityuce.com/index.html>) to read 6 of the Analog Inputs of 
> my Beaglebone but I keep get getting this error:
> 
> terminate called after throwing an instance of 'std::ios_base::failure' 
> what(): basic_filebuf::underflow error reading the file
> 
> It doesn't happen always at the same time, but it will eventually happen at 
> some point. This is my code:
> 
> BlackADC * a;
> BlackADC * b;
> BlackADC * c;
> BlackADC * d;
> BlackADC * e;
> BlackADC * f;
> 
> a=new BlackADC(AIN0); 
> b=new BlackADC(AIN1); 
> c=new BlackADC(AIN2);
> d=new BlackADC(AIN3); 
> e=new BlackADC(AIN4); 
> f=new BlackADC(AIN5); 
> 
> temp_a=a->getConvertedValue(dap2);
> while(temp_a==-1.0)
>     {
>         temp_a=a->getConvertedValue(dap2);
>     }
> s.a=temp_a;
> 
> temp_b=b->getConvertedValue(dap2);
> while(temp_b==-1.0)
>     {
>         temp_b=b->getConvertedValue(dap2);
>     }
> s.b=temp_b;
> temp_c=c->getConvertedValue(dap2);
> while(temp_c==-1.0)
>     {
>         temp_c=c->getConvertedValue(dap2);
>     }
> s.c=temp_c;
> 
> temp_d=d->getConvertedValue(dap2);
> while(temp_d==-1.0)
>     {
>         temp_d=d->getConvertedValue(dap2);
>     }
> s.d=temp_d;
> 
> temp_e=e->getConvertedValue(dap2);
> while(temp_e==-1.0)
>     {
>         temp_e=e->getConvertedValue(dap2);
>     }
> s.e=temp_e;
> 
> temp_f=f->getConvertedValue(dap2);
> while(temp_f==-1.0)
>     {
>         temp_f=f->getConvertedValue(dap2);
>     }
> s.f=temp_f;
> 
> 
> s is a struct that I use to collect all those values together. The read is in 
> a loop that has to run until the user kills it (for periods of about 1 hour) 
> and the values are read as fast as it is possible.
> 
> Any suggestions...???
> 
> 
> -- 
> For more options, visit http://beagleboard.org/discuss 
> <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 [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beagleboard/5809841e-ef2a-424d-8fdb-628017dda1e1%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/beagleboard/5809841e-ef2a-424d-8fdb-628017dda1e1%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beagleboard/5F38FAE3-C2FD-4B0E-A643-265091BBEAB5%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to