So I've recently got /dev/ttyAMA0 working . I use it mainly by calling read (in blocking mode) on it to grab data as fast as possible. I've noticed that it randomly will return a 0 from read(...) which means EOF and any subsequent attempt to call read keeps returning 0. Does anyone know how I can prevent this? I need the port to stay open.
It should be easy to dupe for anyone who has this UART setup.
My source code is right here: http://www.rulecity.com/browse/rpi/sertest.cpp.txt
To build, just do :
g++ sertest.cpp -o sertest
Here is a sample of the output I get when I run it twice.
Code: Select all
pi@raspberrypi /mnt/vldp-hw/src/io $ ./sertest
1008
2001
terminate called after throwing an instance of 'std::runtime_error'
what(): Got unexpected EOF!
Aborted
pi@raspberrypi /mnt/vldp-hw/src/io $ ./sertest
1008
2008
3008
4008
5008
terminate called after throwing an instance of 'std::runtime_error'
what(): Got unexpected EOF!
Aborted