Regarding GSM modem integration with BeagleBoard

I have purchased a GSM modem, and I am trying to interface it with
I have achieved the task, but am facing some problem.
When we send the command "AAT" to the modem, it replies 'only once'
via sending back "OK".
I am using following command to see whether it send s "OK" or not.

echo "AAT">/dev/ttyUSB0; cat /dev/ttyUSB0/a.txt

After writing this command in the terminal it keeps on waiting until I
press Ctrl+C (please tell why does it happen) and when I write

cat a.txt

The file contains not only "OK", but also "ERROR" message (number of
Can anybody suggest me why is this happening?

The modem works well on terminals like putty or DockLight.

I think when you do cat /dev/ttyUSB0>a.txt it will keep trying to read
from ttyUSB0 until you interrupt it.

When I was trying to get my modem working on Beagle I used minicom on the
Beagle for testing how the modem was responding.


Indeed the modem file is a character device and not a regular file so an EOF isn’t flagged which means the read() function call inside of the cat command blocks waiting for more data to arrive.

You need to use a command that closes the file handle after the required input has been read, e.g. “head -1 /dev/ttyUSB0”. The following is also quite useful “read -t2 VARIABLE < /dev/modem” which will read a line from /dev/modem but times out after 2 seconds if there isn’t any data…

echo "AAT">/dev/ttyUSB0; cat /dev/ttyUSB0/a.txt

I do not know what "AAT" means; the "ATtention" codes begin with "AT", anything else gives out an error. Also, that "cat" command is weird (I think you wanted to say "cat /dev/ttyUSB0 | head -1" or something like that).

Also, keep in mind that the AT command string must be terminated by CR (character 13, "\r"), not by LF (character 10, "\n"). When you use putty or similar stuff, pressing Enter will produce a CR, so you will see all AT-commands working.

Closing/reopening the tty (first "echo" then "cat") may loose characters; you will have to write some software (in C) that opens, sends a command, waits for answer, writes next command, etc.

If you only need to connect to the internet, you may use "pppd" command-line arguments.