<?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>Need to get IMEI number of boards in com port, Need any sample code for the reference. I&amp;#39;m working in asset tracking sample code.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108657/need-to-get-imei-number-of-boards-in-com-port-need-any-sample-code-for-the-reference-i-m-working-in-asset-tracking-sample-code</link><description>Hi, 
 I&amp;#39;m currently working with the nRF9160DK and referencing the asset tracking v2 application code. For my project, I need to retrieve the IMEI number of the connected board through the COM port, which serves as the terminal in Visual Studio. However</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Feb 2024 08:40:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108657/need-to-get-imei-number-of-boards-in-com-port-need-any-sample-code-for-the-reference-i-m-working-in-asset-tracking-sample-code" /><item><title>RE: Need to get IMEI number of boards in com port, Need any sample code for the reference. I'm working in asset tracking sample code.</title><link>https://devzone.nordicsemi.com/thread/470947?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2024 08:40:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e288772-a470-4877-9356-96cdae632650</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Great to hear it worked!&lt;/p&gt;
&lt;p&gt;Hope you have a wonderful day!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to get IMEI number of boards in com port, Need any sample code for the reference. I'm working in asset tracking sample code.</title><link>https://devzone.nordicsemi.com/thread/470916?ContentTypeID=1</link><pubDate>Tue, 27 Feb 2024 05:10:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72637dfc-7454-4313-9a7a-8f98360510a6</guid><dc:creator>purushothaman</dc:creator><description>&lt;p&gt;Great thank you it worked!&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1709010563585v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to get IMEI number of boards in com port, Need any sample code for the reference. I'm working in asset tracking sample code.</title><link>https://devzone.nordicsemi.com/thread/470796?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 15:06:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a43907f9-3a52-4c29-b0af-1ae197ee2fbf</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="purushothaman"] and added this code in my GNSS sample code and called the function in main() foo();[/quote]
&lt;p&gt;Did you call this after initializing the modem?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to get IMEI number of boards in com port, Need any sample code for the reference. I'm working in asset tracking sample code.</title><link>https://devzone.nordicsemi.com/thread/470712?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 12:12:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e25a8f7c-d549-4fc2-b8d9-237c08768fd8</guid><dc:creator>purushothaman</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&amp;nbsp; &amp;nbsp; I added the header as they mentioned #include&amp;quot;&lt;span&gt;nrf_modem_at.h&amp;quot;&lt;/span&gt; and added this code in my GNSS sample code and called the function in main() foo();&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;foo&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;err&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;char&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt;[&lt;/span&gt;&lt;span&gt;64&lt;/span&gt;&lt;span&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;err&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;nrf_modem_at_cmd&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;sizeof&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt;), &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;quot;AT+CGSN=&lt;/span&gt;&lt;span&gt;%d&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;if&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;err&lt;/span&gt;&lt;span&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* error */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;printf&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;error\n&amp;quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* buffer contains the whole response */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span&gt;printf&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;Modem response:&lt;/span&gt;&lt;span&gt;\n&lt;/span&gt;&lt;span&gt;%s&lt;/span&gt;&lt;span&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;response&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;}&lt;/span&gt;&lt;/div&gt;
&amp;nbsp;but in the output, I&amp;#39;m getting message. for confirmation I added&amp;nbsp;&lt;span&gt;printf&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;error\n&amp;quot;&lt;/span&gt;&lt;span&gt;);so the output is given below.&lt;/span&gt;&lt;br /&gt;&amp;nbsp;error&lt;br /&gt;Modem response:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;there is no response but in return of err we are getting true value for err.&lt;br /&gt;what we need to do?&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Need to get IMEI number of boards in com port, Need any sample code for the reference. I'm working in asset tracking sample code.</title><link>https://devzone.nordicsemi.com/thread/470678?ContentTypeID=1</link><pubDate>Mon, 26 Feb 2024 10:56:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf98eb3b-65b4-4942-b4c7-75bc9e845154</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To read the IMEI, you can issue at command AT+CGSN:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ref_at_commands/REF/at_commands/general/cgsn_set.html?cp=2_2_0_3_3_0"&gt;https://infocenter.nordicsemi.com/topic/ref_at_commands/REF/at_commands/general/cgsn_set.html?cp=2_2_0_3_3_0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To query, you can use the nrf_modem_at_command() function, as shown here:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/99776/reading-and-storing-the-imei"&gt;Reading and storing the IMEI&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>