<?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 is the optimal way to configure the modem?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/52077/what-is-the-optimal-way-to-configure-the-modem</link><description>Dear All, 
 I would like some advice with regards to the best practice with configuring and controlling the nRF9160 M1/NB1 connection. 
 When working with other modems, our approach, when connecting / registering, typically involves running a specific</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 23 Sep 2019 22:29:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/52077/what-is-the-optimal-way-to-configure-the-modem" /><item><title>RE: What is the optimal way to configure the modem?</title><link>https://devzone.nordicsemi.com/thread/211386?ContentTypeID=1</link><pubDate>Mon, 23 Sep 2019 22:29:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:facf2312-2b6e-4a45-aec2-d7d183a605ff</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;In general, you don&amp;#39;t need to modify the code, since mostly everything is handled by the modem and the lte_lc driver. But in some cases it is necessary to enable some configurations in order to be able to connect, also if you would like to implement some specific features you&amp;#39;ll have to add some configs. I will try to cover it briefly down below. In order to implement any of the configurations described below, you should put it in the&amp;nbsp;prj.conf file.&lt;/p&gt;
&lt;p&gt;You dont need to set the &lt;strong&gt;PDP context&lt;/strong&gt;, it is handled in the modem firmware. The modem detects what kind of SIM card is used, and sets the connection parameters (APN etc..) according to the SIM cards requirements. Read more about it in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/46288/nrf9160-verizon-sim/185491#185491"&gt;this ticket&lt;/a&gt;. However, if you want to change the PDP context manually, you need to set &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/reference/kconfig/CONFIG_LTE_PDP_CMD.html"&gt;CONFIG_LTE_PDP_CMD&lt;/a&gt;=y, and&amp;nbsp;assign&amp;nbsp;your specific parameters to &lt;a href="http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/reference/kconfig/CONFIG_LTE_PDP_CONTEXT.html"&gt;CONFIG_LTE_PDP_CONTEXT&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regarding&amp;nbsp;the &lt;strong&gt;band mask&lt;/strong&gt;, you should lock the bands that are used by your operator, in order to make the connection go faster. After a connection happens, you read out your operators supported bands, and lock in those particular bands. This can be done by enabling (set =y)&amp;nbsp;&lt;span&gt;CONFIG_LTE_LOCK_BANDS and assign the bands to&amp;nbsp;CONFIG_LTE_LOCK_BAND_MASK.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t need to &lt;strong&gt;check if the connection is active&lt;/strong&gt; before sending data, since this is handled by the drivers and the modem firmware, but you could do it if it&amp;#39;s preferable. To check the signal strength, you have to run the command&amp;nbsp;&lt;span&gt;AT+CESQ. &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/44818/nrf9160-dk-minimum-required-signal-strength"&gt;Here&lt;/a&gt; is an informative ticket about signal strength. If you would like to&amp;nbsp;see the EPS/EDP context and IP address you&amp;nbsp;run the command&amp;nbsp;AT+CGDCONT&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;Other things you may set&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If you want to &lt;strong&gt;save power&lt;/strong&gt;, you can enable &lt;a href="https://www.link-labs.com/blog/lte-e-drx-psm-explained-for-lte-m1"&gt;LTE eDRX&lt;/a&gt;. Set&amp;nbsp;&lt;span&gt;CONFIG_LTE_EDRX_REQ=y and assign type and value to respectively CONFIG_LTE_EDRX_REQ_ACTT_TYPE&amp;nbsp; and CONFIG_LTE_EDRX_REQ_VALUE.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Sometimes, when you are having troubles with the modem, a &lt;strong&gt;modem trace&lt;/strong&gt; may help you get to the bottom of it. It is done by setting&amp;nbsp;&lt;span&gt;CONFIG_BSD_LIBRARY_TRACE_ENABLED=y. Check out &lt;a href="https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect"&gt;this blog post&lt;/a&gt;, which shows you how to get a modem trace using the Trace Collector app.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Some networks does not support ePCO&lt;/strong&gt;, and then you have to disable it by setting&amp;nbsp;&lt;span&gt;CONFIG_LTE_LEGACY_PCO_MODE=y, which will enable PCO instead. Read more about ePCO and PCO &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47486/nrf9160-nb-iot-dns-failure"&gt;here &lt;/a&gt;and &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/51828/how-can-i-check-why-the-enclosed-ibasis-esim-does-not-connect-to-lte-network-in-germany"&gt;here&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Take a look at the driver lte_lc.c and the function &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/drivers/lte_link_control/lte_lc.c#L112"&gt;w_lte_lc_Init()&lt;/a&gt;&amp;nbsp;to get a better understanding of how the modem is configured. Also, all the configurations mentioned in this post is used by this function.&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I have not covered everything here, but please ask if you want me to elaborate on something else, or if anything in this post is unclear.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;div style="left:640px;top:185px;"&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;EDIT (9/24/2019):&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;I would like to mention some other AT commands that gives you information about the modem and the connection, which you could run after a connection is established. The command &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Fnw_service%2Fxmonitor_set.html"&gt;AT%XMONITOR&lt;/a&gt;&amp;nbsp;gives you information about the modem parameters, and&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Fnw_service%2Fcereg_read.html"&gt;AT+CEREG?&lt;/a&gt;&amp;nbsp;gives you info about the network status.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>