0
votes

I'm writing a linux program which interact with gsm modem through AT-commands. Sometimes the modem respond on at+cmgl="all" command and return sms messages, sometimes the modem doesn't respond on this command(no answer, no ok, no error).

I use Python and pySerial, but it doesn't matter, because I tested the modem via bash terminal, send commands to the modem via echo and read answers from the modem via cat /dev/ttyUSB0. The same situation (sometimes it responds, sometimes not).

1
Do you send AT+CMGF=1 before you attempt to retrieve the messages?dbasnett
You probably need to check if modem is really in command mode, by sending a simple "AT" null command and getting an "OK" response.sawdust
dbasnett, yes. sawdust, I have sent AT command and have got OK in response. But the modem doesn't answer to AT+CMGL="ALL" command sometimes.George
Just to make sure, you always use the string "ALL" and not "all" (because "ALL" is the only correct choice)?hlovdal
hlovdal, I use both variants, and the modem answers "ALL" and "all" commands, and sometimes it answers neither "ALL" nor "all" commands.George

1 Answers

0
votes
private void button3_Click(object sender, EventArgs e)
{
    po.Write("AT+CHUP"+Environment.NewLine);
    po.Close();
    button3.Enabled = false;
    button1.Enabled = true;
}