Thanks Nikolaus, tonight I will give it a try. But where do I place the echo? Without an echo to write some character there is nothing to read.
for ((x=0;x<100;x++)); do echo -en '\xAA' > /dev/ttyO4 read -n 1 -t 1 < /dev/ttyO4 done < /dev/ttyO4 Something like this? Just add the "< /dev/ttyO4" at the bottom to hold the file descriptor open? Op maandag 18 mei 2015 17:18:00 UTC+2 schreef Dr. H. Nikolaus Schaller: > > read </dev/ttyO4 opens the file and after the command is done it is closed. > The UART throws away characters received while the tty is closed. > > What you can do is > for … do > read > done </dev/ttyO4 > > Am 18.05.2015 um 15:18 schrieb ralphvann...@gmail.com <javascript:>: > > I have a problem with ttyO4. It looks like something is emptying the uarts > buffer. > > When is run two bash scripts at the same time I can send characters and > receive characters at the same time. The two files running parallel look > like this (simplified): > > 1: > for ((x=0;x<100;x++)); do > echo -en '\xAA' > /dev/ttyO4 > done > > 2: > for ((x=0;x<100;x++)); do > read -n 1 -t 1 < /dev/ttyO4 > done > > Number 1 is sending and I receive the 0xAA at number 2. > > Now I try to combine these two files: > > for ((x=0;x<100;x++)); do > echo -en '\xAA' > /dev/ttyO4 > read -n 1 -t 1 < /dev/ttyO4 > done > > This does not work. So I write one byte and I am to late to receive this > byte. When I use the bash script reading parallel it works again. > > The 0xAA received at the RX, where does it go? Why isn't it in the > Beaglebones (hardware) buffer? Is there some linux process reading these > bytes before my own read (from the bash file) is ready to read? > > -- > 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 <javascript:>. > For more options, visit 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 beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.