<?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>sim iccid</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68063/sim-iccid</link><description>Hello, 
 How can I read out the ICCID of the sim card? 
 I&amp;#39;ve tried to do it with AT%XICCID, getting error on this. 
 
 AT+CRSM=176,12258,0,0,10 
 
 
 +CRSM: 144,0,&amp;quot;98740006819041410210&amp;quot; 
 
 
 OK 
 
 
 the above works, but then the returned data is shifted</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Nov 2020 10:52:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68063/sim-iccid" /><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279194?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 10:52:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed2d621a-b7a3-473d-85b1-56cda032b23b</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Ok, well, thank you for taking your time to assist.&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279181?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 10:34:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:beed42d9-5bf7-4d4e-8941-6719cf702987</guid><dc:creator>anicare-tero</dc:creator><description>&lt;p&gt;Oh I didn&amp;#39;t remember that but yes, that explains why it was working for me but not for you. I tested the code with a custom board and I had activated the modem from my board&amp;#39;s code before the sample even started.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279171?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:52:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:009f2aa0-0167-4673-a746-ec66889bd07e</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;Yeah, it seems I need to activate with AT+CFUN=1, before asking for the ICCID&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main(void)
{

        //printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buf2);
        //printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buf3);

        printk(&amp;quot;The AT host sample started\n&amp;quot;);
	uint8_t buffer[100];
        char buffer1[100];
        
        k_sleep(K_MSEC(2000));
        at_cmd_write(&amp;quot;AT+CFUN=1&amp;quot;, //AT+CEREG?
			buffer,
			100,
			NULL);
	printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buffer);

        k_sleep(K_MSEC(2000));
        at_cmd_write(&amp;quot;AT+CFUN?&amp;quot;, //AT+CEREG?
			buffer,
			100,
			NULL);
	printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buffer);

	at_cmd_write(&amp;quot;AT%XICCID&amp;quot;, //AT+CEREG?
			buffer,
			100,
			NULL);
	printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buffer);

	at_cmd_write(&amp;quot;AT%XVBAT&amp;quot;, //AT+CEREG?
			buffer,
			100,
			NULL);
	printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buffer);

}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279168?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:45:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:675146e4-d565-4945-9c8a-f930ebe86155</guid><dc:creator>anicare-tero</dc:creator><description>&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;Are you receiving the ICCID by sending the AT command from the LTE Link Monitor?&lt;/span&gt;&amp;nbsp;&lt;strong&gt;EDIT:&amp;nbsp;&lt;/strong&gt;Oh, it seems you already answered on this earlier.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s strange that the code is working for me but not for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279165?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:40:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b50fff0b-2c87-4554-ab13-1fcc293b0269</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is the response I get with your changes to the code,&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/0066.Skjermbilde.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279162?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:34:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cb101ae-a4ac-4a31-adbb-113aedac94be</guid><dc:creator>anicare-tero</dc:creator><description>&lt;p&gt;I modified your code a little and now it&amp;#39;s working for me at least.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;drivers/uart.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

/**@brief Recoverable BSD library error. */
void bsd_recoverable_error_handler(uint32_t err)
{
	printk(&amp;quot;bsdlib recoverable error: %u\n&amp;quot;, err);
}

void main(void)
{
	printk(&amp;quot;The AT host sample started\n&amp;quot;);
	uint8_t buffer[100];

	at_cmd_write(&amp;quot;AT%XICCID&amp;quot;, //AT+CEREG?
			buffer,
			100,
			NULL);
	printk(&amp;quot;ANSWER %s&amp;quot;, buffer);

	at_cmd_write(&amp;quot;AT%XVBAT&amp;quot;, //AT+CEREG?
			buffer,
			100,
			NULL);
	printk(&amp;quot;ANSWER %s&amp;quot;, buffer);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279158?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:18:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efe4b6b2-e9dd-4307-a86b-d5bcdcfd37f7</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Hey Ziirou,&lt;/p&gt;
&lt;p&gt;Im not sure that is the issue,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/4848.Skjermbilde.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Maybe it has something to do with formatting the returned data correctly for print function?&lt;/p&gt;
&lt;p&gt;David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279156?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:14:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48aac462-5050-4cf1-a9d4-fcb182f833a4</guid><dc:creator>anicare-tero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I might found some mistakes in your code. With AT%XICCID command you are&amp;nbsp;trying to get the response into buf1 and then print buf2 &amp;amp; buf3. Just make sure you are trying to print out the same buffer that you have used with a sent AT command.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279148?ContentTypeID=1</link><pubDate>Tue, 10 Nov 2020 09:03:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a6699f5-2387-4b5c-8d62-09beaa1c4fc8</guid><dc:creator>David</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So I upgraded the modem firmware to 1.2.x, now Im able to use the command &amp;quot;AT%XICCID&amp;quot; and its response looks correct, but when I try to implement this in the AT_client example and print to console, the returned data is srumbled.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/*
 * Copyright (c) 2018 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
 */

#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;drivers/uart.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

/**@brief Recoverable BSD library error. */
void bsd_recoverable_error_handler(uint32_t err)
{
	printk(&amp;quot;bsdlib recoverable error: %u\n&amp;quot;, err);
}

void main(void)
{
	printk(&amp;quot;The AT host sample started\n&amp;quot;);
        int buf1[100];
        char buf2[100];
        char buf3[100];

        at_cmd_write(&amp;quot;AT%XICCID&amp;quot;, //AT+CEREG?
                   buf1,
                   100,
                   NULL);
        k_sleep(K_MSEC(2000)); 
        printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buf2);
        k_sleep(K_MSEC(100));
        at_cmd_write(&amp;quot;AT%XICCID&amp;quot;, //AT+CEREG?
                   buf1,
                   100,
                   NULL);
          
        printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buf3);
        k_sleep(K_MSEC(2000)); 
        at_cmd_write(&amp;quot;AT%XVBAT&amp;quot;, //AT+CEREG?
                     buf1,
                     100,
                     NULL);
          
            printk(&amp;quot;ANSWER %s\r\n&amp;quot;, buf1);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/7345.Skjermbilde.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Regards, David&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: sim iccid</title><link>https://devzone.nordicsemi.com/thread/279031?ContentTypeID=1</link><pubDate>Mon, 09 Nov 2020 13:58:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81a0c2c5-b5b4-4b25-a179-8547e3ebdde7</guid><dc:creator>anicare-tero</dc:creator><description>&lt;p&gt;What is the modem firmware version you are using? The&amp;nbsp;&lt;span&gt;AT%XICCID command is only supported by 1.1.3 and 1.2.x.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What is the error you are receiving from&amp;nbsp;AT%XICCID ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;On devices with older modem firmware (like 1.1.1) I have flipped&amp;nbsp;the ICCID string received from that CRSM command with this function:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/modem_info/modem_info.c#L351-L363"&gt;https://github.com/nrfconnect/sdk-nrf/blob/master/lib/modem_info/modem_info.c#L351-L363&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>