user21201: I just bought an Arduino Due and I'm having trouble reading from a simple serial IO program.
I have a SparkFun RedBoard which is like an Uno. With that, I just ran a "stty" command to configure the baud rate and other terminal settings, and then I could do "cat /dev/ttyUSB0". Actually I have a C++ program which opens "/dev/ttyUSB01" and reads from it like a normal file.
Now, with the Due, the device is "/dev/ttyACM0" and there have been a few snags. One of them is that after programming the Due, and running stty, I have to open /dev/ttyACM0 using the screen program:
screen /dev/ttyACM0 115200

and then kill screen, before cat /dev/ttyACM0 will work. Otherwise, cat prints out one byte and exits; rarely it prints out 10 bytes or a line, or sometimes it prints nothing.
This is a bit annoying and I can't figure out what screen is doing to the device which I can't seem to accomplish using stty. My stty command is:
sudo stty -F /dev/ttyACM* 115200 -parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts \
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff -iuclc \
-ixany -imaxbel -iutf8 \
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 \
-isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl \
echoke -flusho -extproc

I got this by running stty -a < /dev/ttyACM0 after using screen to initialize as above.
I thought it might have something to do with serial auto-reset, so I tried using a resistor between 3.3V and RESET, but this did not fix the problem.
I should note that cu from the uucp package is able to read continuously from /dev/ttyACM0, but unlike screen it does not leave the terminal set up in such a way that a subsequent cat command will work.
$ cu -l /dev/ttyACM0 -s 115200
<continuous stream of data>
$ killall cu             # (from another shell)
$ cat /dev/ttyACM0 | hexdump -c
<e.g. 7 bytes>
$

With screen, cat would have printed an infinite stream. Any ideas how to accomplish this setup without using screen?

user18478: I have had very similar problems with my yun(shields) and I found the stty command to be very crucial for a good working.
I use following command and it works with mega and due on the yun
stty -F ${PortName}  ${SerialSpeed}  raw -clocal -echo icrnl

Since I call these I can redirect from and to /dev/ttyxxx without problems.
As far as I can see you mis the raw.

21201: <p>I just bought an Arduino Due and I'm having trouble reading from a simple serial IO program.</p>

<p>I have a SparkFun RedBoard which is like an Uno. With that, I just ran a "<code>stty</code>" command to configure the baud rate and other terminal settings, and then I could do "<code>cat /dev/ttyUSB0</code>". Actually I have a C++ program which opens "<code>/dev/ttyUSB01</code>" and reads from it like a normal file.</p>

<p>Now, with the Due, the device is "<code>/dev/ttyACM0</code>" and there have been a few snags. One of them is that after programming the Due, and running <code>stty</code>, I have to open <code>/dev/ttyACM0</code> using the <code>screen</code> program:</p>

<pre><code>screen /dev/ttyACM0 115200
</code></pre>

<p>and then kill screen, before <code>cat /dev/ttyACM0</code> will work. Otherwise, <code>cat</code> prints out one byte and exits; rarely it prints out 10 bytes or a line, or sometimes it prints nothing.</p>

<p>This is a bit annoying and I can't figure out what <code>screen</code> is doing to the device which I can't seem to accomplish using <code>stty</code>. My <code>stty</code> command is:</p>

<pre><code>sudo stty -F /dev/ttyACM* 115200 -parenb -parodd -cmspar cs8 -hupcl -cstopb cread clocal -crtscts \
-ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon -ixoff -iuclc \
-ixany -imaxbel -iutf8 \
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 \
-isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl \
echoke -flusho -extproc
</code></pre>

<p>I got this by running <code>stty -a &lt; /dev/ttyACM0</code> after using <code>screen</code> to initialize as above.</p>

<p>I thought it might have something to do with serial auto-reset, so I tried using a resistor between <code>3.3V</code> and <code>RESET</code>, but this did not fix the problem.</p>

<p>I should note that <code>cu</code> from the <code>uucp</code> package is able to read continuously from <code>/dev/ttyACM0</code>, but unlike <code>screen</code> it does not leave the terminal set up in such a way that a subsequent <code>cat</code> command will work.</p>

<pre><code>$ cu -l /dev/ttyACM0 -s 115200
&lt;continuous stream of data&gt;
$ killall cu             # (from another shell)
$ cat /dev/ttyACM0 | hexdump -c
&lt;e.g. 7 bytes&gt;
$
</code></pre>

<p>With <code>screen</code>, <code>cat</code> would have printed an infinite stream. Any ideas how to accomplish this setup without using <code>screen</code>?</p>
 18478: <p>I have had very similar problems with my yun(shields) and I found the stty command to be very crucial for a good working.
I use following command and it works with mega and due on the yun</p>

<pre><code>stty -F ${PortName}  ${SerialSpeed}  raw -clocal -echo icrnl
</code></pre>

<p>Since I call these I can redirect from and to /dev/ttyxxx without problems.
As far as I can see you mis the raw.</p>
