Members | Sign In
Legacy MOVI User Community Forum (readonly) > MOVI Question & Answers

Control MOVI SerialMonitor from Linux /dev/ttyACM0

posted May 09, 2017 08:24:39 by GuidoL
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 :(

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.
Status:Playing with MOVI :) The Call Sign is "Joshua" :)
page   1
2 replies
GuidoL said May 09, 2017 10:42:33
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:

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

So my scripts and the included commands which telling me the time (full and half hour) do work :)
date +'SAY Its now %k a Clock.' > /dev/ttyACM0
date +'SAY Its now %k a Clock and %M Minutes.' > /dev/ttyACM0

TEXT='Hello how are you today?'
echo $SAY $TEXT > /dev/ttyACM0
Status:Playing with MOVI :) The Call Sign is "Joshua" :)
GeraldFriedland said May 14, 2017 00:56:30
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).

Login below to reply: