How to unlock a SIM card on C027_U20

17 Aug 2014

Hello everyone

I am trying to unlock a SIM card on the C027_U20.

My code is the following:

#include "mbed.h"

//------------------------------------------------------------------------------------
/* This example was tested on C027-U20 and C027-G35 with the on board modem. 
   
   Additionally it was tested with a shield where the SARA-G350/U260/U270 RX/TX/PWRON 
   is connected to D0/D1/D4 and the GPS SCL/SDA is connected D15/D15. In this 
   configuration the following platforms were tested (it is likely that others 
   will work as well)
   - U-BLOX:    C027-G35, C027-U20, C027-C20 (for shield set define C027_FORCE_SHIELD)
   - NXP:       LPC1549v2, LPC4088qsb
   - Freescale: FRDM-KL05Z, FRDM-KL25Z, FRDM-KL46Z, FRDM-K64F
   - STM:       NUCLEO-F401RE, NUCLEO-F030R8
                mount resistors SB13/14 1k, SB62/63 0R
*/
#include "GPS.h"
#include "MDM.h"
//------------------------------------------------------------------------------------
// You need to configure these cellular modem / SIM parameters.
// These parameters are ignored for LISA-C200 variants and can be left NULL.
//------------------------------------------------------------------------------------
//! Set your secret SIM pin here (e.g. "1234"). Check your SIM manual.
#define SIMPIN      "4986"
/*! The APN of your network operator SIM, sometimes it is "internet" check your 
    contract with the network operator. You can also try to look-up your settings in 
    google: https://www.google.de/search?q=APN+list */
#define APN         "internet.eplus.de"
//! Set the user name for your APN, or NULL if not needed
#define USERNAME    "blau"
//! Set the password for your APN, or NULL if not needed
#define PASSWORD    "blau" 
//------------------------------------------------------------------------------------


int main(void)
{
    
    printf("start\n");
    MDMParser::DevStatus devStatus = {};
    bool ok;
    MDMSerial mdm;
    
    mdm.setDebug(3); 
    ok = mdm.init(SIMPIN, &devStatus, P2_6);
    mdm.dumpDevStatus(&devStatus);
    
    printf("ok?: %i\n", ok);
}

If I read the debug output I get the following:

start
Modem::wakeup
     0.275 AT send       4 "AT\r\n"
     1.578 AT send       4 "AT\r\n"
     2.882 AT send       4 "AT\r\n"
     4.184 AT send       4 "AT\r\n"
     4.227 AT read UNK   3 "AT\r"
     4.270 AT read OK    6 "\r\nOK\r\n"
Modem::init
     4.343 AT send       7 "AT E0\r\n"
     4.386 AT read UNK   6 "AT E0\r"
     4.436 AT read OK    6 "\r\nOK\r\n"
     4.493 AT send      11 "AT+CMEE=2\r\n"
     4.536 AT read OK    6 "\r\nOK\r\n"
     4.593 AT send      15 "AT+IPR=115200\r\n"
     4.653 AT read OK    6 "\r\nOK\r\n"
     4.742 AT send       5 "ATI\r\n"
     4.795 AT read UNK  20 "\r\nLISA-U200-02S-00\r\n"
     4.871 AT read OK    6 "\r\nOK\r\n"
     4.920 AT send      16 "AT+UGPIOC=20,2\r\n"
     4.980 AT read OK    6 "\r\nOK\r\n"
     5.030 AT send      10 "AT+CPIN?\r\n"
     5.073 AT read  +   18 "\r\n+CPIN: SIM PIN\r\n"
     5.140 AT read OK    6 "\r\nOK\r\n"
     5.180 AT send      14 "AT+CPIN=4986\r\n"
     5.240 AT read ERR  36 "\r\n+CME ERROR: Incorrect parameters\r\n"
Modem::devStatus
  Power Save:   Disabled
ok?: 0
Modem::powerOff
     5.396 AT send      12 "AT+CPWROFF\r\n"
     5.696 AT read OK    6 "\r\nOK\r\n"

So for me this looks like I can not unlock the SIM card, but the PIN is correct and the SIM card works perfect in a normal smartphone.

Any ideas what I'm doing wrong?

17 Aug 2014

And here a more clearly presented screenshot of the debug output.

http://www11.pic-upload.de/17.08.14/gnn3789uxvyb.png

28 Aug 2015

Maybe the quotes are missing in the CPIN command. Try using AT+CPIN="4986"<cr><lf>

You need to log in to post a reply