| 帮同学宣传一下http://shop57644665.taobao.com/ |
在code已经优化的情况下的做法,其他系统类似也应该可用。
1.code放到internal ram中去执行
2.code中使用的全局变量或动态分配的内存放到internal ram中。
3.执行该code时将系统堆栈设置到internal ram中。
| 帮同学宣传一下http://shop57644665.taobao.com/ |
在code已经优化的情况下的做法,其他系统类似也应该可用。
1.code放到internal ram中去执行
2.code中使用的全局变量或动态分配的内存放到internal ram中。
3.执行该code时将系统堆栈设置到internal ram中。
| 帮同学宣传一下http://shop57644665.taobao.com/ |
SELECT
| COMMAND | CLASS | INS | P1 | P2 | P3 |
| SELECT | ‘A0′ | ‘A4′ | ‘00′ | ‘00′ | ‘02′ |
Command parameters/data:
| Byte(s) | Description | Length |
| 1-2 | File ID | 2 |
Response parameters/data in case of an MF or DF:
| Byte(s) | Description | Length |
| 1-2 | - RFU | 2 |
| 3 - 4 | Total amount of memory of the selected directory which is not allocated to any of the DFs or EFs under the selected directory | 2 |
| 5 – 6 | File ID | 2 |
| 7 | Type of file | 1 |
| 8 - 12 | RFU | 5 |
| 13 | Length of the following data (byte 14 to the end) | 1 |
| 14 - 34 | GSM specific data | 21 |
GSM specific data:
| Byte(s) | Description | Length |
| 14 | File characteristics | 1 |
| 15 | Number of DFs which are a direct child of the current directory | 1 |
| 16 | Number of EFs which are a direct child of the current directory | 1 |
| 17 | Number of CHVs, UNBLOCK CHVs andadministrative codes | 1 |
| 18 | RFU | 1 |
| 19 | CHV1 status | 1 |
| 20 | UNBLOCK CHV1 status | 1 |
| 21 | CHV2 status | 1 |
| 22 | UNBLOCK CHV2 status | 1 |
| 23 | RFU | 1 |
| 24 - 34 | Reserved for the administrative management 0 . lgth | 11 |
Response parameters/data in case of an EF:
| Byte(s) | Description | Length |
| 1-2 | RFU | 2 |
| 3 -4 | File size(for transparent EF: the length of the body part of the EF)(for linear fixed or cyclic EF: record length multiplied by the number of records of the EF) | 2 |
| 5 - 6 | File ID | 2 |
| 7 | Type of file | 1 |
| 8 | For transparent and linear fixed EFs this byte is RFU. For a cyclic EF all bits except bit 7 are RFU;b7=1 indicates that the INCREASE command is allowed on the selected cyclic file. | 1 |
| 9 - 11 | Access conditions | 3 |
| 12 | File status | 1 |
| 13 | Length of the following data (byte 14 to the end) | 1 |
| 14 | Structure of EF | 1 |
| 15 | Length of a record | 1 |
| 16 and following | RFU | - |
| 帮同学宣传一下http://shop57644665.taobao.com/ |
对SIM卡的操作必须严格按照GSM规范规定的协议进行。其格式如下:
•CLA •INS • P1 • P2 • P3 • Data
SIM卡返回数据格式如下:
Data • SW1 • SW2
CLA:指令的类型
INS:指令代码。
P1,P2,P3:指令参数,其中P3表示data的长度。P3=00表示返回256字节长度的data。
SW1,SW2表示命令成功与否的状态。
在T=0的情况下,一些函数在使用select指令后需要使用get response指令并使用参数来得到对应的数据。
如果事先并不知道返回数据的长度,那么在第一个命令的返回状态中将会包括对应的长度。
SIM卡操作指令表如下
Read the rest of this post »
| 帮同学宣传一下http://shop57644665.taobao.com/ |
以下是一些比较重要的SIM卡中包含的EF信息。
EFLP (Language preference)
包含一个或多个语言的代码。
Identifier: ‘6F05′ Structure: transparent Mandatory
File size: 1-n bytes Update activity: low
Access Conditions:
READ ALW
UPDATE CHV1
INVALIDATE ADM
REHABILITATE ADM
Bytes Description M/O Length
1 1st language code (highest prior.) M 1 byte
2 2nd language code O 1 byte
n nth language code (lowest prior.) O 1 byte
EFIMSI (IMSI)
包含IMSI(International Mobile Subscriber Identity)信息
Identifier: ‘6F07′ Structure: transparent Mandatory
File size: 9 bytes Update activity: low
Access Conditions:
READ CHV1
UPDATE ADM
INVALIDATE ADM
REHABILITATE CHV1
Bytes Description M/O Length
1 length of IMSI M 1 byte
2 - 9 IMSI M 8 bytes
EFKc (Ciphering key Kc)
包含用来加密的信息
Identifier: ‘6F20′ Structure: transparent Mandatory
File size: 9 bytes Update activity: high
Access Conditions:
READ CHV1
UPDATE CHV1
INVALIDATE ADM
REHABILITATE ADM
Bytes Description M/O Length
1 - 8 Ciphering key Kc M 8 bytes
9 Ciphering key sequence number n M 1 byte
EFPLMNsel (PLMN selector)
包含Mobile Network Code (MNC).和Mobile Country Code (MCC)信息
Identifier: ‘6F30′ Structure: transparent Optional
File size: 3n (n .
bytes Update activity: low
Access Conditions:
READ CHV1
UPDATE CHV1
INVALIDATE ADM
REHABILITATE ADM
Bytes Description M/O Length
1 - 3 1st PLMN (highest priority) M 3 bytes
22 - 24 8th PLMN M 3 bytes
25 - 27 9th PLMN O 3 bytes
(3n-2)-3n nth PLMN (lowest priority) O 3 bytes
Read the rest of this post »
| 帮同学宣传一下http://shop57644665.taobao.com/ |
Ref.11.11
SIM卡在系统中连接如下图

Answer To Reset (ATR)
当手机reset SIM时,SIM卡会返回一些信息给手机,这些信息中包含SIM卡对应的一些信息和参数。具体对应可参考ISO/IEC 7816-3
TS:Initial character 高低电平,LSB MSB传输顺序的约定。
T0:Format character 表示接口字符的个数和历史字节的数量。
TA1:Interface character 表示有增强的波特率,公式 3571200 / ( Fi / Di )
TB1:Interface character表示编程电流 I /电压 P,高2位表示电流I,低6位表示电压P
TC1:Interface character 额外保护时间
TD1: Interface character 通讯协议
TA2: 协议T=0 不使用
TB2:不使用。
TC2:额外保护时间
TDi,TAi, TBi, TCi(i>1)
T1,…,TK : Historical characters
TCK: Check character
SIM卡中的内容
SIM卡类似一个文件夹,拥有多个目录和目录下的文件。目录和文件都有一个独立的对应标识。
Master File (MF): The unique mandatory file containing access conditions and optionally DFs and/or EFs.
Dedicated File (DF): A file containing access conditions and, optionally, Elementary Files (EFs) or other Dedicated Files (DFs).
Elementary File (EF): A file containing access conditions and data and no other files.

File identifier
The first byte identifies the type of file, and for GSM is:
- ‘3F’: Master File;
- ‘7F’: 1st level Dedicated File;
- ‘5F’: 2nd level Dedicated File;
- ‘2F’: Elementary File under the Master File;
- ‘6F’: Elementary File under a 1st level Dedicated File;
- ‘4F’: Elementary File under 2nd level Dedicated File.
Dedicated File (DF)
Two 1st level DFs are defined in this specification:
- DFGSM which contains the applications for both GSM and/or DCS 1800;
- DFTELECOM which contains telecom service features.
Read the rest of this post »
| 帮同学宣传一下http://shop57644665.taobao.com/ |
GSM协议方面经常会看到各个信道的使用,以下就是GSM信道类型,作为以后的参考和缩写的查询。
GSM信道类型
(10个) Ref 04.03
1.业务信道(TCH)Traffic CHannel
1.2全速率 TCH:TCH/FS(语音),数据 TCH/F9.6, TCH/F4.8, TCH/F2.4,->22.8k(每帧发送)
1.2 半速率 TCH:TCH/HS(语音),数据 TCH/H9.6, TCH/H4.8, TCH/H2.4,->11.4k(发送一帧停一帧)
2. 控制信道(CCH) Common Control Channel
2.1 广播信道(BCH) Broadcast Control Channel->前向
2.1.1 广播控制信道 Broadcast Control Channel (BCCH) <- step 3
2.1.2 频率校正信道(FCCH) Frequency Correction CHannel <- step 1
2.1.3 同步信道(SCH) Synchronization CHannel <- step 2
2.2 公共控制信道common control channel(CCCH)(前向链路/ RACH反向链路)
2.2.1 寻呼信道(PCH)Paging Channel:Send 目标用户的IMSI.或 Send SMS Message.
2.2.2 随机接入信道(RACH)Random Access Channel(反向链路):MS Send 呼叫。或者response PCH
2.2.3 接入允许信道(AGCH) Access Grant Channel:基站向移动台发送所分配的专用信道(时隙和ARFCN)数据。
2.2.4 通知信道(NCH)Notification Channel:为voicegroup and/or voice broadcast calls保留的CCH信道。
2.3 专用控制信道(DCCH)Dedicated Control Channel
2.3.1 独立专用控制信道(SDCCH)Stand-alone DCCH: 载有信令业务数据,该数据在移动台和基站相连之后,基站分配TCH之前。(它是中间的,暂时的,双向的)
2.3.2 慢速随路控制信道(SACCH)Slow Associated DCCH:(和TCH/SDCCH相关联)向MS发送慢速的但规则变化的控制信息。
2.3.3 快速随路控制信道(FACCH)Fast Associated DCCH:偷TCH帧,改为紧急信息信令。
GPRS信道类型
1. 业务信道(PDTCH)
2. 控制信道(CCH)
包交换广播控制信道packet broadcast control channel (PBCCH)
2.4 公共控制信道packet common control channel(PCCCH)(前向)
2.2.1 Packet寻呼信道(PPCH)(Paging)
2.2.2 Packet随机接入信道(PRACH)(反向链路)
2.2.3 Packet接入允许信道(PAGCH)
2.5 专用控制信道(DCCH)
PACCH
PDCCH。