I discovered a problem when accessing the Analog pins on the BBB.
Whenever I would read the value of the pins, I needed to read a second time to get the correct value. This is because the first file read initiates the conversion, and the second gets the actual value. I found that if I did the read back to back, with no delay in between, the second read would fail by way of a buffer underflow (reading the file using the ifstream class in C++). I am assuming this happens because the conversion is not complete, and as such there is no data yet.
My question is this: Is there a way to check if the conversion is done before attempting the read? I need these reads to happen pretty quick, so I cant afford to burn 50ms before the second read, and if I try to read them too much quicker than that, I get an occasional seg fault from the underflow.