Welcome to Developer's Home Thursday, April 17, 2014
Home - DevelopersHome.com

16.2. Final Result Code Specific to SMS AT Commands


Preferences - Do not show ads

The final result codes OK and ERROR are available to all AT commands. Unlike OK and ERROR, the +CMS ERROR final result code is only available to SMS AT commands. It notifies you about the occurrence of a message service failure.


16.2.1. The +CMS ERROR Final Result Code -- Notifies the Occurrences and Causes of Message Service Failures

The +CMS ERROR final result code is returned when a message service failure occurs. An error code is provided for programmers to check what causes the message service failure. The +CMS ERROR final result code is specific to SMS AT commands, i.e. the +CMS ERROR final result code will only be outputted by AT commands that are used to perform tasks related to SMS messaging. Below are the SMS AT commands that may output the final result code +CMS ERROR:

  • +CMGC (command name in text: Send Command)

  • +CMGD (command name in text: Delete Message)

  • +CMGL (command name in text: List Messages)

  • +CMGR (command name in text: Read Message)

  • +CMGS (command name in text: Sending Message)

  • +CMGW (command name in text: Write Message to Memory)

  • +CMSS (command name in text: Send Message from Storage)

  • +CNMA (command name in text: New Message Acknowledgement to ME/TA)

  • +CNMI (command name in text: New Message Indications to TE)

  • +CPMS (command name in text: Preferred Message Storage)

  • +CRES (command name in text: Restore Settings)

  • +CSAS (command name in text: Save Settings)

  • +CSMS (command name in text: Select Message Service)

The syntax of the +CMS ERROR final result code is:


<CR><LF>+CMS ERROR: error_code<CR><LF>


Just as the final result codes OK and ERROR, the +CMS ERROR final result code always starts and ends with a carriage return character and a linefeed character. error_code is an integer that is associated to a certain error. A list of some error codes and their meanings can be found in "Table of +CMS Error Codes and Their Meanings".

As mentioned earlier, after the execution of a command line, only one final result code is returned. Hence, when an error occurs, you will not find both +CMS ERROR and ERROR in the command response. For errors related to SMS messaging, the +CMS ERROR final result code is returned. For other errors such as invalid command syntax and unsupported AT command, the ERROR final result code is returned as usual.

Below shows some common causes of +CMS errors:

  • A SIM card is not present in the GSM/GPRS modem or mobile phone.

  • The SIM card requires a password (e.g. PIN, PIN2, PUK and PUK2) but you have not entered it.

  • An invalid memory index is assigned to an AT command.

  • The memory of the GSM/GPRS modem, mobile phone or SIM card for storing SMS messages is full.

  • The SMSC address is unknown or incorrect.

Following is an example that demonstrates the usage of the +CMS ERROR result code. Let's say there is only one SMS text message stored on our Nokia 6021 and it is stored in the memory location at index 1. If we enter the command line "AT+CMGR=11" (it means "to read the SMS message at memory index 11"), Nokia 6021 will return a +CMS error:


AT+CMGR=11<CR>
<CR><LF>+CMS ERROR: 321<CR><LF>


As mentioned earlier, when a terminal program such as HyperTerminal of Microsoft Windows sees a carriage return character, it moves the cursor to the beginning of the current line. When it sees a linefeed character, it moves the cursor to the same position on the next line. Hence, the command line you entered, together with the response returned, will be displayed like this in a terminal program such as HyperTerminal of Microsoft Windows:


AT+CMGR=11
+CMS ERROR: 321


To find out the meaning of the +CMS error code 321, go to "Table of +CMS Error Codes and Their Meanings". From there, we know that the read message operation failed because an invalid memory index was assigned to the AT command +CMGR.

Note that after the occurrence of a +CMS error, the GSM/GPRS modem or mobile phone will not process the remaining AT commands in the command line. Thus, if the command line sent to Nokia 6021 is "AT+CMGR=11;+CGMI" (+CGMI is the AT command for retrieving the manufacturer name of the GSM/GPRS modem or mobile phone), you will get the following result in Windows' HyperTerminal:


AT+CMGR=11;+CGMI
+CMS ERROR: 321


But if the positions of the two AT commands in the command line are exchanged, Nokia 6021 will output the result of the execution of the AT command +CGMI before outputting the +CMS ERROR result code. Below is the result displayed in Windows' HyperTerminal:


AT+CGMI;+CMGR=11
Nokia

+CMS ERROR: 321


16.2.1.1. Table of +CMS Error Codes and Their Meanings

The following table lists some of the +CMS error codes and their meanings.


+CMS error code

Meaning

300

Mobile equipment (ME) failure. Mobile equipment refers to the mobile device that communicates with the wireless network. Usually it is a mobile phone or GSM/GPRS modem. The SIM card is defined as a separate entity and is not part of mobile equipment.

301

SMS service of mobile equipment (ME) is reserved. See +CMS error code 300 for the meaning of mobile equipment.

302

The operation to be done by the AT command is not allowed.

303

The operation to be done by the AT command is not supported.

304

One or more parameter values assigned to the AT command are invalid. (For PDU mode)

305

One or more parameter values assigned to the AT command are invalid. (For Text mode)

310

There is no SIM card.

311

The SIM card requires a PIN to operate. The AT command +CPIN (command name in text: Enter PIN) can be used to send the PIN to the SIM card.

312

The SIM card requires a PH-SIM PIN to operate. The AT command +CPIN (command name in text: Enter PIN) can be used to send the PH-SIM PIN to the SIM card.

313

SIM card failure.

314

The SIM card is busy.

315

The SIM card is wrong.

316

The SIM card requires a PUK to operate. The AT command +CPIN (command name in text: Enter PIN) can be used to send the PUK to the SIM card.

320

Memory/message storage failure.

321

The memory/message storage index assigned to the AT command is invalid.

322

The memory/message storage is out of space.

330

The SMS center (SMSC) address is unknown.

331

No network service is available.

332

Network timeout occurred.

340

There is no need to send message acknowledgement by the AT command +CNMA (command name in text: New Message Acknowledgement to ME/TA).

500

An unknown error occurred.


Preferences - Do not show ads


Page 23 of 65 Previous Page | Next Page
Contents at a Glance
Print this Web Page | | Back to Top
Custom Search

Feedback Form (Expand)

What do you think about this web page?






SMS Tutorial Table of Contents SMS Tutorial Contents at a Glance Preferences - Change Color Scheme Preferences - Do Not Show Ads Previous Page Next Page

International SMS Gateway Provider


Bulk SMS software