4

AT+CRSM can be used to read Elementary Files (EF) of the SIM Card. (3GPP TS 27.007) I am successfully able to read many EF files using the following format:

at+crsm=176,<EF-FILE-ADDR-IN-DEC>,0,0,<BYTE-LENGTH-TO-READ>

Few files which I have successfully read & parsed manually include EF-UST, EF-SPN, EF-EST, EF-ACL & EF-SPDI

However, I am not able to read two EFs namely EF-PNN & EF-OPL. I have confirmed that the EF-UST shows the services n45 & n46 as "available". But using the above format, the AT command throws following CME Error: 105, 129 i.e. 0x69, 0x81 which as per ETSI TS 102.221 indicates "command incompatible with file structure"

One unique thing about both these EFs is they have an SFI (Short File Identifier). I even tried to code "P1" of at+crsm as Bit8=1, Bit7,6=0 & Bit5,4,3,2,1=SFI address of EF. But no success!

Does any one know how to read EFs with SFI using AT+CRSM?

vmd
  • 226
  • 3
  • 7

1 Answers1

2

just briefly: documentation: 3GPP 51.011

  • each SIM elementary file (EF) has own "structure of file": (the section 9.3 in 51.011). ('00' : transparent; '01' : linear fixed; '03': cyclic.)

  • the structure of file (EF) can be detected by "getting response" on the first 15 bytes of appropriate EF file and decoding the content of 14th byte. (have a look at page 24 of 51.011 where the meaning of bytes is described). for example: "AT+CRSM=192,EF-FILE-ADDR,0,0,15"

    • the command "176 - read binary" used by you "at+crsm=176," can be used only in the case of "transparent" structure of file.
    • if you want to read records from "linear fixed" or "cyclic", the command "178 - read record" can be helpfull.

partianl explanation of AT CMD: CRSM Set request:

+CRSM=<command>[,<fileid>[,<P1>,<P2>,<P3>[,<data>[,<pathid>]]]]

command command passed on by the ME to the SIM;

  • 176: READ BINARY
  • 178: READ RECORD
  • 192: GET RESPONSE (get information about the selected )
  • 214: UPDATE BINARY
  • 220: UPDATE RECORD
  • 242: STATUS (get information about the current directory) of course there is much bigger set of command types. Have a look at section 9.2 of 51.011

P1, P2, P3: integer type parameters passed on by the ME to the SIM Note: Normally it is not necessary to set these parameters, because they have appropriate default values (see table below). A task where it may be useful, is splitting large binary files for reading and writing operations, due to the fact that an AT command line may only have up to 200 characters (including the header).

  • COMMAND | P1 | P2 | P3
  • STATUS | '00' | '00' | Lgth (Default 22)
  • READ BINARY | Offset high (Default=0) | Offset low (Default=0) | Lgth
  • UPDATE BINARY| Offset high (Default=0) | Offset low (Default=0) | Lgth
  • READ RECORD | Rec No | Mode (Default=4) | Lgth (don’t care!)
  • UPDATE RECORD| Rec No | Mode (Default=4) | Lgth (don’t care!)
  • GET RESPONSE | '00' | '00' | Lgth (don’t care!)

Offset high and offset low are the high and low part of a 16-bit address (address-ing starts with P1=0 and P2=0). This feature can be used to read/write large SIM files with subsequent commands. Note: Default values depends on modem firmware implementation.

Mode defines the reading/writing mode for linear fixed and cyclic files:

  • 02: next
  • 03: previous
  • 04: absolute/current mode2

Rec No. is the number of the record to be read. If mode=02 or 03, the value should be 0.

Lgth is the length of the read or write data:

  • For READ BINARY and WRITE BINARY, offset and length should be given in a reasonable range determined from the EF status information. For READ BINARY, P3 can be omitted or set to 0; then the length information is calculated from the EF status information. For WRITE BINARY, P3 can be corrected (depends on the modem firmware) with the value calculated from length of , if it is less than that value.
  • For READ RECORD and WRITE RECORD, always a complete record must be read or written (see GSM 11.11 [20]/8.5 and 8.6). For READ RECORD, P3 can be omitted or set to 0; then the length information is calculated from the EF status information. For WRITE RECORD, P3 is corrected with the value calcu-lated from length of , if it is less than that value.
  • GET RESPONSE is the complete file or directory information. The length is automatically detected; parameter P3 doesn’t care.
  • GET STATUS is the directory information. The default length is 22.

At the end the example how to read several records from EFpnn (structure: linear fixed; identifier: 6fc5)

to get 1sth record AT+CRSM=178,28613,1,4,0 to get 2nd record AT+CRSM=178,28613,2,4,0