Go Down

Topic: arduino uno seen as /dev/ttyACM0: "echo" working only if "cat" is on? (Read 5670 times) previous topic - next topic


I've connected an arduino uno (controlling fans and reading a temp. sensor) to a wireless router where openwrt is installed, the connection is through USB and openwrt mounts arduino as /dev/ttyACM0 (cdc acm driver)

the code running on arduino is a small interactive menu: e.g. if "A" is read on the serial port it switches on the fans and print out a message on the serial, etc.

on openwrt with "microcom -D/dev/ttyACM0" I can interact with arduino in a smooth way, sending characters and receiving messages

I would like to send characters directly through the commandline, e.g. "echo A > /dev/tyyACM0" but it does not work, i.e. nothing happens

the "echo" command only works when (on another terminal) I have a "cat" session opened, i.e. "cat < /dev/ttyACM0" is running: in this case when I send characters with "echo" I get the correct messages on the terminal where "cat" is running and arduino behaves correctly

it is however annoying that - to issue a command (send a character) - I have to open another terminal and keep cat open

any idea?




I would think that the cat session is holding the Arduino serial port open. Without that, each time you echo a character to the port, the Arduino will be doing its serial port open auto-reset. http://arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection might help.


hello, this is an old post but google is pointing here.

I found a workaround for this problem on the web.
On the openwrt console you must type :

cat /dev/ttyACM0 &

( the & symbol will keep executing this command but in background preventing the reset )

You can add it in a script at boot.

Go Up