LTE SIM info

Hi,
I need to get the SIM serial number before setting the pin.

Right now I’m only successed to retrieve the uicc using this command:

:put ([ / interface lte info [ :pick [ find ] 0 ] once as-value ]->"uicc")

But this only works after setting the PIN.

I’ve tried with AT commands but I’ve got a strange behaviour:

/interface lte at-chat 0 input="AT+CCID"                                  
  output: ERROR

This happens both with or without pin number set.

Any idea?

Never tried with a SIM with pin set, so don’t know for sure the behavior. But your at-chat AT command might be “AT+ICCID”, not just AT+CCID.

/interface lte at-chat [find running] input="AT+ICCID"

output: +CME ERROR: 4
(Operation not supported)

This is valid for ROS 6.48.6, with LTE Model “R11e-LTE” Revision “MikroTik_CP_2.160.000_v020”
/interface lte at-chat lte1 input=“AT+ICCID?”
output: +ICCID: 8548512350010720871f
/interface lte at-chat lte1 input=“AT+ICCID?”
output: +ICCID: 8548512350010720871f
Both:

:put [:pick ([/interface lte at-chat lte1 input="AT+ICCID\?" as-value]->"output") 8 27]
8548512350010720871

EDIT: added Model and Revision of LTE modem used.

SXT LTE on 7.2rc7

[xyz@MTSXTLte] > :put [:pick ([/interface lte at-chat lte1 input="AT+ICCID\?" as-value]->"output") 8 27]

<blank, nothing returned>

[xyz@MTSXTLte] > /interface lte at-chat lte1 input="AT+ICCID?"
  output: ERROR

FYI: firmware on that thing was upgraded past weekend to V033

Uh, sorry, I forget the LTE Modem version,
I edit the previous post,
Provide same detail I add

I find the way, read
https://forum.mikrotik.com/viewtopic.php?p=924221#p924221

the UICC code / ICCID is also available with this on scripts, but must be already present on winbox for be readed:
:put ([/interface lte info lte1 once as-value]->“uicc”):put ([/interface lte monitor lte1 once as-value]->“uicc”)

The LTE Model R11e-4G Revision R11e-4G_V007 actually support the read of ICCID value, but RouterOS do not use correct AT command and do not obtain the value
output: +CME ERROR: operation not supportedFor this reason is unavailable also inside winbox

But you can obtain it with this command:
/int lte at-chat lte1 input=“AT%CCID”
output: +ICCID: 8548512350010720871
Both:

:put [:pick ([/int lte at-chat lte1 input="AT%CCID" as-value]->"output") 8 27]
8548512350010720871

Sorry …

[xyz@MTSXTLte] > /int lte at-chat lte1 input="AT%CCID"
  output: ERROR

Generally speaking the the OP’s command “AT+CCID” is right – but not all modules follow the “standard” here. Telit/Sierra generally use AT+ICCID, wasn’t sure if that help with R11e…
But “AT%CCID” be for WNC-based R11e LTE modems while some R11e LTE modems may use the Quectel version “AT+QCCID”…

But the OP mention a PIN code being set… I’m really not sure if you should even be able to read the ICCID without the PIN code – although that doesn’t make sense since the ICCID is printed on the SIM card & the ICCID is NOT a security key itself.

Which is why for V6,

:put  ([/interface lte info [find running] once as-value]->"uicc")

or, for V7,

:put  ([/interface lte monitor [find running] once as-value]->"uicc")

NOTE: “monitor” vs “info”

Using the monitor/info is WAY better than messing with at-chat since it really depending on the module/firmware/etc what work…

This is the ROUGH AT manual for the R11e-LTE-US, but don’t know how applicable it is to ALL R11e modems… but it documents the AT%CCID command:

https://www.avnet.com/opasdata/d120001/medias/docus/190/WTR-IMA2A-AT-Command-Guide-v1.2.pdf

On my example, you can read it R11e-4G, but is unavailable with monitor/info

Thanks for the fix about info/monitor on v6/v7

For obtain all supported commands:

/int lte at-chat lte1 input="AT+CLAC" wait=yes

and depend on modem version what comands are supported

And, depending on modem module model/fireware/ROS version/etc…, you may not also be able to use at-chat if the modem isn’t up either…

I say this since AT may be sent via MBIM, so there is no “real” AT channel & without an MBIM session being established, in some form, at-chat may not won’t work either. Now if the modem is ECM modem, again you may see different behavior since there should be some “real” USB serial port for ROS to use.

Interesting question, but I need a spare SIM to test with PIN enabled.
On production I do not use SIMs with PIN

Hi All,

tried everything you suggested, with no luck.

Device: hAP ac³ LTE6 kit LTE RBD53GR-5HacD2HnD&R11e-LTE6
SW Version: 6.47.10

Lte interface up and running:

 /interface lte info 0 once
           pin-status: ok
  registration-status: registered
        functionality: full
         manufacturer: "MikroTik"
                model: "R11e-LTE6"
             revision: R11e-LTE6_V025
     current-operator: 22288
                  lac: 20393
       current-cellid: 55296257
               enb-id: 216001
            sector-id: 1
           phy-cellid: 37
    access-technology: LTE (CA2)
       session-uptime: 19m15s
                 imei: 35666210140xxxx
                 imsi: 22288545205xxxx
                 uicc: 893988084511168xxxx
         primary-band: B3@20Mhz earfcn: 1650 phy-cellid: 37
              ca-band: B7@20Mhz earfcn: 3350 phy-cellid: 432
                 rssi: -65dBm
                 rsrp: -95dBm
                 rsrq: -10dB
                 sinr: 8dB

Results:

 /interface lte at-chat lte1 input="AT%CCID"
  output: ERROR

 /interface lte at-chat lte1 input="AT+ICCID"
  output: ERROR
 
  /interface lte at-chat lte1 input="AT+QCCID"
  output: ERROR
  
  /interface lte at-chat lte1 input="AT+ICCID\?"
  output: ERROR

/int lte at-chat lte1 input="AT+CLAC" 
  output: ATE ATI ATL ATM ATO ATP ATQ ATT ATV ATX ATZ AT&C AT&D AT&F AT&S AT&Z ATS0 AT+CGMI AT+CGMM AT+CGMR AT+CGSN AT+CSCS AT+CIMI 
          AT+ASTO AT+GMI AT+GMM AT+GMR AT+GSN AT+GOI AT+GCAP AT+GCI AT+IPR AT+ICF AT+IFC AT+IDSR AT+EXAMPLE AT^HVER AT ATA ATD ATH 
          AT+MVSYNAUD AT+CDU AT+CMOD AT+CBST AT+CVHU AT+CRLP AT+CMUT AT+ECHUPVT AT+CTTY AT+CREG AT+CIND AT+COPS AT+CPOL AT+COPN AT+CLCK 
          AT+CPWD AT+CLIP AT+CLIR AT+COLP AT+COLR AT+CNAP AT+CCFC AT+CCWA AT+CHLD AT+CUSD AT+CAOC AT+VTS AT+VTD AT+CSSN AT+CLCC AT+CEER 
          AT+PEER AT+CSQ AT*REJCAUSE AT+CPAS AT+CFUN AT*CFUN AT+CPIN AT+ZSEC AT+CPIN2 AT+EPIN AT*SIMDETEC AT+CTZR AT+CTZU AT*CTZR AT+CCLK 
          AT*PINCNT AT+CPBS AT+CPBR AT+CPBW AT*CPBR AT*CPBS AT+CPBF AT+CSVM AT+CSIM AT+CRSM AT+CGLA AT+CRLA AT+CCHO AT+CCHC AT+MSTK 
          AT*EUICC AT+CACM AT+CAMM AT+CCWE AT+CGREG AT+CGATT AT*CGATTC AT+ZGACT AT+CGACT AT+CGDATA AT+ZGDCONT AT*ZGDCONT AT+CGDCONT 
          AT+CGDSCONT AT+CGQMIN AT+CGQREQ
          
/int lte at-chat lte1 input="AT+CLAC" wait=yes
  output: ATE ATI ATL ATM ATO ATP ATQ ATT ATV ATX ATZ AT&C AT&D AT&F AT&S AT&Z ATS0 AT+CGMI AT+CGMM AT+CGMR AT+CGSN AT+CSCS AT+CIMI 
          AT+ASTO AT+GMI AT+GMM AT+GMR AT+GSN AT+GOI AT+GCAP AT+GCI AT+IPR AT+ICF AT+IFC AT+IDSR AT+EXAMPLE AT^HVER AT ATA ATD ATH 
          AT+MVSYNAUD AT+CDU AT+CMOD AT+CBST AT+CVHU AT+CRLP AT+CMUT AT+ECHUPVT AT+CTTY AT+CREG AT+CIND AT+COPS AT+CPOL AT+COPN AT+CLCK 
          AT+CPWD AT+CLIP AT+CLIR AT+COLP AT+COLR AT+CNAP AT+CCFC AT+CCWA AT+CHLD AT+CUSD AT+CAOC AT+VTS AT+VTD AT+CSSN AT+CLCC AT+CEER 
          AT+PEER AT+CSQ AT*REJCAUSE AT+CPAS AT+CFUN AT*CFUN AT+CPIN AT+ZSEC AT+CPIN2 AT+EPIN AT*SIMDETEC AT+CTZR AT+CTZU AT*CTZR AT+CCLK 
          AT*PINCNT AT+CPBS AT+CPBR AT+CPBW AT*CPBR AT*CPBS AT+CPBF AT+CSVM AT+CSIM AT+CRSM AT+CGLA AT+CRLA AT+CCHO AT+CCHC AT+MSTK 
          AT*EUICC AT+CACM AT+CAMM AT+CCWE AT+CGREG AT+CGATT AT*CGATTC AT+ZGACT AT+CGACT AT+CGDATA AT+ZGDCONT AT*ZGDCONT AT+CGDCONT 
          AT+CGDSCONT AT+CGQMIN AT+CGQREQ AT+CGEQREQ AT+CGEQMIN AT*REPORTIP AT+GETIP AT*TGSINK AT*TGSINK AT+CGSEND AT*ICSSINK AT+ZGPCOAUTH 
          AT*AUTHReq AT+FCLASS AT+CMGF AT+CMSS AT+CMGS AT+CMGC AT+CMGR AT+CMGW AT+CSCA AT+CSCB AT+CNMI AT+CGSMS AT+CMMS AT+CMGD AT+CMGL 
          AT+CSMS AT+CPMS AT+CSDH AT+CNMA AT+CSMP AT+CGCI AT+CGOI AT+VDUMP AT+LOG AT+VPDUS AT+VHDL AT+VECHO AT+ATDB AT*CCIREG AT+CPUC 
          AT+CHUP AT+CSTA AT+CRC AT+CMEE AT+CMER AT+CMEC AT+CLAC AT+CBC AT+CDIP AT+CPLS AT+CGCMOD AT+CNUM AT+DS AT+CGTFT AT*BAND 
          AT*BANDIND AT+WS46 AT*CLCK AT+LOCKLEVEL AT+ZNCK AT*MEPCG AT*ENVSIM AT*CNMA AT*POWERIND AT*APPOWERIND AT*FASTDORM AT+EEMOPT 
          AT+EEMGINFO AT*ZAIRINFO AT*ZCQI AT+ERGA AT+ERTCA AT+LPNWUL AT+LPLOCVR AT+LPECID AT+LPOTDOAABORT AT+LPOTDOAREQ AT*CELL 
          AT*SYSSLEEP AT*CP_MIPS AT*MRD_CDF AT*MRD_SN AT*MRD_SECOND_SN AT*MRD_HWINFO AT+RESET AT+POWEROFF AT+RSTSET AT*MRD_WIFISSID 
          AT*MRD_WIFISSID_5G AT*MRD_IMEI AT*CALINFO AT*MRD_MEP AT*MRD_WIFIID AT*MRD_BTID AT*MRD_VEND AT*MRD_BAND AT*PROD AT+LOCKNETLIST 
          AT+LOCKLIST AT+UNLOCKKEY AT+GPSSTEST AT*GPSTEST AT*GPSRST AT*TDTR AT*GSMTR AT*TGCTRL AT*WBTR AT*RFC AT*MRD_DUMP AT*CPMRD_DUMP 
          AT*MRD_AUTH AT+FUELGAIC AT*MRD_LIST AT*MAXPOWER AT+CKPD AT+OFF AT*CGSN AT*MODEMTYPE AT$VTS AT*MODEMRESET AT*SWITCHMODEM 
          AT*HTCCTO AT+CMEMFULL AT*EHSDPA AT^DCTS AT^DEELS AT^DEVEI AT^DNPR AT^DUSR AT+CIREG AT+CGEQOS AT+CEREG AT+CGCONTRDP AT+CGSCONTRDP 
          AT+CGTFTRDP AT+CGEQOSRDP AT+CGEREP AT+CVMOD AT+CEMODE AT+CGPADDR AT+CGPIAF AT^CACAP AT+CGCLASS AT+CESQ AT*CESQ AT+BGLTEPLMN 
          AT*FDY AT^SYSINFO AT*DIALE AT*CPBC AT*FDNBYPASS AT*RSTMEMFULL AT*CSCB AT*CBMCS AT*NASCHK AT*USBT AT*MOBILEDATA AT*GATR AT*CGATT 
          AT*GRIP AT*PSPG AT*CGMR AT*READVER AT*COMCFG AT+VZWRSRP AT+VZWRSRQ AT*CGDFLT AT*CGDFAUTH AT*VZWTESTAPP AT+VZWAPNE AT*LTEBAND 
          AT*RFTEMP AT*CSQ AT+LTEPOWER AT*LTECOEX AT%MBMSCMD AT%MBMSEV AT+CEN AT+CNEM AT*SINR AT*RSSI AT*RSRP AT*RSRPP AT*RSRPS AT*RSRQ 
          AT*RSRQP AT*RSRQS AT*CQI AT*URSLCT AT+CISRVCC AT+CEVDP AT+CVDP AT+CEUS AT+CAVIMS AT+CASIMS AT+CMMIVT AT+CIREP AT+CSSAC AT*DONOF 
          AT*PWRPLMN AT*CISCC AT*RANDFILL AT$CSQ AT$CREG AT$CCLK AT*CSG AT*APCFG AT*ISIMAID AT+MPBK AT*CIIND AT*PRXYSET AT*PRXYRSP 
          AT*CHDSTST AT+CNMPSD AT+CSAS AT+CRES AT*TELMODE AT*PSDC AT*CBRAT AT*IMLCONFIG AT*IGN AT*FRATLIST AT*PCO AT+CSDF AT+RSRP AT+RSRQ 
          AT+RSCP AT+ECNO AT+CLAN AT*CELLINFO AT+CCUG AT+CPNER AT*CATPROF AT*CATEN AT*RCATR AT*CATTR AT*CATENV AT*RCATE AT*AUDIOMODE 
          AT*AUDIODEVICE AT*AUDIOVOL AT*AUDIOMUTE AT*ECALLDATA AT*ECALLVOICE AT*ECALLCFG AT*ECALLONLY AT*ECALLREG AT*SIMPLUG AT*CGDCONTL 
          AT*SPIND AT*ECCLIST AT*IMSSRV AT+CPLMNS AT+CACL AT*DCONF AT*CGCLASS AT*CIWLANCID AT*BTSCNCT AT*BTSDISSCNCT AT*BTSTAPDU 
          AT*BTSTATR AT*BTSCTRL AT*BTSCRSTAT AT*BTSTP AT+OPERCFG AT*ICCID AT*PARK AT*CHECKEMER AT+CECALL AT*RPM AT*TEMPTEST AT*ZFACTORY 
          AT+ZDON AT+ZSNT AT+ZCAINFO AT+ZCACFG AT+ZRSSI AT+ZNLOCKBAND AT+ZPAS AT+ZCELLINFO AT+ACONFIG AT+IMSFUNC AT+ZVN AT+ZSTM AT+ZSELM 
          AT+ZSELI AT+ZBK AT+ZINKR AT+ZINPR AT+ZDISTR AT+ZNITZ AT+ZSYNCNITZ AT+ZDOGREF AT+ZATNUM AT+STRESS AT+SULOG AT+MEDCR AT+MIPLVER 
          AT+MIPLCREATE AT+MIPLDELETE AT+MIPLADDOBJ AT+MIPLDELOBJ AT+MIPLOPEN AT+MIPLUPDATE AT+MIPLCLOSE AT+MIPLDISCOVERRSP AT+MIPLREADRSP 
          AT+MIPLWRITERSP AT+MIPLEXECUTERSP AT+MIPLPARAMETERRSP AT+MIPLOBSERVERSP AT+MIPLNOTIFY AT+ZDHCPLEASE AT+GEFLAG AT+ZCFG AT+ZROAM 
          AT+ZVMAIL AT+ZGDFLT AT*ZCGMR AT+WIFISSID AT+WIFICHANNEL AT+WIFIFUN AT+SDCARD AT+FUNC AT%EXE AT%SRVCHANGE AT+OTADOWNLOAD 
          AT*CPMRD_LIST AT+SWITCHNETWORK AT+MIFIVER AT*MRD_BANDSUPPORT AT*BANDSUPPORT AT+FDEL OK

NOTE: On this particular board I’ve already setup the pin, but I need to read the ICCID BEFORE setting the ping (I’m working on a sort of automated deploy script)

Found a way

/int lte at-chat lte1 input="AT*ICCID\?"
  output: *ICCID: 893988084511168xxx
OK

Now, since I’ve a bounch of different devices I think I’ll have to find the right command for every modem/firmware I’ve got and write a script that tries to run every command until it find the working one.

And that works if there is a PIN code set?

Don’t know if this helps anyone, I did write a quick script function, findiccids, to search all the possibilities of separators ("+ ! @ # % $ *) between AT and “ICCID” or “CCID”.

:global findiccids do={
    :local atstrs {"ICCID";"CCID"}
    :local atseps {"+";"!";"@";"#";"%";"\$";"*"}
        :local rv
        :local result
        :foreach cmd in=$atstrs do={
            :foreach sep in=$atseps do={
                :foreach lteif in=[find running] do={
                    :local ltename [/interface lte get $lteif name]
                    :put "Trying 'AT$sep$cmd' on $ltename"
                    :set result [/interface lte at-chat $lteif input="AT$sep$cmd" as-value]
                    :if (result~".*[0-9]{12,16}.*") do={
                        # todo: should parse out the ICCID...
                        :put "Found ICCID using 'AT$sep$cmd' on $ltename: $($result->"output")"
                    }
                }
            }
        }
        :return rv
    }
    
$findiccids

which outputs:

 > $findiccids
Trying 'AT+ICCID' on lte1
Found ICCID using 'AT+ICCID' on lte1: ICCID: 890141032791yyyyxxxx
OK
Trying 'AT!ICCID' on lte1
Trying 'AT@ICCID' on lte1
Trying 'AT#ICCID' on lte1
Trying 'AT%ICCID' on lte1
Trying 'AT$ICCID' on lte1
Trying 'AT*ICCID' on lte1
Trying 'AT+CCID' on lte1
Trying 'AT!CCID' on lte1
Trying 'AT@CCID' on lte1
Trying 'AT#CCID' on lte1
Trying 'AT%CCID' on lte1
Trying 'AT$CCID' on lte1
Trying 'AT*CCID' on lte1

<someone has got too much free time …>