Control MOVI SerialMonitor from Linux /dev/ttyACM0

I try to control the SAY command from a NanoPi NEO2 (a device like the Raspberry Pi).

So I uploaded the SerialMonitor Sketch from the Examples MOVI->debug and connected the MOVI via USB to the NanoPi.


Sometimes a “echo “SAY Hello how are you?” > /dev/ttyACM0” does work, but often it seems that the serial buffer/queue seems to hang.


From minicom it works, when set to 9600 Baud and Hardware Flowcontroll off.

If you exit minicom with X (Exit and Reset) it didnt work with the command above,

but when you leave minicom via q (Exit and dont reset) the command works from the shell.


The SAY command goes “crazy” when I try to init the stty with 9600 Baud like this:

stty -F /dev/ttyACM0 ispeed 9600 ospeed 9600 -crtscts -ixoff -ixon -hupcl cs8 -cstopb -parenb


Then it even do say somehting (like MOVI) thats not included in the echo-String.

The “MOVI” seems to be a part of the output that is coming from MOVI.


Has anyone a Idea how to correctly init the stty port or/and to clear the serial buffer?


I also did try the echo command with the parameter -e for recognizing \n for new-line and so on,

but it doesnt seem to help :frowning:


To use the USB-serial-port would the to free the ttl-serial-port on the NanoPi.

I dont know if it would work better, if I only would use the ttl-serial port - but I think the commands/init scheme should be the same for ttyS0 or ttyACM0.

        <div class='signature' style='font-size:0.8em;margin-top:20px;font-style:italic;margin-bottom:-15px;max-height:120px'>Status:Playing with MOVI :) The Call Sign is "Joshua" :)

I did found “something” that could help me (and you?)


The starting point was to configure minicom in a useable state and exit without reset.


I did found at the follwing page 2 commands to save the configuration of the stty in a file and also to restore from this file the stty state/configuration:

http://forums.fedoraforum.org/showthread.php?t=170620

To save the config I did use

stty -g < /dev/ttyACM0 >/home/guido/ttyACM0.settings


and for a restore I used:

stty < /dev/ttyACM0 cat /home/guido/ttyACM0.settings


The content of the file:

more ttyACM0.settings

1:0:800008bd:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0


So my scripts and the included commands which telling me the time (full and half hour) do work :slight_smile:

like

date +‘SAY Its now %k a Clock.’ > /dev/ttyACM0

date +‘SAY Its now %k a Clock and %M Minutes.’ > /dev/ttyACM0


SAY='SAY '

TEXT='Hello how are you today?'

echo $SAY $TEXT > /dev/ttyACM0

            <div class='signature' style='font-size:0.8em;font-style:italic;margin-top:15px;padding-top:3px;max-height:120px'>Status:Playing with MOVI :) The Call Sign is "Joshua" :)

Yes, doing an stty is important. Also, I wonder if an explicit “\n” after the ECHO helps to guarantee to flush the buffer. MOVI is OK with extra lines (it will just ignore them).