{"id":29480,"date":"2019-08-11T12:04:35","date_gmt":"2019-08-11T19:04:35","guid":{"rendered":"https:\/\/m2msupport.net\/m2msupport\/?page_id=29480"},"modified":"2019-08-11T12:06:06","modified_gmt":"2019-08-11T19:06:06","slug":"sim-at-commands-for-sim-presense-and-status","status":"publish","type":"page","link":"https:\/\/m2msupport.net\/m2msupport\/sim-at-commands-for-sim-presense-and-status\/","title":{"rendered":"SIM \u2013 AT commands for SIM presence and status"},"content":{"rendered":"<p>With <a href=\"http:\/\/m2msupport.net\/m2msupport\/download-at-command-tester\/\">Online AT Command Tester<\/a> tool,  you can get SIM status of the device.<\/p>\n<div class=\"video-responsive\"><iframe loading=\"lazy\" id=\"youTubePlayer\" width=\"750\" height=\"421\" src=\"https:\/\/www.youtube.com\/embed\/Z7GZ5Sqm8ZA\" frameborder=\"0\" allowfullscreen=\"\"><\/iframe><\/div>\n<p>SIM status and presence<\/p>\n<p>First enable the extended error codes to get a verbose format,<br \/>\nAT+CMEE=2<br \/>\nOK<\/p>\n<p>Now get the status of SIM presense,<br \/>\nAT+cpin?<br \/>\n+CME ERROR: SIM not inserted<\/p>\n<p>Above AT command response indicates that SIM card is not present. Verify that SIM is inserted properly and check again,<\/p>\n<p>AT+cpin?<br \/>\n+CPIN: READY<br \/>\nOK<\/p>\n<p>When the SIM card is ready, above AT response will be received from the module.<\/p>\n<pre style=\"color: blue; background-color: white; border: 1px solid black;\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n\/\/Script- sim_lock.at\n\n\/\/Test SIM lock related AT commands with this script\n\n\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\n\n \n\n\/\/Get the status of SIM PIN\n\n\/\/Pin status can be,\n\n\/\/     READY \u2013  This means  SIM PIN is already unlocked or lock has been disabled\n\n\/\/     SIM PIN \u2013 This means SIM PIN is locked and code is required\n\n\/\/     SIM PUK \u2013 Maximum number to retries to unlock has reached. PUK code is required from network provider to setup new PIN\n\n\/\/     These are other less common return values \u2013 PH_SIM PIN, PH_SM PUK, SIM PIN2, SIM PUK2\n\nAT+CPIN?\n\n \n\n\/\/WAIT for 1 sec\n\nWAIT=1\n\n \n\n\/\/First let us check if PIN lock feature is enabled using facility lock AT command\n\n\/\/\u201dSC\u201d is for SIM, 2 is query\n\nAT+CLCK=\u201dSC\u201d,2\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/Set up the SIM PIN LOCK\n\n\/\/ 1 is lock, \u201c1234\u201d is the pin code\n\nAT+CLCK=\u201dSC\u201d,1,\u201d1234?\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/You need to reset the device for SIM PIN changes to take effect\n\nAT+CFUN=1,1\n\n \n\n\/\/WAIT enough time for device to reset\n\nWAIT=15\n\n \n\n\/\/Check SIM is ready\n\nAT+CPIN?\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/Unlock SIM PIN\n\nAT+CPIN=\u201d1234?\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/You can confirm if PIN lock feature is enabled\n\nAT+CLCK=\u201dSC\u201d,2\n\n \n\n\/\/Let us change the SIM PIN code\n\n\/\/1234 is current code, 4321 is new code\n\nAT+CPWD=\u201dSC\u201d,\u201d1234?,\u201d4321?\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/You need to reset the device for SIM PIN changes to take effect\n\nAT+CFUN=1,1\n\n \n\n\/\/WAIT enough time for device to reset\n\nWAIT=15\n\n \n\n\/\/Check the CPIN status\n\nAT+CPIN?\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/Unlock SIM PIN\n\nAT+CPIN=\u201d4321?\n\n \n\n\/\/WAIT for 2 sec\n\nWAIT=2\n\n \n\n\/\/Confirm SIM is ready\n\nAT+CPIN?\n\n \n\n\/\/Now let us clear SIM lock\n\n\/\/O is to unlock SIM\n\nAT+CLCK=\u201dSC\u201d,0,\u201d4321?,1\n\n \n\n\/\/You need to reset the device for SIM PIN changes to take effect\n\nAT+CFUN=1,1\n\n \n\n\/\/WAIT enough time for device to reset\n\nWAIT=15\n\n \n\n\/\/Check the CPIN status\n\nAT+CPIN?\n<\/pre>\n<p>Output of the above script in the <a href=\"https:\/\/m2msupport.net\/m2msupport\/download-at-command-tester\/\">AT Command Tester tool<\/a><\/p>\n<pre style=\"color: blue; background-color: #ffffcc; border: 1px solid black;\">AT+CPIN?\n\n+CPIN: READY\n\n \n\nOK\n\nSIM is ready\n\n \n\nAT+CLCK=\u201dSC\u201d,2\n\n+CLCK: 0\n\n \n\nOK\n\nSIM Lock is not active\n\n \n\n \n\nAT+CLCK=\u201dSC\u201d,1,\u201d1234?\n\nOK\n\n \n\nAT+CFUN=1,1\n\nOK\n\n \n\nAT+CPIN?\n\n+CPIN: SIM PIN\n\n \n\nOK\n\nSIM PIN is required\n\n \n\n \n\nAT+CPIN=\u201d1234?\n\nOK\n\nSIM PIN is successfully unlocked .\n\n \n\n \n\nAT+CLCK=\u201dSC\u201d,2\n\n+CLCK: 1\n\n \n\nOK\n\nSIM Lock is active\n\n \n\n \n\nAT+CPWD=\u201dSC\u201d,\u201d1234?,\u201d4321?\n\nOK\n\nSIM PIN successfully changed\n\n \n\n \n\nAT+CFUN=1,1\n\nOK\n\n \n\nAT+CPIN?\n\n+CPIN: SIM PIN\n\n \n\nOK\n\nSIM PIN is required\n\n \n\nAT+CPIN=\u201d4321?\n\nOK\n\nSIM PIN is successfully unlocked .\n\n \n\n \n\nAT+CPIN?\n\n+CPIN: READY\n\n \n\nOK\n\nSIM is ready\n\n \n\nAT+CLCK=\u201dSC\u201d,0,\u201d4321?,1\n\nOK\n\nSIM lock is cleared\n\n \n\nAT+CFUN=1,1\n\nOK\n\n \n\nAT+CPIN?\n\n+CPIN: READY\n\n \n\nOK\n\nSIM is ready\n\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With Online AT Command Tester tool, you can get SIM status of the device. SIM status and presence First enable the extended error codes to get a verbose format, AT+CMEE=2 OK Now get the status of SIM presense, AT+cpin? +CME &hellip; <a href=\"https:\/\/m2msupport.net\/m2msupport\/sim-at-commands-for-sim-presense-and-status\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"software_howto.php","meta":{"footnotes":""},"class_list":["post-29480","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/29480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/comments?post=29480"}],"version-history":[{"count":2,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/29480\/revisions"}],"predecessor-version":[{"id":29482,"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/pages\/29480\/revisions\/29482"}],"wp:attachment":[{"href":"https:\/\/m2msupport.net\/m2msupport\/wp-json\/wp\/v2\/media?parent=29480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}