———

 
Translations of this page:

Siemens MC35 GSM modem tips

Some special characters

HEX dec character C Style
0x0D 13 <cr> \r
0x0A 10 <lf> \n

Useful AT Commands

AT+CNMF

Set format of sms data - text or pdu

PDU format

Sending SMS in PDU format
Receiving SMS in PDU format
Octet(s)Description
00 Length of SMSC information. Here the length is 0, which means that the SMSC stored in the phone should be used. Note: This octet is optional. On some phones this octet should be omitted! (Using the SMSC stored in phone is thus implicit)
11 First octet of the SMS-SUBMIT message.
00TP-Message-Reference. The “00” value here lets the phone set the message reference number itself.
0BAddress-Length. Length of phone number (11)
91Type-of-Address. (91 indicates international format of the phone number).
6407281553F8The phone number in semi octets (46708251358). The length of the phone number is odd (11), therefore a trailing F has been added, as if the phone number were “46708251358F”. Using the unknown format (i.e. the Type-of-Address 81 instead of 91) would yield the phone number octet sequence 7080523185 (0708251358). Note that this has the length 10 (A), which is even.
00TP-PID. Protocol identifier
00TP-DCS. Data coding scheme.This message is coded according to the 7bit default alphabet. Having “04” instead of “00” here, would indicate that the TP-User-Data field of this message should be interpreted as 8bit rather than 7bit (used in e.g. smart messaging, OTA provisioning etc).
AAValidity Period (TP-VP). “AA” means 4 days. Note: This octet is optional, see bits 4 and 3 of the first octet
0ATP-User-Data-Length. Length of message. The TP-DCS field indicated 7-bit data, so the length here is the number of septets (10). If the TP-DCS field were set to 8-bit data or Unicode, the length would be the number of octets.
E8329BFD4697D9EC37TP-User-Data. These octets represent the message “hellohello”. How to do the transformation from 7bit septets into octets is shown here
status reports in pdu format

SMS PDU formats demystified

February 12, 2009

Introduction

SMS (Short Message Service) text messaging is the most widely used data application across any electronic device. The simplicity and availability of tools to compose and receive SMS have made it the most popular technology across the globe. There are various software that provide value over just receiving and sending of SMS (Bulk SMS tools, SMS campaign manager, Auto responders).

When developing software for SMS, there are various approaches that can be taken. One of which is to send and receive SMS through a GSM modem or a mobile phone connected to your computer using a data cable (or Bluetooth or Infrared). A software on the computer will communicate to the modem via serial communication using AT commands.

There are two ways (Text mode and PDU mode) of sending and receiving SMS via a GSM modem or mobile phone connected to your computer. The PDU (Protocol Data Unit) mode provides you with advanced functionality and information when sending or receiving SMS over the Text Mode.

PDU Formats

The specifications for the PDU have been developed by ETSI. There are various PDU formats specified by the ETSI. In this article, I will attempt to explain the various PDU formats in a simplified manner with reference to the GSM 03.40 standard.

 1. SMS-DELIVER (A SMS received from the mobile operator to the phone / modem)
 2. SMS-SUBMIT (A SMS sent from the phone / modem to the mobile operator)
 3. SMS-STATUS-REPORT (Conveys a status report for a previously sent SMS)
 4. SMS-COMMAND (Sends a command from the phone / modem to the mobile operator)

1. SMS-DELIVER 2. SMS-SUBMIT 3. SMS-STATUS-REPORT

0791198994800721 C6220C91197940005637902001917360229020019173602249 Octet Description 07 Length of the SMSC information. 91 Type of address of the SMSC. 19 89 94 80 07 21 Service center number in decimal octets. The number of the service center is +919849087012. C6 First Octet of this SMS-STATUS-REPORT message. 22 TP-MR. The message reference number. It is the same as the TP-MR of the sent SMS for which the delivery report has been received. 0C Length of recipient phone number. 91 Type of address of recipient phone number. 19 79 40 00 56 37 The recipient phone number. +919704006573 90 20 01 91 73 60 22 Service Center Time Stamp. 10/02/09 19:37:06 Time Zone GMT+5.30 90 20 01 91 73 60 22 Discharge Time Stamp. 10/02/09 19:37:06 Time Zone GMT+5.30 49 The status of the SMS. (TP-Status) Mobile number does not exist.

Type-Of-Address

The field identifies the type of recipient number, originating number or service center number.

Bit 7 = 1

Bits 6-4: Type of number Bits Type of number 000 Unknown 001 International number 010 National number 011 Network specific number 100 Subscriber number 101 Alphanumeric 110 Abbreviated number 111 Reserved for extension

Bits 3-0: Numbering pan identification Bits Numbering plan identification 0000 Unknown 0001 ISDN / telephone numbering plan 0011 Data numbering plan 0100 Telex numbering plan 1000 National numbering plan 1001 Private numbering plan 1010 ERMES numbering plan 1111 Reserved for extension Example:

Type of address = 91 (Hex)

10010001 (Binary)

Bit 7 = 1

Bit 6-4 = 001 (International number)

Bit 3-0 = 0001 (ISDN / telephone numbering plan)


First Octet of SMS-STATUS-REPORT

The field contains TP-MTI (Message Type Indicator), TP-MMS (More messages to send) and TP-SRQ (Status report qualifier) Bits Description 7-6 Reserved 5 TP-SRQ (0 – Result of SMS-SUBMIT, 1- Result of SMS-Command) 4-3 Reserved 2 TP-MMS (0 – More messages are waiting, 1 – No more messages are waiting for this MS in the service center) 1-0 TP-MTI

Message Type Indicator values Bits 1-0

Message Type

00 SMS-DELIVER (in the direction SC to MS) 00 SMS-DELIVER REPORT (in the direction MS to SC) 10 SMS-STATUS-REPORT (in the direction SC to MS) 10 SMS-COMMAND (in the direction MS to SC) 01 SMS-SUBMIT (in the direction MS to SC) 01 SMS-SUBMIT-REPORT (in the direction SC to MS) 11 Reserved Example:

First Octet = C6 (Hex)

110001 10 (Binary)

Bit 5 = 0 (Result of SMS-SUBMIT)

Bit 2 = 1 (No more messages are waiting for this MS in the service center)

Bit 1-0 = 10 (SMS-STATUS-REPORT is the message type)


Time-Stamp

The field is in semi octet representation and represents the local time in the following way. Bits Description 13-12 Year 11-10 Month 9-8 Day 7-6 24 Hour 5-4 Minute 3-2 Second 1-0 Time Zone (GMT Differenece) Example:

Time Stamp = 90200191736022

Year = 2009, Month = 02 (Feb), Day = 10, Hour = 19, Minute = 37, Second = 06, Time Zone = 22

Time Zone = 22 (00100010)

MSB = 0 (+), if 1 then negative(-)

22 x 15 mins = 330 mins .

i.e. Time Zone = GMT + 5.30


TP-ST (Status Field)

The field indicates the status of a previously submitted SMS in PDU.

Bit 7=0, Bits 6-0: Short message transaction completed 0000000 Short message received succesfully 0000001 Short message forwarded to the mobile phone, but unable to confirm delivery 0000010 Short message replaced by the service center 0000011 – 0001111 Reserved 0010000 – 0011111 Values specific to each service center Temporary error, Service center still trying to transfer SMS 0100000 Congestion 0100001 SME busy 0100010 No response from SME 0100011 Service rejected 0100100 Quality of service not available 0100101 Error in SME 0100110 – 0101111 Reserved 0110000 – 0111111 Values specific to each service center Permanent error, Service center is not making any more transfer attempts 1000000 Remote procedure error 1000001 Incompatible destination 1000010 Connection rejected by SME 1000011 Not obtainable 1000100 Quality of service not available 1000101 No interworking available 1000110 SM validity period expired 1000111 SM deleted by originating SME 1001000 SM deleted by service center administration 1001001 SM does not exist 1001010 – 1001111 Reserved 1010000 – 1011111 Values specific to each service center Temporary error, Service center is not making any more transfer attempts 1100000 Congestion 1100001 SME busy 1100010 No response from SME 1100011 Service rejected 1100100 Quality of service not available 1100101 Error in SME 1100110 – 1101001 Reserved 1101010 – 1101111 Reserved 1110000 – 1111111 Values specific to each service center

Bit 7=1, Bits 6-0: Reserved Example:

TP-ST = 49 (Hex)

01001001 (Binary)

Bit 7 = 0

Bit 6-0 = 1001001 (SM does not exist )

AT+CNMI

New SMS message indications

test command

AT+CNMI=? - list of supported modes

Write command

AT+CNMI=[<mode>][, <mt>][, <bm>][, <ds>][, <bfr>] - set mode

  • mode:
    • 0 - buffer codes in Modem (how to read buffer)
    • 1 - (discard if busy) discard indication and reject message if link is reserved. Otherwise forward to PC.
    • 2 - buffer codes if busy and flush to pc when it's free.
    • 3 - forward directly. (:?:)
  • mt - SMS behaviour:
    • 0 - no indications are routed to PC
    • 1 - indications are stored in modem. indication of memory location is routed to PC
    • 2 - indications except class 2 (store message) are routed directly to PC
    • 3 - class 3 is routed directly to PC like 2). the other are routed like 1).(:?:)
  • bm - CBM - broad cast messages:
    • 0 - no CBM indications
    • 1 - new CBMs are routed to PC.
    • 2 - class 3 are routed to PC … (:?:)
  • ds - sms status reports behaviour
    • 0 - not routed to PC
    • 1 - routed to pc
    • 2 - if status reports are routed to GSM modem/sim - memory location is routed to PC
  • bfr :?:
    • 1 - TA buffer of unsolicited result codes defined within this command is cleared

when <mode> 1…3 is entered. :?:

recorded live indications

received sms at position 8

>AT+CNMI=2,3,0,2
+CMTI: "MT",8

Appendixes

sms classes

  • 0: displayed directly on the screen (flash SMS)
  • 1: stored on SIM (SIM - specific message)
  • 2: stored on mobile equipment (gsm) (default meaning - Mobile Equipment specific)
  • 3: used for SIM Toolkit and OTA short messages. (see GSM TS 07.05 [8])

What are the classes of SM-MT (mobile terminated) messages?

Classes identify the message's importance as well as the location where it should be stored. There are 4 message classes.

  • Class 0: Indicates that this message is to be displayed on the MS immediately and a message delivery report is to be sent back to the SC. The message does not have to be saved in the MS or on the SIM card (unless selected to do so by the mobile user).
  • Class 1: Indicates that this message is to be stored in the MS memory or the SIM card (depending on memory availability).
  • Class 2: This message class is Phase 2 specific and carries SIM card data. The SIM card data must be successfully transferred prior to sending acknowledgement to the SC. An error message will be sent to the SC if this transmission is not possible.
  • Class 3: Indicates that this message will be forwarded from the receiving entity to an external device. The delivery acknowledgement will be sent to the SC regardless of whether or not the message was forwarded to the external device.

Terms

Explanation of terms

  • International Reference Alphabet (IRA)

IRA means that one byte is displayed as two characters in hexadecimal format. For example, the byte 0x36 (decimal 54) is displayed as “36” (two characters). IRA is used here for input 8-bit or 16-bit data via terminal devices using text mode. This means only characters 'A'..F','a'..'f' and '0'..'9' are valid.

  • Escape sequences

The escape sequence used within a text coded in the GSM default alphabet (0x1B) must be correctly interpreted by the TE, both for character input and output. To the module, an escape sequence appears like any other byte received or sent.

  • Terminal Adapter (TA)

TA is used equivalent to Mobile Equipment (ME) which stands for the GSM module described here. It uses GSM default alphabet as its character set.

  • Terminal Equipment (TE)

TE is the device connected to the TA via serial interface. In most cases TE is an ANSI/ASCII terminal that does not fully support the GSM default alphabet, for example MS Hyperterminal.

  • TE Character Set

The character set currently used by Terminal Equipment is selected with AT+CSCS.

  • Data Coding Scheme (dcs)

DCS is part of a short message and is saved on the SIM. When writing a short message to the SIM in text mode, the dcs stored with AT+CSMP is used and determines the coded character set.

Links

 
lcb/programming/siemens-mc35.txt · Last modified: 06.18.2009 10:05 by npelov
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki