<?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>Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/67691/modem-errors-when-combining-https-and-gps</link><description>Hi, 
 After building and testing separate HTPS and GPS examples, I am getting modem errors when combining both projects into one application. One of our goals is to send GPS data over HTTPS to our server, and I have successfully gotten these examples</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Nov 2020 09:38:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/67691/modem-errors-when-combining-https-and-gps" /><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/278387?ContentTypeID=1</link><pubDate>Wed, 04 Nov 2020 09:38:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:057e67c3-915c-459a-944d-442122051e2f</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="kgarland789"]Does Nordic have separate GPS modules that you recommend?[/quote]
&lt;p&gt;&amp;nbsp;For that, you should ask your Regional Sales Manager.&lt;/p&gt;
&lt;p&gt;If you do not know how to contact your RSM, you can send me a private message with your location, and I will provide the contact information.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/278328?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2020 18:17:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d82c61d7-c8e4-482a-97e1-81c8833a65a3</guid><dc:creator>kgarland789</dc:creator><description>&lt;p&gt;Yeah sending BMS data frequently is crucial to our fleet management application.&lt;/p&gt;
&lt;p&gt;I agree it doesn&amp;#39;t seem plausible for GPS to run in between, so I think an external GPS module may be necessary. Does Nordic have separate GPS modules that you recommend?&lt;/p&gt;
&lt;p&gt;Thanks for all your help Didrik!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/278276?ContentTypeID=1</link><pubDate>Tue, 03 Nov 2020 13:34:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca23c0bf-6967-4cc4-b0b0-9afe4aec96a9</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Do you need to send the BMS data every second?&lt;/p&gt;
&lt;p&gt;To me, it does not sound like the GPS will be able to run between each transmission.&lt;/p&gt;
&lt;p&gt;In the LTE network, after you send somthing, there is a period where you have to stay connected to the tower and listen for incomming messages. This period is usually longer than 1 second, which means that the GPS would not be able to run in between.&lt;/p&gt;
&lt;p&gt;Depending on the network etc., it might be possible to tweak the performance so that it is possible, but the easiest would be to reduce the number of times you send data.&lt;/p&gt;
&lt;p&gt;Another option would be to use an external GPS module. Then, you would be able to run GPS and LTE in parallell, which should make your use case possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/278162?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2020 19:42:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b076578d-c7ba-4c92-b8c1-d1839487374d</guid><dc:creator>kgarland789</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;Thanks again for the providing this information. It looks like the PSM option may be the best for our application. We are sending CAN data from our BMS over HTTPS every second, but also sending GPS data over HTTPS every 5 seconds, and since we can only re attach to the network 30 times per hour, PSM may be our only option. We are generally sending data, not so much receiving data over the network. The only time we receive data from our servers is once during boot-up when we check for firmware updates and certain parameters for our device (CAN capture rate, etc..). Also we are using Hologram sim cards.&lt;/p&gt;
&lt;p&gt;Thanks again for all the detailed info, we greatly appreciate it!&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Kyle Garland&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/277840?ContentTypeID=1</link><pubDate>Fri, 30 Oct 2020 14:21:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6aa4cfd0-ead8-4345-b72a-316f0e18a1b1</guid><dc:creator>Didrik Rokhaug</dc:creator><description>[quote user="kgarland789"]I&amp;#39;m still familiarizing myself with using LTE and Zephyr, so where in the docs could I find the difference between lte_lc_init and lte_lc_init_and_connect functions?[/quote]
&lt;p&gt;&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/include/modem/lte_lc.html#_CPPv411lte_lc_initv"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/include/modem/lte_lc.html#_CPPv411lte_lc_initv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/include/modem/lte_lc.html#_CPPv414lte_lc_connectv"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/include/modem/lte_lc.html#_CPPv414lte_lc_connectv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/include/modem/lte_lc.html#_CPPv423lte_lc_init_and_connectv"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.3.0/nrf/include/modem/lte_lc.html#_CPPv423lte_lc_init_and_connectv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The lte_lc_init funtion configures the modem based on the Kconfig options you have set.&lt;/p&gt;
&lt;p&gt;The lte_lc_connect function connects to the cellular network.&lt;/p&gt;
&lt;p&gt;lte_lc_init_and_connect is simply a wrapper that first calls lte_lc_init, then lte_lc_connect.&lt;/p&gt;
&lt;p&gt;You can find their implementation here: &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/lte_lc.c#L516"&gt;https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/lte_lc.c#L516&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="kgarland789"]Since we cannot use GPS and LTE radios at the same time, would I need to disable the LTE radio while getting GPS data and then re-enable it when I start the HTTPS part of the application? If so, how would I accomplish this (what commands disables the LTE modem) and could I set some sort of flag that toggles the LTE radio so I can have my code repeat in a loop forever?[/quote]
&lt;p&gt;&amp;nbsp;There are a few different ways to solve this, with different strengths and drawbacks depending on you use case.&lt;/p&gt;
&lt;p&gt;The perhaps most obvious way to do it is to disable the LTE stack when you run the GPS. You can disable and enable the LTE stack separatly from the GNSS stack by sending AT+CFUN=20 or 21 to the modem. This will always work, in any network with any SIM card. But, you will have to re-attach to the network each time you want to send (or listen for) data. This causes higher power consumption due to the extra attach requests needed. In addition, you are only allowed to attempt to attach to a network 30 times per hour, so if you have short reporting intervals, you will be blocked from connecting to the network for a while.&lt;/p&gt;
&lt;p&gt;Another option is to use PSM (Power Saving Mode). This is a feature which let you inform the network that you do not expect any downlink data for a while. If granted for by the network, the device will turn of its radio for the given period of time. When it wakes up again, it will only have to do a Tracking Area Update (TAU), not a full reattach to the network. Unfortunatly, roaming devices will often not be granted PSM by the network. Different networks also have different PSM values that they allow, e.g. Verizon only grant PSM if you request 3 hours or longer. But, you can still send data at any time, you can just not receive any.&lt;/p&gt;
&lt;p&gt;When connected to the network, or after each data transfer, there is a period where the device has to listen for incoming messages. But during this period, the device is not in RX continuously, it will still have some short periods of sleep inbetween. eDRX (extended discontinuous reception) let you extend these periods of sleep. Again, this is something that must be requested from the network, and will usually not be granted to roaming devices.&lt;/p&gt;
&lt;p&gt;You can read more about eDRX and PSM here: &lt;a href="https://www.nordicsemi.com/Products/Low-power-cellular-IoT"&gt;https://www.nordicsemi.com/Products/Low-power-cellular-IoT&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you are using an iBasis SIM card, we have some data on which features are supported on what networks here:&lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/hardware-design/posts/ibasis-esim-national-coverage-update"&gt;https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/hardware-design/posts/ibasis-esim-national-coverage-update&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All that said, the GPS performance has been improved a lot in later versions. The modem will run the GPS whenever there is enough time, as long as the GPS is running. With the use of A-GPS, it will also not need a very long time to get a fix, and if it already has a fix, the next fix will also be much faster. It is therefore possible to get GPS fixes without any extra measures to give the GPS more time, but this will not work with a cold start.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/277675?ContentTypeID=1</link><pubDate>Thu, 29 Oct 2020 17:21:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d177c0d4-0455-4b24-96bd-0a012b5c1126</guid><dc:creator>kgarland789</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;Thank you for the detailed response. I think at this point, I want to get the GPS data first, and when I get a good fix on the satellite, send that information to the server over https, and then repeat every 1 second or so. Our application is eventually going to get a bit more complicated but I think for now this is good.&lt;/p&gt;
&lt;p&gt;I will try what you have suggested and hopefully get back to you soon, but I do have a few questions in the meantime:&lt;/p&gt;
&lt;p&gt;Since we cannot use GPS and LTE radios at the same time, would I need to disable the LTE radio while getting GPS data and then re-enable it when I start the HTTPS part of the application? If so, how would I accomplish this (what commands disables the LTE modem) and could I set some sort of flag that toggles the LTE radio so I can have my code repeat in a loop forever?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still familiarizing myself with using LTE and Zephyr, so where in the docs could I find the difference between lte_lc_init and lte_lc_init_and_connect functions?&lt;/p&gt;
&lt;p&gt;I think that is all for now. Thanks again for the detailed response!&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Kyle Garland&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/277579?ContentTypeID=1</link><pubDate>Thu, 29 Oct 2020 11:19:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ff631cf-7db4-4286-8933-be60653ce7ad</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;I think (at least a part of) your problem is that you try to initialize things twice.&lt;/p&gt;
&lt;p&gt;Both the bsdlib and lte_link_control library will by default initialize and connect to the network during startup, before the application is started.&lt;/p&gt;
&lt;p&gt;You can disable this behavior by adding CONFIG_BSD_LIBRARY_SYS_INIT=n and CONFIG_AUTO_INIT_AND_CONNECT=n to your prj.conf.&lt;/p&gt;
&lt;p&gt;Could you try to add those, and see if that helps you?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="kgarland789"]I took a deeper look at the SYSTEMMODE command, and it looks like only one modem mode is allowed at once?[/quote]
&lt;p&gt;&amp;nbsp;You can enable one LTE mode (LTE-M or NB-IoT) and GPS at once. So you can enable both LTE-M and GPS with AT%XSYSTEMMODE=1,0,1,0.&lt;/p&gt;
&lt;p&gt;The flow of operations in your application should probably be something like this (assuming bsdlib and lte_link_control is not initialized automatically).&lt;/p&gt;
&lt;p&gt;1. Initialize bsdlib&lt;/p&gt;
&lt;p&gt;2. Initialize at_cmd&lt;/p&gt;
&lt;p&gt;3. Send any extra AT commands that is not handled by the lte_link_control library (take a look at the &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/lib/lte_link_control/Kconfig"&gt;Kconfig file&lt;/a&gt; to see what options you have)&lt;/p&gt;
&lt;p&gt;4. Initialize lte_link_control&lt;/p&gt;
&lt;p&gt;From here, you must decide if you want to do &amp;#39;LTE stuff&amp;#39; or &amp;#39;GPS stuff&amp;#39; first.&lt;/p&gt;
&lt;p&gt;If you want to start with the GPS, you do the necessary initialization and search for a fix before you connect to the LTE network.&lt;/p&gt;
&lt;p&gt;If you want to do &amp;#39;LTE stuff&amp;#39;, you can replace &amp;#39;lte_lc_init&amp;#39; with &amp;#39;lte_lc_init_and_connect&amp;#39; in step 4 to connect to the network.&lt;/p&gt;
&lt;p&gt;When you are connected to the network, you can open a socket, and do network stuff.&lt;/p&gt;
&lt;p&gt;Also, remember that you cannot use the GPS and LTE radios at the same time. So you will have to ensure that the LTE radio is inactive (either because you have turned off LTE, or because you are using PSM or eDRX) when you are using the GPS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/277471?ContentTypeID=1</link><pubDate>Wed, 28 Oct 2020 17:22:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ec2f574-529e-417d-bca0-7183fb1fb783</guid><dc:creator>kgarland789</dc:creator><description>&lt;p&gt;Hi Didrik,&lt;/p&gt;
&lt;p&gt;Thanks for your quick response. Sorry, I totally forgot to include the printout from the terminal emulator and my errors.&lt;/p&gt;
&lt;p&gt;Alright so at first I was just getting a Failed to Initialize Modem error, form inside the init_app() function, which sends over the commands to start GPS. I added a few printk statements inside the setup_modem() function, and printed out the command that failed to send, and it was the &amp;quot;AT\%XSYSTEMMODE=1,0,1,0&amp;quot; command (note, this worked when I ran the GPS application on its own).&lt;/p&gt;
&lt;p&gt;In my main function, I was setting up the GPS first, attempting to gather data, and then setting up HTTPS, but I switched the order after the modem errors. Now, I am failing to connect to the LTE network, with err -120. The strange thing is I haven&amp;#39;t encountered these errors when I run these applications separately.&lt;/p&gt;
&lt;p&gt;I took a deeper look at the SYSTEMMODE command, and it looks like only one modem mode is allowed at once? I am wondering if I need to switch modes after setting up each application or something like that. Let me know what you think.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Sincerely,&lt;/p&gt;
&lt;p&gt;Kyle Garland&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Modem errors when combining HTTPS and GPS</title><link>https://devzone.nordicsemi.com/thread/277391?ContentTypeID=1</link><pubDate>Wed, 28 Oct 2020 12:48:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9156113b-7c1e-453d-ad62-7b1e0f5c4ca2</guid><dc:creator>Didrik Rokhaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What errors do you get?&lt;/p&gt;
&lt;p&gt;When and where do you get them?&lt;/p&gt;
&lt;p&gt;A detailed description of the actual errors/faulty behavior is usually quite important and helpful in these kinds of cases.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Didrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>