> 2.15 | SIM

> 2.15.1 | SIM access

> This section comprises the subsections Description, Used AT Commands, Flow Chart, Hints and Example. To move to these subsections please use the Navigation Frame or the appropriate buttons on the toolbar.

> 2.15.1.1 | Description

> This chapter describes how to access the Elementary Files (referred to as EF) on the SIM using the command AT+CRSM=<command>[,<fileID>[,<P1>,<P2>,<P3>[,<data>]]]”.
> Access to the SIM database is restricted to the following operations specified with the parameter <command>:

> SIM command number | Command | Function
> 176 | READ BINARY | Reads a string of bytes, which gives information about the current transparent elementary datafield.
> 178 | READ RECORD | Reads a complete record in a current linear or fixed elementary datafield. Four modes (CURRENT, ABSOLUTE, NEXT, PREVIOUS) are defined to read a record.
> 192 | GET RESPONSE | Return data, which gives information about the current elementary datafield. This information includes the type of file and its size.
> 214 | UPDATE BINARY | UPDATE BINARY updates the current transparent elementary data field with a string of bytes.
> 220 | UPDATE RECORD | UPDATE RECORD updates one complete record in the current linear fixed or cyclic elementary data fields. For update operations there are four modes (CURRENT, ABSOLUTE, NEXT, PREVIOUS) defined, but only PREVIOUS is allowed for cyclic files.
> 242 | STATUS | Return data which gives information about the current elementary data field.

> The <fileID> is the identifier of the EF on the SIM and mandatory for every command except for STATUS. <P1>, <P2>, <P3> are parameters for the instruction.
> Every command sends the ME a response with the current SIM information and response data. The response parameters <sw1> and <sw2> are delivered on successful or failed execution of the command. If the command cannot be passed to the SIM, the ME will return “+CME ERROR: <err>”.
> A response consists of following parts (example “READ RECORD” EF LND):

> Bytes | Description | Length
> 1 to X | Alpha Identifier | X bytes
> X+1 | Length of BCD number/SSC contents | 1 byte
> X+2 | TON and NPI | 1 byte
> X+3 to X+12 | Dialing Number/SSC String | 10 byte
> X+13 | Capability/Configuration Identifier | 1 byte
> X+14 | Extension1 Record Identifier | 1 byte

> For further details see section “Coding of commands” in [12].
> Figure 128: READ RECORD example response
> Description (Example 3):
> This example shows how to read a record (“last number dailed”) from the SIM. First, the response “+CRSM:103,28” will be returned. The first parameter <sw1> = ‘103’ is a decimal value, the appropriate hexadecimal value is ‘67’ which means “incorrect parameter <P3>”. The second parameter <sw2>=’xx’ gives the correct length (in example ‘28’) or states that no additional information is given.

> 2.15.1.2 | Used AT commands

> Command | Explanation
> AT+CRSM | Restricted SIM access

> For further details about the commands see [2].

> 2.15.1.3 | Flow chart

> Figure 129: SIM access "GET RESPONSE"
> Figure 130: SIM access "READ BINARY"
> Figure 131: SIM access "READ RECORD"
> Figure 132: SIM access "UPDATE RECORD"- part 1
> Figure 133: SIM access "UPDATE RECORD"- part 2

> 2.15.1.4 | Hints

> Not applicable.

> 2.15.1.5 | Example

> Example 1:
> ***************************************
> Comment: SIM access "GET RESPONSE"
> ***************************************
> ***************************************
> Comment: Get response from the EF(SMS status).
> ***************************************
> Subscr 1 Send: AT+CRSM=192,28483
> Subscr 1 Receive: AT+CRSM=192,28483
> Subscr 1 Receive: +CRSM: 144,0,000000026F43040011F05501020000
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> Example 2:
> ***************************************
> Comment: SIM access "READ BINARY"
> ***************************************
> ***************************************
> Comment: Read binary from the EF (ICC identification).
> ***************************************
> Subscr 1 Send: AT+CRSM=176,12258,0,0,10
> Subscr 1 Receive: AT+CRSM=176,12258,0,0,10
> Subscr 1 Receive: +CRSM: 144,0,980000000000000000F3
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> Example 3:
> ***************************************
> Comment: SIM access "READ RECORD"
> ***************************************
> ***************************************
> Comment: Wrong entry to read record from the EF (Last number dialed).See above Section 2.15.1.1.
> ***************************************
> Subscr 1 Send: AT+CRSM=178,28484,1,4,255
> Subscr 1 Receive: AT+CRSM=178,28484,1,4,255
> Subscr 1 Receive: +CRSM: 103,28
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> ***************************************
> Comment: Read record from the EF (Last number dialed).
> ***************************************
> Subscr 1 Send: AT+CRSM=178,28484,1,4,28
> Subscr 1 Receive: AT+CRSM=178,28484,1,4,28
> Subscr 1 Receive: +CRSM: 144,0,
> FFFFFFFFFFFFFFFFFFFFFFFFFFFF0581420010F6FFFFFFFFFFFFFFFF
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> Example 4:
> ***************************************
> Comment: SIM access "UPDATE RECORD"
> ***************************************
> ***************************************
> Comment: Request max. range of entries .
> ***************************************
> Subscr 1 Send: AT+CPBR=?
> Subscr 1 Receive: AT+CPBR=?
> Subscr 1 Receive: +CPBR: (1-254),20,14
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> ***************************************
> Comment: Read all entries of the phonebook .
> ***************************************
> Subscr 1 Send: AT+CPBR=1,254
> Subscr 1 Receive: AT+CPBR=1,254
> Subscr 1 Receive: +CPBR: 1,"+44563693485",145,"Tom Jones"
> Subscr 1 Receive: +CPBR: 2,"+44987456321",145,"Tamara Jones"
> Subscr 1 Receive: +CPBR: 3,"+44545896638",145,"Paul Williams"
> Subscr 1 Receive: +CPBR: 4,"+44545896897",145,"John Smith"
> Subscr 1 Receive: +CPBR: 5,"+44321546546",145,"Alexis Wright"
> Subscr 1 Receive: +CPBR: 6,"+44496857927",145,"Hannah Adams"
> Subscr 1 Receive: +CPBR: 7,"+44321546547",145,"Abigail Cox"
> ***************************************
> Comment: Read record from the EF (Abbreviated dialing numbers) further details see Section 2.15.1.1.
> ***************************************
> Subscr 1 Send: AT+CRSM=178,28474,1,4,250
> Subscr 1 Receive: AT+CRSM=178,28474,1,4,250
> Subscr 1 Receive: +CRSM: 103,28
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> ***************************************
> Comment: Read record from the EF (Abbreviated dialing numbers).
> ***************************************
> Subscr 1 Send: AT+CRSM=178,28474,1,4,28
> Subscr 1 Receive: AT+CRSM=178,28474,1,4,28
> Subscr 1 Receive: +CRSM:
> 144,0,546F6D204A6F6E6573FFFFFFFFFF07914465633984F5FFFFFFFFFFFF
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> ***************************************
> Comment: Update record from the EF (Abbreviated dialing numbers).
> Comment: Replacing Tom Jones with Oscar Thomson.
> ***************************************
> Subscr 1 Send:
> AT+CRSM=220,28474,1,4,28,4F736361722054686F6D736F6EFF07914465633984F5FFFFFFFFFFFF
> Subscr 1 Receive:
> AT+CRSM=220,28474,1,4,28,4F736361722054686F6D736F6EFF07914465633984F5FFFFFFFFFFFF
> Subscr 1 Receive:
> Subscr 1 Receive: +CRSM: 144,0
> Subscr 1 Receive:
> Subscr 1 Receive: OK
> ***************************************
> Comment: Read all entries of the phonebook.
> Comment: Oscar Thomson has now replaced Tom Jones.
> ***************************************
> Subscr 1 Send: AT+CPBR=1,254
> Subscr 1 Receive: AT+CPBR=1,254
> Subscr 1 Receive: +CPBR: 1,"+44563693485",145,"Oscar Thomson"
> Subscr 1 Receive: +CPBR: 2,"+44987456321",145,"Tamara Jones"
> Subscr 1 Receive: +CPBR: 3,"+44545896638",145,"Paul Williams"
> Subscr 1 Receive: +CPBR: 4,"+44545896897",145,"John Smith"
> Subscr 1 Receive: +CPBR: 5,"+44321546546",145,"Alexis Wright"
> Subscr 1 Receive: +CPBR: 6,"+44496857927",145,"Hannah Adams"
> Subscr 1 Receive: +CPBR: 7,"+44321546547",145,"Abigail Cox"
> Subscr 1 Receive:
> Subscr 1 Receive:
> Subscr 1 Receive: OK