<?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>How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62845/how-to-get-mcc-and-mnc-using-modem_info-h</link><description>&amp;lt;environment&amp;gt; - Windows10 - modem fw v1.2.0 - nrf v1.3.0 
 I try to get mnc and mcc data but no luck. Any help? 
 
 I also tried it using modem_info_params_init and modem_info_params_get, but modem_info_params_get causes an error -11.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 09 Jul 2020 14:09:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62845/how-to-get-mcc-and-mnc-using-modem_info-h" /><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/259227?ContentTypeID=1</link><pubDate>Thu, 09 Jul 2020 14:09:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:278c1e8b-b1fd-4803-a424-480a6a2fb4ae</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;have you found the reason for the error? Try debugging and see where in &lt;span&gt;modem_info_params_get&lt;/span&gt;() the error occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/257212?ContentTypeID=1</link><pubDate>Sat, 27 Jun 2020 02:37:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1edcbad0-61d5-47c7-af92-4952a51acea4</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;line 164 causes an error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;LOG_ERR(&amp;quot;Network data not obtained: %d&amp;quot;, ret);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I put 10 sec sleep before&amp;nbsp;modem_info_params_get, but same result.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/256576?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 07:05:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:384a4e16-06dd-440f-a976-0d4ab97ee462</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Okay, were you able to do the debugging I asked for?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/256511?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 14:28:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fdcbb10e-48be-43ed-b567-529b0a3bd64c</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;&amp;gt;Are you using a custom board?&lt;/p&gt;
&lt;p&gt;No I&amp;#39;m using DK 0.9.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/256503?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 14:22:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f754e85e-8b79-494e-8a3f-94f1a6dac77c</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;ve tried testing your code but when I flash it to the nRF9160 DK, it won&amp;#39;t start up. Zephyr isn&amp;#39;t booting.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you using a custom board?&lt;/p&gt;
&lt;p&gt;Since I can&amp;#39;t test and therefore can&amp;#39;t reproduce the error, you&amp;#39;ll have to do some debugging for us.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the function&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/modem_info/modem_info_params.c#L131"&gt;modem_info_params_get&lt;/a&gt;, there are a few places that return -EAGAIN (-11), specifically &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/modem_info/modem_info_params.c#L164"&gt;line 164&lt;/a&gt;, &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/modem_info/modem_info_params.c#L178"&gt;line 178&lt;/a&gt; and &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/modem_info/modem_info_params.c#L188"&gt;line 188&lt;/a&gt;. Please find out which one of these lines is returning the error. It would be useful to see where it&amp;#39;s failing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/256299?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 04:06:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74dfc56a-2370-4a78-b88a-8735c10eaa73</guid><dc:creator>Yusuke</dc:creator><description>&lt;p&gt;I&amp;#39;ve read the ticket. It&amp;#39;s not clear what to do for me.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;&lt;span&gt;Changing .data_type to&amp;nbsp;&lt;/span&gt;&lt;span&gt;AT_PARAM_TYPE_STRING at&amp;nbsp;lib/modem_info/modem_info.c:173&lt;br /&gt;&lt;/span&gt;&lt;span&gt;2.&amp;nbsp;read out MODEM_INFO_OPERATOR&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;3.&amp;nbsp;get the concatenated MCC and MNC string&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Is this correct?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In addition, modem_info_params_get give an error -11.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;lt;main.c&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;zephyr.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;modem/modem_info.h&amp;gt;
#include &amp;lt;modem/lte_lc.h&amp;gt;
#include &amp;lt;modem/at_params.h&amp;gt;

struct modem_param_info modem_param;

void main() {

    int ret;
    char rx_buf[MODEM_INFO_MAX_RESPONSE_SIZE];
    u16_t rx_buf_short;

    // Connect LTE first
    printk(&amp;quot;LTE Link Connecting ...\n&amp;quot;);
    ret = lte_lc_init_and_connect();
    if(ret &amp;lt; 0){
        printk(&amp;quot;Error: lte_lc_init_and_connect\n&amp;quot;);
        return;
    } else {
        printk(&amp;quot;LTE Link Connected!\n&amp;quot;);
    }

    // Init modem info param
    ret = modem_info_params_init(&amp;amp;modem_param);
    if(ret != 0){
        printk(&amp;quot;Error: modem_info_params_init\n&amp;quot;);
        return;
    }

    // Stores all retrieved information
    ret = modem_info_params_get(&amp;amp;modem_param);
    if(ret != 0){
        printk(&amp;quot;Error: modem_info_params_get, %d\n&amp;quot;, ret); // ERROR
        return;
    }
    
    return;
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;lt;prj.conf&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;# General config
CONFIG_ASSERT=y
CONFIG_NEWLIB_LIBC=y

# BSD library
CONFIG_BSD_LIBRARY=y
CONFIG_MODEM_INFO=y
CONFIG_CJSON_LIB=y

# AT host library
CONFIG_AT_HOST_LIBRARY=n

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_LOCK_BANDS=y
CONFIG_LTE_LOCK_BAND_MASK=&amp;quot;10000000&amp;quot;
CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_EDRX_REQ=y
CONFIG_LTE_EDRX_REQ_VALUE=&amp;quot;0101&amp;quot;
# 0101 81.92sec
# 0110 102.4sec
# 1000 143.36sec
# 1001 163.84sec
# 1010 327.68sec
# 1011 655.36sec
# 1100 1310.72sec

# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=16384

# SEGGER RTT
CONFIG_PRINTK=y
CONFIG_CONSOLE=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;lt;CMakeList.txt&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2018 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
cmake_minimum_required(VERSION 3.8.2)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(get_cell_station_info)

target_sources(app PRIVATE src/main.c)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to get mcc and mnc using modem_info.h ?</title><link>https://devzone.nordicsemi.com/thread/256251?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 15:03:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ac67611-d145-414d-9ad0-ae8260b5fa5f</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please take a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/54757/modem_info_short_get-fails"&gt;this ticket&lt;/a&gt;&amp;nbsp;and specifically Jan Tore&amp;#39;s last comment and try his suggestion.&lt;/p&gt;
&lt;p&gt;If you&amp;#39;re still having trouble, please provide your full code (so the prj.conf file and the CMakeLists.txt file).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>