<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>What are the prerequisites to get the ICCID</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119923/what-are-the-prerequisites-to-get-the-iccid</link><description>Hi, 
 
 I would like to know what are the prerequisites to get the ICCID of the sim card: 
 This is the code I use, nothing special. I can get the IMEI of the modem but not the ICCID, I always get error 65536 which does not really make sense to me (=</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Mar 2025 16:33:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119923/what-are-the-prerequisites-to-get-the-iccid" /><item><title>RE: What are the prerequisites to get the ICCID</title><link>https://devzone.nordicsemi.com/thread/528062?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2025 16:33:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c239f3b-8e3f-4546-b1de-8d35679a2e23</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;SIM card needs to be activated to be able to read UICCID. You can look at&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ref_at_commands/page/REF/at_commands/mob_termination_ctrl_status/cfun_set.html"&gt;CFUN set&lt;/a&gt;&amp;nbsp;command and&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/nrf-apis-latest/page/group_lte_lc_ga5170c668f1a1f5f52fffe9daf9e2f1e4.html#ga5170c668f1a1f5f52fffe9daf9e2f1e4"&gt;lte_lc_func_mode&lt;/a&gt;&amp;nbsp;API.&lt;br /&gt;&amp;quot;Full functionality&amp;quot; corresponds to&amp;nbsp;&lt;span&gt;LTE_LC_FUNC_MODE_NORMAL, &amp;quot;Activates LTE without changing GNSS&amp;quot; (CFUN=21) corresponds to LTE_LC_FUNC_MODE_ACTIVATE_LTE and &amp;quot;Activates UICC&amp;quot; corresponds to&amp;nbsp;LTE_LC_FUNC_MODE_ACTIVATE_UICC. All these 3 modes can accomplish UICC initialization.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
[quote user="lseg"]I&amp;#39;m not sure if this is the proper way of doing it, but it seems to work[/quote]
&lt;p&gt;&lt;span&gt;This is good news. Your method seems to be OK.&lt;/span&gt;&lt;/p&gt;
[quote user="lseg"]Not sure if I should set function mode back to off before starting connection.[/quote]
&lt;p&gt;&lt;span&gt;When you use nrf_modem_lib_init(), it&amp;nbsp;initializes the Modem library in normal operating mode.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What are the prerequisites to get the ICCID</title><link>https://devzone.nordicsemi.com/thread/528054?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2025 15:31:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a21ae39-2f99-4e34-8337-6dddd094b6f0</guid><dc:creator>lseg</dc:creator><description>&lt;p&gt;I noticed here&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/108096/incorrect-iccid-value-from-modem_info"&gt;Incorrect ICCID value from modem_info&lt;/a&gt;that they are talking about CFUN 41 (Sim card only)&lt;br /&gt;&lt;br /&gt;So I did this change:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // Set the modem to activate only the UICC (SIM card)
    err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_ACTIVATE_UICC);
    if (err) {
        LOG_ERR(&amp;quot;Failed to activate UICC, error: %d&amp;quot;, err);
        return;
    }
    /* initialize info structures, this will contain the SIM card numbers as well */
    err = modem_info_init();
    if (err)
    {
        LOG_ERR(&amp;quot;Failed to initialize modem info!&amp;quot;);
        return;
    }
    // Retrieve the ICCID
    char iccid[24] = {0};
    err = modem_info_string_get(MODEM_INFO_ICCID, iccid, sizeof(iccid));
    if (err &amp;lt; 0) {
        LOG_ERR(&amp;quot;Failed to get ICCID, error: %d&amp;quot;, err);
    } else {
        LOG_INF(&amp;quot;ICCID: %s&amp;quot;, iccid);
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;before modem_info_init i set&amp;nbsp;lte_lc_func_mode_set(LTE_LC_FUNC_MODE_ACTIVATE_UICC) and after modem_info_init I readout the ICCID:​modem_info_string_get(MODEM_INFO_ICCID, iccid, sizeof(iccid))&lt;br /&gt;&lt;br /&gt;And this seems to work.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m not sure if this is the proper way of doing it, but it seems to work... Not sure if I should set function mode back to off before starting connection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>