Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to send and receive SMS via AT-Command with nokia E63 ?

218 views
Skip to first unread message

dongtrien

unread,
Nov 12, 2015, 1:25:04 AM11/12/15
to

How have you know to send and receive messages via batch scripts for
nokia E63 AT-Command ?




--
dongtrien

John Henderson

unread,
Nov 12, 2015, 2:16:50 PM11/12/15
to
dongtrien wrote:

> How have you know to send and receive messages via batch scripts for
> nokia E63 AT-Command ?

Do you have an AT command interface open?

If so, what does the command

AT+CMGF?

return?

dongtrien

unread,
Nov 13, 2015, 7:25:03 AM11/13/15
to

'John Henderson[_2_ Wrote:
> ;511528']dongtrien wrote:
> -
> How have you know to send and receive messages via batch scripts for
> nokia E63 AT-Command ?-
>
> Do you have an AT command interface open?
>
> If so, what does the command
>
> AT+CMGF?
>
> return?


i'm use

AT
OK
AT+CMGF=1
OK
AT+CMGS="0902563xxx"
OK
> you sent something...
>


return OK, but why i not found Incoming message to the phone number
0902563xxx ?




--
dongtrien

John Henderson

unread,
Nov 13, 2015, 2:03:42 PM11/13/15
to
dongtrien wrote:

> i'm use
>
> AT
> OK
> AT+CMGF=1
> OK
> AT+CMGS="0902563xxx"
> OK
>> you sent something...
>>
>
> return OK, but why i not found Incoming message to the phone number
> 0902563xxx ?

When you enter the command:

AT+CMGS="0902563xxx"

the E63 should reply with a ">" prompt. At that point, you type
the text to be sent, but you don't press the <Enter> key.

Instead, you give the E63 the ctrl-Z character. This is
character 26 decimal.

The E63 should then respond by sending the text and giving you a
message reference number, like this:

+CMGS: 44

Unless you get that reference number, you should assume that the
SMS was not sent.

What preference have you got set for the SMS carrier moce,
circuit-switched or packet-switched? The command:

AT+CGSMS?

will tell us.

dongtrien

unread,
Nov 14, 2015, 7:25:04 AM11/14/15
to

'John Henderson[_2_ Wrote:
> ;511530']dongtrien wrote:
> -
> i'm use
>
> AT
> OK
> AT+CMGF=1
> OK
> AT+CMGS="0902563xxx"
> OK-
> you sent something...
> -
>
> return OK, but why i not found Incoming message to the phone number
> 0902563xxx ?-
>
> When you enter the command:
>
> AT+CMGS="0902563xxx"
>
> the E63 should reply with a "" prompt. At that point, you type
> the text to be sent, but you don't press the Enter key.
>
> Instead, you give the E63 the ctrl-Z character. This is
> character 26 decimal.
>
> The E63 should then respond by sending the text and giving you a
> message reference number, like this:
>
> +CMGS: 44
>
> Unless you get that reference number, you should assume that the
> SMS was not sent.
>
> What preference have you got set for the SMS carrier moce,
> circuit-switched or packet-switched? The command:
>
> AT+CGSMS?
>
> will tell us.


thank you, I forgot to type Ctrl-Z character, I now It send good with
hyperterminal but I changed to language C#.net, it was error "Response
received is incomplete," you see my code committee know why ? note: E63
modem connected to very good


Code:
--------------------

public bool sendMsg(SerialPort port, string PhoneNo, string Message)
{
bool isSend = false;

try
{
string recievedData = ExecCommand(port,"AT", 300, "No phone connected"); // Error here: recievedData = "Response received is incomplete"
recievedData = ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.");
String command = "AT+CMGS=\"" + PhoneNo + "\"";
recievedData = ExecCommand(port,command, 300, "Failed to accept phoneNo");
command = Message + char.ConvertFromUtf32(26) + "\r";
recievedData = ExecCommand(port,command, 3000, "Failed to send message"); //3 seconds
if (recievedData.EndsWith("\r\nOK\r\n"))
{
isSend = true;
}
else if (recievedData.Contains("ERROR"))
{
isSend = false;
}
return isSend;
}
catch (Exception ex)
{
throw ex;
}

}

public string ExecCommand(SerialPort port,string command, int responseTimeout, string errorMessage)
{
try
{

port.DiscardOutBuffer();
port.DiscardInBuffer();
receiveNow.Reset();
port.Write(command + "\r");

string input = ReadResponse(port, responseTimeout);
if ((input.Length == 0) || ((!input.EndsWith("\r\n> ")) && (!input.EndsWith("\r\nOK\r\n"))))
throw new ApplicationException("No success message was received.");
return input;
}
catch (Exception ex)
{
throw ex;
}
}

public string ReadResponse(SerialPort port,int timeout)
{
string buffer = string.Empty;
try
{
do
{
if (receiveNow.WaitOne(timeout, false))
{
string t = port.ReadExisting();
buffer += t;
}
else
{
if (buffer.Length > 0)
throw new ApplicationException("Response received is incomplete.");
else
throw new ApplicationException("No data received from phone.");
}
}
while (!buffer.EndsWith("\r\nOK\r\n") && !buffer.EndsWith("\r\n> ") && !buffer.EndsWith("\r\nERROR\r\n"));
}
catch (Exception ex)
{
throw ex;
}
return buffer;
}

--------------------




--
dongtrien

John Henderson

unread,
Nov 14, 2015, 2:36:58 PM11/14/15
to
dongtrien wrote:

>
> thank you, I forgot to type Ctrl-Z character, I now It send good with
> hyperterminal but I changed to language C#.net, it was error "Response
> received is incomplete," you see my code committee know why ? note: E63
> modem connected to very good
>
>
> Code:
> --------------------
>
> public bool sendMsg(SerialPort port, string PhoneNo, string Message)
> {
> bool isSend = false;
>
> try
> {
> string recievedData = ExecCommand(port,"AT", 300, "No phone connected"); // Error here: recievedData = "Response received is incomplete"
> recievedData = ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.");
> String command = "AT+CMGS=\"" + PhoneNo + "\"";
> recievedData = ExecCommand(port,command, 300, "Failed to accept phoneNo");
> command = Message + char.ConvertFromUtf32(26) + "\r";

There should be no "\r" after the ctrl-Z. If fact you seem to be
sending two of them - there's one immediately above, and there's
another one being sent from within your "ExecCommand" subroutine.

What you should be doing after the ctrl-Z is flushing the output buffer
(pushing the "Message + char.ConvertFromUtf32(26)" out to the modem).

Do not send "\r" or any other character to the E63 until after you've
received the message reference number.

> recievedData = ExecCommand(port,command, 3000, "Failed to send message"); //3 seconds
> if (recievedData.EndsWith("\r\nOK\r\n"))
> {
> isSend = true;
> }
> else if (recievedData.Contains("ERROR"))
> {
> isSend = false;
> }
> return isSend;
> }
> catch (Exception ex)
> {
> throw ex;
> }
>
> }
>
> public string ExecCommand(SerialPort port,string command, int responseTimeout, string errorMessage)
> {
> try
> {
>
> port.DiscardOutBuffer();
> port.DiscardInBuffer();
> receiveNow.Reset();
> port.Write(command + "\r");

My suggestion is to remove that "\r" here, and pass it to this
subroutine as the last character of the string variable "command"
instead (but only where required).

Then flush the output buffer to the E63. Normally, sending a "\r" will
do that automatically. But terminating with a crtl-Z probably doesn't
result in a flush, so you'll need to perform that step specifically.

> string input = ReadResponse(port, responseTimeout);
> if ((input.Length == 0) || ((!input.EndsWith("\r\n> ")) && (!input.EndsWith("\r\nOK\r\n"))))
> throw new ApplicationException("No success message was received.");
> return input;
> }
> catch (Exception ex)
> {
> throw ex;
> }
> }
>
> public string ReadResponse(SerialPort port,int timeout)
> {
> string buffer = string.Empty;
> try
> {
> do
> {
> if (receiveNow.WaitOne(timeout, false))
> {
> string t = port.ReadExisting();
> buffer += t;
> }
> else
> {
> if (buffer.Length > 0)
> throw new ApplicationException("Response received is incomplete.");
> else
> throw new ApplicationException("No data received from phone.");
> }
> }
> while (!buffer.EndsWith("\r\nOK\r\n") && !buffer.EndsWith("\r\n> ") && !buffer.EndsWith("\r\nERROR\r\n"));
> }
> catch (Exception ex)
> {
> throw ex;
> }
> return buffer;
> }
>
> --------------------

I hope that makes sense. Good luck.

John

John Henderson

unread,
Nov 14, 2015, 2:49:24 PM11/14/15
to
dongtrien wrote:

> thank you, I forgot to type Ctrl-Z character, I now It send good with
> hyperterminal but I changed to language C#.net, it was error "Response
> received is incomplete," you see my code committee know why ? note: E63
> modem connected to very good

> string recievedData = ExecCommand(port,"AT", 300, "No phone connected"); // Error here: recievedData = "Response received is incomplete"

If that's the only place you're getting the "Response received is
incomplete" response, I wouldn't be concerned. We don't know the exact
state of the E63 and its input buffer when you send it the first command.

Just send it "AT\r" again (after a pause) - it should work the second
time.

John

John Henderson

unread,
Nov 14, 2015, 6:13:44 PM11/14/15
to
dongtrien wrote:

> char.ConvertFromUtf32(26)

If you have further problems, please check this.

I'm not familiar with that language. Does this expression give you an
8-bit ASCII character

You need it to be giving you the character that is the 8 binary bits
"00011010". That's what the E63 will be expecting.

John

dongtrien

unread,
Nov 16, 2015, 1:25:03 AM11/16/15
to

Thank you for answering, I was okay. Now I have a problem when using the
AT+STGR=6,1,1
I can not get + STIN: 9 in language C#. I run scripts AT in the
HyperTerminal no error.


Code:
--------------------

AT
OK

AT+STGR=6,1,1
OK

+STIN: 9
...


--------------------


Code C#

Code:
--------------------

try
{
string recievedData = ExecCommand(port, "at", 300, "No phone connected at .");
Debug.Print(recievedData.ToString());
recievedData = ExecCommand(port, "at+stgi=0", 300, "Failed to SIM Toolkit Get Information.");
Debug.Print(recievedData.ToString());
recievedData = ExecCommand(port, "at+stgr=6,1,1", 300, "Failed to SIM Toolkit Give Response.");
Debug.Print(recievedData.ToString()); //Error here: No success message was received.
...
}
...


when I debug C# output:
at
OK

at+stgi=0
+STGI: "APP SIM TOOLKIT"
+STGI: 6,4,"xxx...",0
+STGI: 7,4,"yyy...",0
+STGI: 8,4,"zzz...",0
+STGI: 9,4,"Languge",0
OK

at+stgr=0,6,1
OK

the variable recievedData is not get +STIN:9 and output: No success message was received.


--------------------




--
dongtrien

John Henderson

unread,
Nov 16, 2015, 3:09:46 AM11/16/15
to
dongtrien wrote:

> recievedData = ExecCommand(port, "at+stgr=6,1,1", 300, "Failed to SIM Toolkit Give Response.");

> the variable recievedData is not get +STIN:9 and output: No success message was received.

In what units is the timeout paramater of 300?

Are you giving the device enough time to respond?

John

dongtrien

unread,
Nov 17, 2015, 1:25:03 AM11/17/15
to

'John Henderson[_2_ Wrote:
> ;511541']dongtrien wrote:
> -
> recievedData = ExecCommand(port, "at+stgr=6,1,1", 300, "Failed to SIM
> Toolkit Give Response.");-
> -
> the variable recievedData is not get +STIN:9 and output: No success
> message was received.-
>
> In what units is the timeout paramater of 300?
>
> Are you giving the device enough time to respond?
>
> John

you're right, not enough time to run, according to your time for this
case how much ? and the calculation of time so that the most appropriate
?




--
dongtrien

John Henderson

unread,
Nov 17, 2015, 2:42:45 AM11/17/15
to
dongtrien wrote:

> you're right, not enough time to run, according to your time for
this
> case how much ? and the calculation of time so that the most
appropriate

You'll need to experiment. Perhaps time it when you run it through
HyperTerminal. Run it a few times, and double the longest time.

That's what I'd do, and think about decreasing or increasing the
time later with more experience.

John

dongtrien

unread,
Nov 18, 2015, 1:25:03 AM11/18/15
to

'John Henderson[_2_ Wrote:
> ;511549']dongtrien wrote:
> -
> you're right, not enough time to run, according to your time for -
> this-
> case how much ? and the calculation of time so that the most -
> appropriate
>
> You'll need to experiment. Perhaps time it when you run it through
> HyperTerminal. Run it a few times, and double the longest time.
>
> That's what I'd do, and think about decreasing or increasing the
> time later with more experience.
>
> John


I think to have one certain way for rational calculation, if farming
experience unreasonable because I think when I programmed the computer
to run more, which means that it runs on all computers with the lowest
configuration or maximum




--
dongtrien

John Henderson

unread,
Nov 18, 2015, 1:48:10 AM11/18/15
to
dongtrien wrote:

> I think to have one certain way for rational calculation, if farming
> experience unreasonable because I think when I programmed the computer
> to run more, which means that it runs on all computers with the lowest
> configuration or maximum

If you're concerned about waiting too long for a response, then you could
pass another parameter along with the timeout time.

Pass a string argument containing some text which lets the reading routine
return earlier than the timeout time permits (return instead when the string
is found).

For many AT commands, this could be the string "\r\nOK\r\n".

In the special case we're considering, look for the string "+STIN:" and
return when it's found. Then you can make the timeout value large, without
ever having to wait for it to expire.

John

dongtrien

unread,
Nov 20, 2015, 1:25:04 AM11/20/15
to

thank you for pointing help, I had a problem anymore, after registering
successfully sim, group of AT command to get the information of sim and
the serial number has been registered successfully obtain such
information chain posted successful sign ? eg:

'128 12/11/11,15:19:16+28 You signed up for the subscription number
019861xxxx success. Trading code 0123xxxxx




--
dongtrien

John Henderson

unread,
Nov 20, 2015, 2:25:27 AM11/20/15
to
I'm sorry, but I do not understand what it is you are saying.

If it is important, or you have further questions, please try again.

John

dongtrien

unread,
Nov 21, 2015, 1:25:04 AM11/21/15
to

'John Henderson[_2_ Wrote:
> ;511557']dongtrien wrote:
> -
> thank you for pointing help, I had a problem anymore, after
> registering
> successfully sim, group of AT command to get the information of sim
> and
> the serial number has been registered successfully obtain such
> information chain posted successful sign ? eg:
>
> '128 12/11/11,15:19:16+28 You signed up for the subscription -
> number-
> 019861xxxx success. Trading code 0123xxxxx-
>
> I'm sorry, but I do not understand what it is you are saying.
>
> If it is important, or you have further questions, please try again.
>
> John

my english is not very good, assuming you have 2 SIM: SIM1 and SIM2, you
use SIM1 to view information such as the date of registration of SIM2
through at command are not ? if the syntax like? do you understand ?




--
dongtrien

John Henderson

unread,
Nov 21, 2015, 5:17:55 PM11/21/15
to
dongtrien wrote:

> my english is not very good,

That's OK.

> assuming you have 2 SIM: SIM1 and SIM2, you use SIM1 to view
> information such as the date of registration of SIM2 through
> at command are not ? if the syntax like? do you understand ?

I see that the E63 is a dual-SIM phone (it takes two SIMs).

I do not have an E63, and I have not used any dual-SIM device. I haven't
found any "AT Command Reference" which talks about Nokia dual-SIM
capability, so I don't think I can be of much help.

John


dongtrien

unread,
Nov 24, 2015, 7:25:04 AM11/24/15
to

'John Henderson[_2_ Wrote:
> ;511562']dongtrien wrote:
> -
> my english is not very good,-
>
> That's OK.
> -
> assuming you have 2 SIM: SIM1 and SIM2, you use SIM1 to view
> information such as the date of registration of SIM2 through
> at command are not ? if the syntax like? do you understand ?-
>
> I see that the E63 is a dual-SIM phone (it takes two SIMs).
>
> I do not have an E63, and I have not used any dual-SIM device. I
> haven't
> found any "AT Command Reference" which talks about Nokia dual-SIM
> capability, so I don't think I can be of much help.
>
> John

I do not have an E63 a dual-SIM phone, you do not understand me. I want
to ask the phone number you are using you can see the date of
registration of the telephone number you are every day through the AT
command ?




--
dongtrien

John Henderson

unread,
Nov 24, 2015, 8:58:24 AM11/24/15
to
dongtrien wrote:

> I do not have an E63 a dual-SIM phone, you do not understand me. I want
> to ask the phone number you are using you can see the date of
> registration of the telephone number you are every day through the AT
> command ?

The phone number might not be stored on the SIM at all. It isn't used by
the phone for any purpose. Instead, the phone uses the IMSI to identify
the
SIM.

If the phone number for a SIM is stored on the SIM., it will be stored as
the first number in the "Own Numbers" phone book.

Read the IMSI with the command:

AT+CIMI

Read the first entry in the "Own Numbers" phonebook (if it's there) with:

AT+CNUM

If you need to write the SIM's phone number to the SIM, first select the
"Own Numbers" phonebook with:

AT+CPBS="ON"

Then write the number as the first entry. If that number is "+61412345678"
(international format), the command is:

AT+CPBW=1,"+61412345678",145,"Own Nbr"

If the number is "0412345678" (national or "local" format), the command is:

AT+CPBW=1,"0412345678",129,"Own Nbr"

Usually, you would store the SIM's own number in international format, so
145 for type-of-number.

John

John Henderson

unread,
Nov 24, 2015, 5:02:32 PM11/24/15
to
dongtrien wrote:

> I want to ask the phone number you are using you can see the date of
> registration of the telephone number you are every day through the AT
> command ?

Dates of events is not information which is normally stored on the phone or
SIM. Exceptions would include SMS and call date/times.

So I wonder if the information you want might be available through USSD
(Unstructures Supplementary Service Data). If it is, we should be able to
read it using AT commands.

Have you seen the information you want on your phone's screen? If so, what
did you enter on the phone's keypad to get the information.

Otherwise, please tell me the first five digits of your SIM's IMSI, and I'll
see what USSD codes I can find for your provider.

That's the five digits on the left in the result from:

AT+CIMI

John


dongtrien

unread,
Dec 2, 2015, 7:25:03 AM12/2/15
to

Thank you for helping me




--
dongtrien

John Henderson

unread,
Dec 2, 2015, 2:36:36 PM12/2/15
to
dongtrien wrote:

> Thank you for helping me

You are welcome. I hope all your questions have been answered and all of
your problems solved.

John

dongtrien

unread,
Dec 4, 2015, 7:25:03 AM12/4/15
to

'John Henderson[_2_ Wrote:
> ;511572']dongtrien wrote:
> -
> Thank you for helping me-
>
> You are welcome. I hope all your questions have been answered and all
> of
> your problems solved.
>
> John

I was one more question after I sent a message successfully. I use
command at: at+cmgr=2 to get (or check) the message successfully status
but it's error. you know why not ? follow you no way to get the status
message sent with success ?

Code:
--------------------

AT
OK

AT+CMGF=1
OK

AT+CMGS="0196704xxxx"
> you sent something... + char(26) (or <CTRL-Z>)
OK

at+cmgr=2
ERROR // warning error here

--------------------




--
dongtrien

John Henderson

unread,
Dec 4, 2015, 3:21:53 PM12/4/15
to
dongtrien wrote:

> I was one more question after I sent a message successfully. I use
> command at: at+cmgr=2 to get (or check) the message successfully status
> but it's error. you know why not ? follow you no way to get the status
> message sent with success ?
>
> Code:
> --------------------
>
> AT
> OK
>
> AT+CMGF=1
> OK
>
> AT+CMGS="0196704xxxx"
> > you sent something... + char(26) (or <CTRL-Z>)
> OK
>
> at+cmgr=2
> ERROR // warning error here
>
> --------------------

The command AT+CMGR=2 reads the message with an <index> of "2" from
whatever message storage you've presently got set. In your case, it seems
that there's no message stored there with an <index> of "2".

When you sent the message with your AT+CMGF command, you will have got a
message reference number <mr> in a result:

+CMGS: <mr>

The fact that you've received an <mr> number means that your SMS was sent
successfully. It was accepted by the SMSC and delivery attempts will start
in due course.

Note that <index> and <mr> are entirely different things, and bear
absolutely no relationship to each other.

What exactly are you trying to do when you issue the AT+CMGR=2 command?

Are you trying to find out whether your message reference <mr> has been
delivered yet?

John

dongtrien

unread,
Dec 6, 2015, 7:25:02 AM12/6/15
to

I did it. when I send many messages, the first good run but the 2nd
repeated with a different phone number will be error: "No data received
from phone", I have increased 10-fold time but still getting this error,
if I send each message is good but sent many will fail. What advice do
you have for me ? I do not understand why this error occurred




--
dongtrien

John Henderson

unread,
Dec 8, 2015, 5:05:39 PM12/8/15
to
I don't really know where to begin.

You did give some code earlier, but it is incomplete. And the programming
language is not one I use myself, so I'm unsure about the finer points of
syntax.

As I understand it, the phone interface has become silent, and you are
getting no characters back from it at all. Is this correct? And if so,
what have you got to do to get it running again? Restart your software, or
restart your phone?

Are you opening the AT command port more than once? If so, are you closing
it before you open it again?

Did you write this software yourself? Or are you trying to adapt something
from another source? If you wrote it all yourself, you should know enough
to insert some debugging print statements to help narrow down the area of
code that's close to where the problem becomes apparent.

John

dongtrien

unread,
Dec 9, 2015, 1:25:12 AM12/9/15
to

I have not experienced in script at, I read the document and then write
code with C#. I've found the cause the export notification code below
via HyperTerminal, but I do not know why this command output: "+CMTI:
"SM", 1" ? Can you help me understand the script at ? do you know the
script at any command can be output: "+CMTI: "SM", 1" ?

Code:
--------------------

...
+STGI: ""
OK

at
OK

+STIN: 1

+STIN: 98

+STIN: 99


--------------------




--
dongtrien

John Henderson

unread,
Dec 9, 2015, 2:17:54 AM12/9/15
to
dongtrien wrote:

> I have not experienced in script at, I read the document and then write
> code with C#. I've found the cause the export notification code below
> via HyperTerminal, but I do not know why this command output: "+CMTI:
> "SM", 1" ? Can you help me understand the script at ? do you know the
> script at any command can be output: "+CMTI: "SM", 1" ?

That's an unsolicited result which results from your AT+CNMI settings.

It's telling you that an SMS has arrived, that it is stored on the SIM, and
that its <index> value is 1.

What does

AT+CNMI?

return?

John

dongtrien

unread,
Dec 10, 2015, 1:25:16 PM12/10/15
to

'John Henderson[_2_ Wrote:
> ;511627']
> That's an unsolicited result which results from your AT+CNMI settings.
>
> It's telling you that an SMS has arrived, that it is stored on the SIM,
> and
> that its index value is 1.
>
> What does
>
> AT+CNMI?
>
> return?
>
> John

I tried to order at which you just help me, resulting in lower

Code:
--------------------

at

OK


at+cnmi

ERROR


at+cnmi?
+CNMI: 0,1,0,0,0
OK


at+cnmi=?
+CNMI: (0-3),(0-3),(0-3),(0-2),(0,1)
OK

--------------------

compare with document my reading is not the same: "+CMTI: "SM", 1"
I typed syntax: at+cnmi are correct okay with the error message ?




--
dongtrien

John Henderson

unread,
Dec 10, 2015, 3:20:33 PM12/10/15
to
dongtrien wrote:

>   at+cnmi?
>   +CNMI: 0,1,0,0,0
>   OK

> compare with document my reading is not the same: "+CMTI: "SM", 1"
> I typed syntax: at+cnmi are correct okay with the error message ?

Do you want these unsolicited SMS notifications?  If you want to turn them 
off completely, try:

        AT+CNMI=0,0,0,0,0

John

John Henderson

unread,
Dec 10, 2015, 3:33:39 PM12/10/15
to
ongtrien wrote:

>   at+cnmi?
>   +CNMI: 0,1,0,0,0
>   OK

> compare with document my reading is not the same: "+CMTI: "SM", 1"
> I typed syntax: at+cnmi are correct okay with the error message ?

See 3GPP 27.005, section 3.4.1, which says (for an <mt> value of "1" like 
you have):

"If SMS-DELIVER is stored into ME/TA, indication of the memory location
is routed to the TE using unsolicited result code:

+CMTI: <mem>,<index>"

John

dongtrien

unread,
Dec 11, 2015, 1:25:08 PM12/11/15
to

'John Henderson[_2_ Wrote:
> ;511845']dongtrien wrote:
> -
> ***at+cnmi?
> ***+CNMI: 0,1,0,0,0
> ***OK-
> -
> compare with document my reading is not the same: "+CMTI: "SM", 1"
> I typed syntax: at+cnmi are correct okay with the error message ?-
>
> Do you want these unsolicited SMS notifications?**If you want to turn
> them*
> off completely, try:
>
> ********AT+CNMI=0,0,0,0,0
>
> John

I want to know what my type at commands that output results: "+CMTI:
"SM", 1"




--
dongtrien

John Henderson

unread,
Dec 11, 2015, 2:56:41 PM12/11/15
to
dongtrien wrote:

> I want to know what my type at commands that output results: "+CMTI:
> "SM", 1"

It is your current settings that are giving you this unsolicited result.
You do not give another AT command to receive it.

Your phone is configured as if you had given it the command:

AT+CNMI=0,1,0,0,0

That command does not generate a "+CMTI:" result immediately - you have to
wait until an SMS arrives and gets stored in SIM storage index slot number
1.

If SIM storage <index> 1 is still in use when the next incoming SMS arrives,
it will get stored in slot 2 and generate the unsolicited result:

+CMTI: > "SM", 2

and so on.

These "+CMTI:" results are unsolicited. Once you've activated them using:

AT+CNMI=0,1,0,0,0

they will be given every time an SMS arrives. This is what "unsolicited"
means.

You can turn off these "+CMTI:" results with the command:

AT+CNMI=0,0,0,0,0

and you won't get any more of them. Then new SMSs will arrive silently.

John

John Henderson

unread,
Dec 12, 2015, 5:13:38 PM12/12/15
to
I wrote:

> If SIM storage <index> 1 is still in use when the next incoming SMS
> arrives, it will get stored in slot 2 and generate the unsolicited result:
>
> +CMTI: > "SM", 2

Of course, that should read:

+CMTI: "SM", 2

And this isn't the only unsolicited result type which can be generated by
the AT+CNMI... command. Others are:

+CMT:

+CBMI:

+CBM:

+CDSI:

+CDS:

John


dongtrien

unread,
Dec 15, 2015, 1:25:04 AM12/15/15
to

follow me understand. I do for example with HyperTerminal the following
lines but "+CMTI: "SM",x" does not work. Do you look my at command
correct ?


Code:
--------------------

AT
AT+CMGF=1
AT+CMGS="0196704xxxx"
> you sent something... + char(26) (hoac <CTRL-Z>)

AT
OK
+STIN: 98
+STIN: 99

AT+CMGF=1
OK

AT+CPMS="SM"
OK

AT+CMGL="ALL"
OK

+CMTI: "SM",x // why "+CMTI: "SM",x" does not appear in here Or "+CMTI: "SM",x" not working

AT+CMGR=x
AT+CMGD=x

--------------------




--
dongtrien

John Henderson

unread,
Dec 15, 2015, 2:10:00 AM12/15/15
to
dongtrien wrote:

>
>
> follow me understand. I do for example with HyperTerminal the following
> lines but "+CMTI: "SM",x" does not work. Do you look my at command
> correct ?
>
>
> Code:
> --------------------
>
> AT
> AT+CMGF=1
> AT+CMGS="0196704xxxx"
> > you sent something... + char(26) (hoac <CTRL-Z>)
>
> AT
> OK
> +STIN: 98
> +STIN: 99

Are you expecting these +STIN: unsolicited responses? They seem to be
coming from an active SIM Application Toolkit session.

I don't think they are related to your +CMTI: responses, but I'm not 100%
sure.

What does:

AT+STSF?

return?

> AT+CMGF=1
> OK
>
> AT+CPMS="SM"
> OK
>
> AT+CMGL="ALL"
> OK
>
> +CMTI: "SM",x // why "+CMTI: "SM",x" does not appear in here Or "+CMTI:
> "SM",x" not working

Are you expecting a +CMTI: result here?

Did you just receive an SMS? If you did, and you previously issued a

AT+CNMI=0,1,0,0,0

command, then receiving an SMS should have triggered an +CMTI: result.

AT+CMGL="ALL" does not trigger an +CMTI: result.

If we are misunderstanding each other, it might be best if you tell me
exactly what you are trying to do.

John

dongtrien

unread,
Dec 16, 2015, 1:25:04 AM12/16/15
to

'John Henderson' Wrote:
>
> What does:
>
> AT+STSF?
>
> return?
>
> Are you expecting a +CMTI: result here?
>
> Did you just receive an SMS? If you did, and you previously issued a
>
> AT+CNMI=0,1,0,0,0
>
> command, then receiving an SMS should have triggered an +CMTI: result.
>
> AT+CMGL="ALL" does not trigger an +CMTI: result.
>
> If we are misunderstanding each other, it might be best if you tell me
> exactly what you are trying to do.
>
> John

I am doing active SIM and send SMS into one common program, if not
forced me to split them into two separate programs, one is active SIM
the rest is sent SMS message. I am expecting the results +CMTI: after
active SIM but I do not get results "+CMTI:"; I have tried many ways to
get the results of "+CMTI:" as:

Code:
--------------------

AT+CNMI?
+CNMI: 0,1,0,0,0
OK

Or

AT+CNMI=0,1,0,0,0
OK

--------------------

they only result "OK", they do not have "+ CMTI:"

you ask me the results returned by
AT+STSF?
+STSF: 1,"5FFFFFFF7F",3,0
OK

Have you got for example activate SIM with at command ?




--
dongtrien

John Henderson

unread,
Dec 18, 2015, 3:45:28 AM12/18/15
to
dongtrien wrote:

> I am doing active SIM and send SMS into one common program, if not
> forced me to split them into two separate programs, one is active SIM
> the rest is sent SMS message. I am expecting the results +CMTI: after
> active SIM but I do not get results "+CMTI:"; I have tried many ways to
> get the results of "+CMTI:" as:

> Code:
> --------------------
>     
>   AT+CNMI?
>   +CNMI: 0,1,0,0,0
>   OK
>   
>   Or
>   
>   AT+CNMI=0,1,0,0,0
>   OK
>   
> --------------------

> they only result "OK", they do not have "+ CMTI:"

What are you expecting the "+CMTI:" result to tell you?

What information are you trying to get from it?

Why do you think you should be getting a "+CMTI:" result at that point in 
time?

> you ask me the results returned by
> AT+STSF?
> +STSF: 1,"5FFFFFFF7F",3,0
> OK

I have been intending to decode this, but haven't managed to do that yet - 
sorry for the delay.

> Have you got for example activate SIM with at command ?

What exactly do you mean by "activate SIM"?  Are you trying to change active 
SIMs on a dual-SIM device?

John

John Henderson

unread,
Dec 19, 2015, 4:31:26 AM12/19/15
to
dongtrien wrote:

> you ask me the results returned by
> AT+STSF?
> +STSF: 1,"5FFFFFFF7F",3,0
> OK

Working through these returned arguments:

1 - SIM Application Toolkit is active

"5FFFFFFF7F" - Your Terminal Profile.  Nothing special here.

3 - Timeout for user responses is 30 seconds (3 * 10).

0 - Automatic response is not activated.

John

John Henderson

unread,
Dec 20, 2015, 2:33:05 PM12/20/15
to
dongtrien wrote:

> active SIM but I do not get results "+CMTI:"; I have tried many ways to
> get the results of "+CMTI:" as:
>
> Code:
> --------------------
>
> AT+CNMI?
> +CNMI: 0,1,0,0,0
> OK
>
> Or
>
> AT+CNMI=0,1,0,0,0
> OK

Let me put what I've been saying another way.

Are you trying to solicit a response by giving versions of the AT+CNMI
command?

If so, those attempts will always fail, because the command does not
give solicited SMS results. It gives only unsolicited results.

If you want to solicit a response which gives you info about stored
SMSs, you need to use some form of the AT+CMGL command instead.

John

dongtrien

unread,
Dec 21, 2015, 1:25:04 AM12/21/15
to

do you know software can replace HyperTerminal because each I run have
to enter the commands at many times, I want to put these commands at
into one file and use equivalent software HyperTerminal to run, you know
what that software name and the link can download ?




--
dongtrien

John Henderson

unread,
Dec 21, 2015, 7:49:24 AM12/21/15
to
Have you looked at PuTTY?

http://www.putty.org/

I use Linux, so I'm not very up-to-date on what's available for Windows. I
sometimes use the Linux program picocom.

If you are a good programmer, you can adapt that program of yours to make
your own HyperTerminal replacement - especially if you just need a command-
line replacement.

John

dongtrien

unread,
Dec 22, 2015, 7:25:04 AM12/22/15
to

You introduce software is hard to use, I need software like
HyperTerminal but be run one script file containing at me typping

if I use the command AT+CMGR = x, Can you know what's command at that
index x ?




--
dongtrien

John Henderson

unread,
Dec 22, 2015, 3:42:01 PM12/22/15
to
dongtrien wrote:

> You introduce software is hard to use, I need software like
> HyperTerminal but be run one script file containing at me typping

I'm not sure what you want. Something which will accept input from a file,
but allow you some interaction too?

You might need to write your own to achieve that.

> if I use the command AT+CMGR = x, Can you know what's command at that
> index x ?

In text-mode (when AT+CMGF=1), you can get the index value from the
appropriate one of these commands:

AT+CMGL="REC UNREAD"
AT+CMGL="REC READ"
AT+CMGL="STO UNSENT"
AT+CMGL="STO SENT"
AT+CMGL="ALL"

You need to have the correct storage selected for these commands to work.
For the current storage setting, use:

AT+CPMS?

Be aware that either the "REC UNREAD" or "ALL" arguments will change the
status of any received UNREAD message to READ.

If a new SMS arrives and you have unsolicited results turned on correctly,
then you will be given the index value immediately via an unsolicited
"+CTMI: <mem>,<index>" result. This is the only circumstance where you will
get such a result.

John

dongtrien

unread,
Dec 25, 2015, 7:25:04 AM12/25/15
to

thank you for pointing help !

I would like to ask more. you try to connect your smartphone with
HyperTerminal, smartphones do not support connecting with HyperTerminal
of winxp ?




--
dongtrien

John Henderson

unread,
Dec 25, 2015, 2:52:48 PM12/25/15
to
dongtrien wrote:

> I would like to ask more. you try to connect your smartphone with
> HyperTerminal, smartphones do not support connecting with HyperTerminal
> of winxp ?

As I understand it, that is correct.

Sadly, smartphones do not have a command interface where you can enter AT 
commands.

You need to install specific "apps" if you want to have the functionality 
which AT commands give you on older phones.

John

dongtrien

unread,
Dec 30, 2015, 7:25:03 AM12/30/15
to

I ask you to send a message, I have successfully sent a message less
than or equal 160 characters with the syntax:

case 1: Message less than or equal 160 characters:

Code:
--------------------

0 <Message less than or equal 160 // the string less than or equal 160 characters

AT
OK

AT + CMGF = 1
OK

AT + CSCS = "PCCP437"
OK

AT + CMGS = "0196704xxxx"
*> Message (control + z)
OK

--------------------



case 2:
I did not send the message length> 160 characters Syntax:


Code:
--------------------

Message2 bigger 160 characters

AT
OK

AT + CMGF = 1
OK

AT + CSCS = "PCCP437"
OK

i = 0; // Calculate the chain length
Substring2 = ""; // String, less than or equal 160 characters
while (i less than Message2.Length)
{
*****AT + CMGS = "0196704xxxx"
*****if (i + 159 <Message2.Length)
*****{
*********> Substring2 = Message2.Substring (i, i + 159) + (control + z)
*********OK
*****}
*****else
****{
**********> Substring2 = Message2.Substring (i, Message2.Length) + (control + z)
*********OK
****}
}

--------------------
*


case 3:
I did not send the message unicode characters when after receiving a
message full of wild characters:

Code:
--------------------

0 < Message3 less than or equal 70 // the string less than or equal 70 characters

AT
OK

AT + CMGF = 1
OK

AT + CSCS = "Hex"
OK

AT + CMGS = "0196704xxxx"
*> MessageUnicode = (Hex)Message3 + (control + z)

--------------------


you help me see cases 2 and 3, I did not send the message, my algorithm
wrong ? If i'm sending a message > 160 characters I must assign
at+CSCS="GSM" right ?




--
dongtrien

John Henderson

unread,
Dec 30, 2015, 3:47:04 PM12/30/15
to
In your case 2, are you incrementing the value of variable i each time
through the "while" loop?

Or are you leaving it set to zero? (That won't work.)

In your case 3, have you set the DCS value correctly for 16-bit characters?
What does

AT+CSMP?

return (immediately before the AT+CMGS command)?

When using the default 7-bit alphabet, messages of more than 160 characters
are usually split into parts before sending. Each part is then sent as an
individual SMS. The receiving device should then use the message and part
numbers you assign to reconstruct the original long message.

These split messages are known as "concatenated" messages. You must set the
UDHI bit in the PDU-type octet, and begin the User Data with the encoded
message and part numbering information as a User Data Header. This uses up
some of the message payload space, and the text itself must be correctly
aligned to a septet boundary to accommodate the User Data Header.

Message concatenation is a complex topic. It's usually handled using PDU-
mode rather than text-mode. I've not tried to implement it in text-mode,
but it may be possible (with some very sophisticated programming).

John

dongtrien

unread,
Dec 31, 2015, 1:25:04 AM12/31/15
to

I do not know why when I type the left arrow "<" and the right arrow ">"
This page is not displayed.
send multiple messages to multiple phone numbers for cases 2 and 3

case 2: messages of more than 160 characters
when I send a message more than 160 characters, I've split the message
into multiple messages children, each message children smaller than or
equal to 160 characters before sending, the receiving device know how
that "message is concatenated" ?, in HyperTerminal you can perform at
command syntax to send messages longer than 160 characters like ?

case 3:
AT+CSMP?
+CSMP: 17,167,0,0
OK

AT+CMGS?
ERROR

I do not know DCS and DCS values I set correctly for 16-bit characters
like ? How i must set the PDU-type UDHI bit octet ? you can perform
syntax at via HyperTerminal ?

This site does not support the strange (wild) characters and other
features should I attach files this content
http://www.mediafire.com/view/0e3mco74b48ot8s/case2and3.txt




--
dongtrien

John Henderson

unread,
Dec 31, 2015, 4:27:44 AM12/31/15
to
dongtrien wrote:

> I do not know why when I type the left arrow "<" and the right arrow ">"
> This page is not displayed.

I do not follow your meaning. I do not understand.

> case 2: messages of more than 160 characters
> when I send a message more than 160 characters, I've split the message
> into multiple messages children, each message children smaller than or
> equal to 160 characters before sending, the receiving device know how
> that "message is concatenated" ?, in HyperTerminal you can perform at
> command syntax to send messages longer than 160 characters like ?

What is the problem here? If the total message text length is 100
characters, and you are splitting it into two messages, does the receiving
device receive both messages OK?

Is the problem just that you want the receiving device to automatically join
the two messages back into a single message?

> case 3:
> AT+CSMP?
> +CSMP: 17,167,0,0
> OK

I'll work through those four values.

Your PDU-type octet is set to 17 decimal. That's 11 hex, and 00010001
binary. This is normal for an ordinary SMS with no User Data Header.

Your Validity Period is set to 167 decimal That's A7 hex and means 24
hours.

If the message centre which accepts your messages for delivery is unable to
deliver those messages within 24 hours, they will be deleted and no further
delivery attempts will be made.

You might want to increase that value. Or even reduce it.

Your PID (Protocol ID) is zero. This is a normal value for an SMS to be
sent.

Finally, your DCS (Data Coding Scheme) value is also zero. This means that
you'll be using the SMS 7-bit default alphabet. So if you use

AT+CSCS="HEX"

your hex data will be converted by the sending device into SMS 7-bit
characters before sending.

This is clearly not what you want. You want to send 16-bit unicode
characters.

So before you send the message, set your DCS to 8 (eight). Issue the
command:

AT+CSMP=17,167,0,8

If you want to increase the Validity Period from 24 hours to 7 days, use:

AT+CSMP=17,173,0,8

instead.

Don't forget to change the DCS back to zero before you try to send a 7-bit
message again.

John

John Henderson

unread,
Dec 31, 2015, 5:58:08 AM12/31/15
to
dongtrien wrote:

> case 3:
> I did not send the message unicode characters when after receiving a
> message full of wild characters:
>
> Code:
> --------------------
>
> 0 < Message3 less than or equal 70 // the string less than or equal 70
> characters
>
> AT
> OK
>
> AT + CMGF = 1
> OK
>
> AT + CSCS = "Hex"
> OK
>
> AT + CMGS = "0196704xxxx"
> *> MessageUnicode = (Hex)Message3 + (control + z)
>
> --------------------

On further reading,

AT+CSCS="HEX"

might not work for 16-bit. If your device supports it,

AT+CSCS="UCS2"

might be required instead.

The DCS value should still be 8.

You can list your supported values with:

AT+CSCS=?

John

dongtrien

unread,
Jan 4, 2016, 1:25:05 AM1/4/16
to

-
What is the problem here? If the total message text length is 100
characters, and you are splitting it into two messages, does the
receiving
device receive both messages OK?

Is the problem just that you want the receiving device to automatically
join
the two messages back into a single message?

---------------------

I divide the message into several messages while the total length
greater than 160 characters, suppose I have a message 195 characters I
spent a 2 message, the first message 160 characters 2nd message with 35
characters remaining, sending just first message is received not
received 2nd message I do not know why ?

According to your instructions above, I sent a message unicode Okay, the
reason is I do not know the declaration, now I've got it

Now I figure one another questions you can answer to help me? as I know
there are two ways to send messages unicode, 1 you have guided me then,
and a 2 code at the bottom, I do not see the recipient's phone and do
not understand AT + CMGS = 34 it to do what? if I send this form AT +
CSCS declaration = "HEX" or AT + CSCS = "UCS2" ?

Code:
--------------------

AT+CMGF=0
OK
AT+CMGS=34
0011000B912309157821xxx0008AA1400680065006C006C006F00680065006C006C006F

--------------------




--
dongtrien

John Henderson

unread,
Jan 4, 2016, 2:05:18 AM1/4/16
to
dongtrien wrote:

> I divide the message into several messages while the total length
> greater than 160 characters, suppose I have a message 195 characters I
> spent a 2 message, the first message 160 characters 2nd message with 35
> characters remaining, sending just first message is received not
> received 2nd message I do not know why ?

When you send a message using AT commands, you are given a message reference
number for each message sent. Like:

+CMGS: 23

Did you get two message reference numbers? One for each message?

These numbers tell you that the message has been sent successfully.

> According to your instructions above, I sent a message unicode Okay, the
> reason is I do not know the declaration, now I've got it
>
> Now I figure one another questions you can answer to help me? as I know
> there are two ways to send messages unicode, 1 you have guided me then,
> and a 2 code at the bottom, I do not see the recipient's phone and do
> not understand AT + CMGS = 34 it to do what? if I send this form AT +
> CSCS declaration = "HEX" or AT + CSCS = "UCS2" ?
>
> Code:
> --------------------
>
> AT+CMGF=0
> OK
> AT+CMGS=34
> 0011000B912309157821xxx0008AA1400680065006C006C006F00680065006C006C006F

The AT+CMGF=0 command puts the device into PDU-mode, not text-mode.

In PDU-mode the "34" argument for the send command is the number of octets
in the PDU. This is the number of octets without the SMSC (message centre)
information. In the case of your message, the first byte "00" is the SMSC
information. So the count doesn't include this.

Your PDU has a PDU-type of 11 hex. It's addressed to +3290518712xxx (but a
fill digit "F" is also missing).

PID is 00. DCS is 08. Validity period AA means 4 days.

There are 14 hex (20 decimal) octets of user data:

00680065006C006C006F00680065006C006C006F

It's 16-bit data, so the octets are decoded in pairs:

0068 h
0065 e
006C l
006C i
006F o
0068 h
0065 e
006C l
006C l
006F o

Is this what you wanted to know?

John

0 new messages