M66-DS DSDS Application Note GSM/GPRS Module Series Rev. M66-DS_DSDS_Application_Note_V1.0 Date: 2016-04-05 www.quectel.com GSM/GPRS Module Series M66-DS DSDS Application Note Our aim is to provide customers with timely and comprehensive service. For any assistance, please contact our company headquarters: Quectel Wireless Solutions Co., Ltd. Office 501, Building 13, No.99, Tianzhou Road, Shanghai, China, 200233 Tel: +86 21 5108 6236 Email: info@quectel.com Or our local office. For more information, please visit: http://www.quectel.com/support/salesupport.aspx l e t l c a e i t u n Q ide f n o C For technical support, or to report documentation errors, please visit: http://www.quectel.com/support/techsupport.aspx Or email to: Support@quectel.com GENERAL NOTES QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION PROVIDED IS BASED UPON CUSTOMERS‟ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO CHANGE WITHOUT PRIOR NOTICE. COPYRIGHT THIS INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF QUECTEL CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION AND EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE FORBIDDEN WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF DAMAGES. ALL RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR REGISTRATION OF A UTILITY MODEL OR DESIGN. Copyright © Quectel Wireless Solutions Co., Ltd. 2016. All rights reserved. M66-DS_DSDS_Application_Note Confidential / Released 1 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note About the Document History Revision 1.0 l e t l c a e i t u n Q ide f n o C Date Author Description 2016-04-05 Thomas ZHANG Initial M66-DS_DSDS_Application_Note Confidential / Released 2 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note Contents About the Document ................................................................................................................................... 2 Contents ....................................................................................................................................................... 3 Table Index ................................................................................................................................................... 4 1 Introduction .......................................................................................................................................... 5 2 Rules of DSDS Command and URC ................................................................................................... 6 3 Examples of Common Procedures .................................................................................................... 7 3.1. Initialization after Power on ..................................................................................................... 7 3.2. Make a Voice Call .................................................................................................................... 8 3.3. Accept a Voice Call ................................................................................................................. 9 3.4. Attach GPRS ......................................................................................................................... 11 3.5. PPP Dialup ............................................................................................................................ 12 3.6. Establish TCP Connection..................................................................................................... 13 l e t l c a e i t u n Q ide f n o C 4 DSDS Commands Description ......................................................................................................... 16 4.1. AT Command Syntax............................................................................................................. 16 4.2. Select the SIM Card .............................................................................................................. 16 4.2.1. AT+QDSEL Select the SIM Card................................................................................. 16 4.3. Set/Query the Properties of the Dual SIMs ........................................................................... 17 4.3.1. AT+QDSIMEI Set the IMEI for Dual SIMs ................................................................... 17 4.3.2. AT+QDSQ Query the Signal Quality of Dual SIMs ..................................................... 18 4.3.3. AT+QDSREG Query the Network Registration Status of Dual SIMs .......................... 19 4.3.4. AT+QDSGREG Query the GPRS Status of Dual SIMs .............................................. 20 5 URC...................................................................................................................................................... 21 6 Appendix A References..................................................................................................................... 23 M66-DS_DSDS_Application_Note Confidential / Released 3 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note Table Index TABLE 1: EXAMPLES OF AT COMMANDS ................................................................................................ 7 TABLE 2: URC LIST ................................................................................................................................... 21 TABLE 3: TERMS AND ABBREVIATIONS ................................................................................................ 23 l e t l c a e i t u n Q ide f n o C M66-DS_DSDS_Application_Note Confidential / Released 4 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 1 Introduction This document mainly introduces how to use the Dual SIM Dual Standby (DSDS) function of Quectel M66-DS module. M66-DS can be connected to two SIM cards simultaneously, and perform Location Update for them. Working with two protocol stacks, the module can monitor the paging and do Cell Reselection independently for the two SIMs. However, as the module has only one RF channel, any of these two SIMs but only one of them can attach GPRS or stay in dedicated state for voice call or GPRS transferring. For example, if the module is ringing from one SIM, the other will be disabled from making a MO or MT call; if one SIM has already activated the PDP, the PDP activation request from the other SIM will be rejected. l e t l c a e i t u n Q ide f n o C M66-DS_DSDS_Application_Note Confidential / Released 5 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 2 Rules of DSDS Command and URC The general rules of DSDS commands and URCs are illustrated below: For URCs: SIM1 uses the standard URC string, while SIM2 comes with a suffix “DS”. For example, “RING” indicates SIM1 is ringing, while “RING DS” indicates SIM2 is ringing. Please refer to Chapter 5 for detailed URCs. l e t l c a e i t u n Q ide f n o C For AT commands: For most AT commands, the two SIMs share the same format. After using AT+QDESL command to specify a SIM, subsequent commands will be applied for the specified SIM only. Example AT+QDSEL=1 OK AT+CPIN? +CPIN: READY OK AT+QDSEL=2 OK AT+CPIN? +CPIN: READY OK //Note: It‟s not +CPINDS: Some commonly used AT commands also have their dual-SIM version, so as to query the properties of both SIMs. These commands can be executed on any of the SIM context. AT+QDSQ, AT+QDSREG, and AT+QDSGREG commands are some of the examples. M66-DS_DSDS_Application_Note Confidential / Released 6 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 3 Examples of Common Procedures This chapter will describe how the module initializes the dual SIMs after power on and how to perform some common procedures with the dual SIM cards, such as making a voice call, accepting a voice call, GPRS attachment, PPP dialup and TCP connecting. In general, the target SIM card needs to be chosen first before these procedures are performed. The command AT+QDSEL is used to select which SIM will be used to perform these actions. l e t l c a e i t u n Q ide f n o C The following is an example list of the AT commands. For more details, please refer to Chapter 4. Table 1: Examples of AT Commands AT Commands Description AT+QDSEL Choose which SIM to be operated. All the following commands will target to the selected SIM and protocol stack. AT+QDSQ AT+QDSREG AT+QDSGREG DS version of AT+CSQ. Query the signal quality of the two networks. DS version of AT+CREG. Query the CS registration state of the two SIMs. DS version of AT+CGREG. Query the GPRS state of the two SIMs. 3.1. Initialization after Power on After power on, the module will detect both SIM cards and initialize them if they are inserted. After the two SIMs are initialized, the module will automatically register the network. Only SIM1 will attach the GPRS automatically if both cards are inserted. When only SIM2 is inserted, SIM2 will also attach the GPRS automatically. Some of the initialization URC will output in this stage. RDY +CFUN: 1 // Phone functionality status report based on SIM1 protocol stack +CPIN: READY // SIM1 Ready +CFUNDS: 1 // Phone functionality status report based on SIM2 protocol stack M66-DS_DSDS_Application_Note Confidential / Released 7 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note +CPINDS: READY // SIM2 Ready Call Ready // SIM1‟s phonebook has been initialized Call Ready DS // SIM2‟s phonebook has been initialized SMS Ready // SIM1‟s SMS has been initialized SMS Ready DS AT+QDSREG? +QDSREG: 1,0,1 +QDSREG: 2,0,1 // SIM2‟s SMS has been initialized OK l e t l c a e i t u n Q ide f n o C AT+QDSGREG? +QDSGREG: 1,0,1 +QDSGREG: 2,0,0 OK // Query the registration status. Both are registered. // Query the GPRS status. Only SIM1 is auto attached. 3.2. Make a Voice Call Call Ready Call Ready DS AT+QDSEL? +QDSEL: 1,1,1 OK AT+QDSREG? +QDSREG: 1,0,1 +QDSREG: 2,0,2 OK AT+QDSREG? +QDSREG: 1,0,1 +QDSREG: 2,0,1 // Both are registered. OK M66-DS_DSDS_Application_Note Confidential / Released 8 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note AT+QDSQ +QDSQ: 1,26,0 +QDSQ: 2,26,0 OK ATD10086; OK // Dial with SIM1 AT+CLCC +CLCC: 1,0,0,0,0,"10086",129,"" OK ATH OK AT+QDSEL=2 OK AT+QDSEL? +QDSEL: 2,1,1 OK ATD10086; OK l e t l c a e i t u n Q ide f n o C // Select SIM2 // Dial with SIM2 AT+CLCC +CLCC: 1,0,0,0,0,"10086",129,"" OK ATH OK 3.3. Accept a Voice Call AT+QDSEL? +QDSEL: 1,1,1 // In SIM 1 context M66-DS_DSDS_Application_Note Confidential / Released 9 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note OK // Incoming call from SIM2 RING DS RING DS ATA +CME ERROR: 3 // Will fail if accept in SIM1 context RING DS AT+QDSEL=2 OK RING DS ATA OK // Select to operate on SIM2 context l e t l c a e i t u n Q ide f n o C // Accept the call AT+CLCC +CLCC: 1,1,0,0,0,"18955125763",129,"" OK NO CARRIER DS AT+QDSEL=1 OK AT+QDSEL? +QDSEL: 1,1,1 OK RING RING // Hung up by remote // Incoming call from SIM 1 ATA OK AT+CLCC +CLCC: 1,1,0,0,0,"18955125763",129,"" M66-DS_DSDS_Application_Note Confidential / Released 10 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note OK NO CARRIER // SIM1‟s call is hung up by remote 3.4. Attach GPRS AT+QDSEL? +QDSEL: 1,1,1 OK l e t l c a e i t u n Q ide f n o C AT+QDSGREG? +QDSGREG: 1,0,1 +QDSGREG: 2,0,0 OK AT+CGATT? +CGATT: 1 OK AT+QDSEL=2 OK AT+CGATT? +CGATT: 0 OK // SIM1 is GPRS attached; SIM2 is detached. // SIM1 context. CGATT is 1. // Select SIM2 AT+CGATT=1 +CME ERROR: 100 // Failed because SIM1 is already attached. Only one is allowed to be attached. AT+QDSEL=1 OK AT+CGATT=0 OK // Select SIM1 to detach first // Must detach first. Only one SIM can be attached. AT+CGATT? +CGATT: 0 M66-DS_DSDS_Application_Note Confidential / Released 11 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note OK AT+QDSGREG? +QDSGREG: 1,0,0 +QDSGREG: 2,0,0 OK AT+QDSEL=2 OK AT+CGATT=1 OK AT+CGATT? +CGATT: 1 OK // Select SIM2 and attach l e t l c a e i t u n Q ide f n o C AT+QDSGREG? +QDSGREG: 1,0,0 +QDSGREG: 2,0,1 OK 3.5. PPP Dialup // Take SIM1 for example. Now SIM2 is attached. First detach it; then attach SIM1; and finally dial up PPP. AT+QDSGREG? +QDSGREG: 1,0,0 +QDSGREG: 2,0,1 OK AT+QDSEL=2 OK AT+CGATT=0 OK AT+QDSEL=1 OK M66-DS_DSDS_Application_Note Confidential / Released 12 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note AT+CGATT=1 OK AT+CGATT? +CGATT: 1 OK // Can continue the PPP dialup process … l e t l c a e i t u n Q ide f n o C 3.6. Establish TCP Connection AT+QDSEL? +QDSEL: 1,1,1 OK AT+QDSGREG? +QDSGREG: 1,0,1 +QDSGREG: 2,0,0 OK AT+CGATT? +CGATT: 1 OK AT+QIREGAPP OK AT+QIACT OK // SIM1 is GPRS attached; SIM2 is detached. // SIM1 context. CGATT is 1. AT+QIOPEN=”TCP”,”220.180.239.201”,8047 OK CONNECT OK AT+QISEND >0123456789 //Send data to the remote server // „>‟ from the UART indicates the following input data is considered as the data to M66-DS_DSDS_Application_Note Confidential / Released 13 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note be sent. After receiving „>‟, input data (“0123456789”) //After data input, use <Ctrl+Z> to send the data //SEND OK means the data has been sent. <Ctrl+Z> SEND OK AT+QISACK +QISACK: 11,11,0 OK AT+QICLOSE CLOSE OK AT+QIDEACT DEACT OK AT+CGATT=0 OK AT+QDSEL=2 OK AT+CGATT=1 OK AT+CGATT? +CGATT: 1 OK //Close the SIM1 TCP connection, and then detach it. l e t l c a e i t u n Q ide f n o C AT+QDSGREG? +QDSGREG: 1,0,0 +QDSGREG: 2,0,1 OK AT+QIREGAPP OK // Select SIM2 and attach // SIM2 context. CGATT is 1. // SIM1 is GPRS detached; SIM2 is attached. AT+QIACT OK AT+QIOPEN=”TCP”,”220.180.239.201”,8047 OK M66-DS_DSDS_Application_Note Confidential / Released 14 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note CONNECT OK //Send data to the remote server // „>‟ from the UART indicates the following input data is considered as the data to be sent. After receiving „>‟, input data (“9876543210”) //After data input, use <Ctrl+Z> to send the data //SEND OK means the data has been sent. AT+QISEND >9876543210 <Ctrl+Z> SEND OK AT+QISACK +QISACK: 11,11,0 OK AT+QICLOSE CLOSE OK AT+QIDEACT DEACT OK l e t l c a e i t u n Q ide f n o C //Close the SIM2 TCP connection, and then detach it. M66-DS_DSDS_Application_Note Confidential / Released 15 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 4 DSDS Commands Description 4.1. AT Command Syntax l e t l c a e i t u n Q ide f n o C Test Command AT+<x>=? This command returns the list of parameters and value ranges set by the corresponding Write Command or internal processes. Read Command AT+<x>? This command returns the currently set value of the parameter or parameters. Write Command AT+<x>=<…> This command sets the user-definable parameter values. Execution Command AT+<x> This command reads non-variable parameters affected by internal processes in the GSM engine. 4.2. Select the SIM Card If one action is targeted to a specific SIM, the module needs switching to this SIM first. Command AT+QDSEL can be used for SIM card selection. Details are illustrated below. 4.2.1. AT+QDSEL Select the SIM Card AT+QDSEL is used to specify which SIM the subsequent commands will apply to. AT+QDSEL Select the SIM Card Test Command AT+QDSEL=? Read Command AT+QDSEL? Response +QDSEL: (list of supported <sim>s) OK Response +QDSEL: <sim>,<sim1_status>,<sim2_status> OK Write Command AT+QDSEL=<sim> M66-DS_DSDS_Application_Note Response OK Confidential / Released 16 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note Reference Parameter <sim> <sim1_status> <sim2_status> NOTE Which SIM card 1 2 SIM1 status 0 1 SIM2 status 0 1 SIM slot 1 SIM slot 2 Not inserted Inserted. l e t l c a e i t u n Q ide f n o C Not inserted Inserted. <sim> number is identified by hardware SIM slot number. 4.3. Set/Query the Properties of the Dual SIMs Quectel provides some AT commands to set or query some common properties of dual SIMs easily, without the need of switching between them. 4.3.1. AT+QDSIMEI Set the IMEI for Dual SIMs AT+QDSIMEI is used to set the individual IMEI for each SIM. By default, both IMEIs are written into the module from factory. It is suggested not to change the default IMEI unless it is necessary. AT+QDSIMEI Set the IMEI for Dual SIMs Test Command AT+QDSIMEI=? Read Command AT+QDSIMEI? Response +QDSIMEI: (list of supported <sim>s),“imei” OK Response +QDSIMEI: <sim>,“imei1” +QDSIMEI: <sim>,“imei2” OK M66-DS_DSDS_Application_Note Confidential / Released 17 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note Write Command AT+QDSIMEI =<sim>,”imei” Response OK Reference Parameter SIM card number 1 SIM1 2 SIM2 IMEI string IMEI for SIM1 protocol stack IMEI for SIM2 protocol stack <sim> “imei” “imei1” “imei2” NOTE l e t l c a e i t u n Q ide f n o C The input IMEI must be valid. Refer to GSM 02.16 for the IMEI validation check. 4.3.2. AT+QDSQ Query the Signal Quality of Dual SIMs AT+QDSQ is used to query the signal quality of dual SIM cards. AT+QDSQ Query the Signal Quality of Dual SIMs Test Command AT+QDSQ=? Response OK Execute Command AT+QDSQ Response +QDSQ: <sim>,<rssi1>,<ber1> +QDSQ: <sim>,<rssi2>,<ber2> OK Reference Parameter <sim> SIM card number 1 SIM1 M66-DS_DSDS_Application_Note Confidential / Released 18 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note <rssi1>,<rssi2> <ber1>,<ber2> 2 SIM2 Signal strength for both protocols 0 113 dBm or less 1 111 dBm 2...30 109... 53 dBm 31 51 dBm or greater 99 Not known or not detectable Bit error rate for both protocols (in percent): 0...7 As RXQUAL values in the table in GSM 05.08 subclause 8.2.4 99 Not known or not detectable l e t l c a e i t u n Q ide f n o C 4.3.3. AT+QDSREG Query the Network Registration Status of Dual SIMs AT+QDSREG is used to query the network registration status of dual SIM cards. AT+QDSREG Query the Network Registration Status of Dual SIMs Test Command AT+QDSREG=? Read Command AT+QDSREG? Response OK Response +QDSREG: <sim>,<n>,<stat>[,<lac>,<ci>] +QDSREG: <sim>,<n>,<stat>[,<lac>,<ci>] OK Reference Parameter <sim> <n> <stat> <lac> <ci> 1 Status of SIM1 2 Status of SIM2 0 Disable network registration unsolicited result code 1 Enable network registration unsolicited result code 2 Enable network registration unsolicited result code with location information 0 Not registered, ME is not currently searching a new operator to register to 1 Registered, home network 2 Not registered, but ME is currently searching a new operator to register to 3 Registration denied 4 Unknown 5 Registered, roaming String type; two byte location area code in hexadecimal format String type; two byte cell ID in hexadecimal format M66-DS_DSDS_Application_Note Confidential / Released 19 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 4.3.4. AT+QDSGREG Query the GPRS Status of Dual SIMs AT+QDSGREG is used to query the GPRS status of dual SIM cards. AT+QDSGREG Query the GPRS Status of Dual SIMs Test Command AT+QDSGREG=? Response OK Read Command AT+QDSGREG? Response +QDSGREG: <sim>,<n>,<stat>[,<lac>,<ci>] +QDSGREG: <sim>,<n>,<stat>[,<lac>,<ci>] l e t l c a e i t u n Q ide f n o C OK Reference Parameter <sim> <n> <stat> <lac> <ci> SIM card number 1 Query SIM1 2 Query SIM2 0 Disable network registration unsolicited result code 1 Enable network registration unsolicited result code 2 Enable network registration and location information unsolicited result code 0 Not registered, ME is not currently searching a new operator to register to 1 Registered, home network 2 Not registered, but ME is currently searching a new operator to register to 3 Registration denied 4 Unknown 5 Registered, roaming String type; two byte location area code in hexadecimal format (e.g. "00C3" equals 195 in decimal) String type; two bytes cell ID in hexadecimal format M66-DS_DSDS_Application_Note Confidential / Released 20 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 5 URC “DS” is suffixed on the URC to indicate that it‟s for SIM2. The URCs are listed in the following table. Table 2: URC List Category SIM SMS Network Call l e t l c a e i t u n Q ide f n o C SIM 1 URC SIM 2 URC Meaning +CFUN: +CFUNDS: Phone functionality status report Call Ready Call Ready DS PHB is ready +CPIN: +CPINDS: SIM card pin state SMS Ready SMS Ready DS SMS is initialized +CDS: +CDSDS: SMS delivery status report is received and output directly +CMTI: +CMTIDS: New message is received, and saved to memory +CMT: +CMTDS: New short message is received and output directly to TE +CREG: +CREGDS: Indicate registration status of the ME +CGREG: +CGREGDS: Network registered +CSQN: +CSQNDS: Signal quality change +QGURC: +QGURCDS: Unsolicited result code follows particular call state transition RING RING DS Indicates an incoming call BUSY BUSY DS Busy NO ANSWER NO ANSWER DS No answer NO CARRIER NO CARRIER DS Call is hung up NO DIALTONE NO DIALTONE DS No dial tone M66-DS_DSDS_Application_Note Confidential / Released 21 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note +COLP: +COLPDS: The presentation of the COL (connected line) at the TE for a mobile originated call +CLIP: +CLIPDS: Mobile terminating call indication +CRING: +CRINGDS: An incoming call is indicated to the TE with unsolicited result code instead of the normal RING +CCWA: +CCWADS: Call waiting indication MO RING MO RING DS MO call ringing MO CONNECTED MO CONNECTED DS MO call connected STK +STKPCI: +STKPCIDS: STK data notification NITZ +QNITZ: +QNITZDS: NITZ notification l e t l c a e i t u n Q ide f n o C M66-DS_DSDS_Application_Note Confidential / Released 22 / 23 GSM/GPRS Module Series M66-DS DSDS Application Note 6 Appendix A References Table 3: Terms and Abbreviations Abbreviation DSDS DS GPRS ME MO MS MT NITZ PDP PHB PPP SIM STK TCP TE Description l e t l c a e i t u n Q ide f n o C Dual SIM Dual Standby Dual SIM General Packet Radio Service Mobile Equipment Mobile Originated Mobile Station Mobile Terminated Network Identity and Time Zone Packet Data Protocol Phonebook Point to Point Protocol Subscriber Identity Module SIM Tool Kit Transmission Control Protocol Terminal Equipment UART Universal Asynchronous Receiver/Transmitter URC Unsolicited Result Code M66-DS_DSDS_Application_Note Confidential / Released 23 / 23