<?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>gps and lte work simultaneously</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73656/gps-and-lte-work-simultaneously</link><description>Hi! 
 I am trying use aws iot sample and over this the gps example to obtain location and transmit a aws iot core, but I have problem with manage of lte and gps functions, 
 I found this functions to control lte modem 
 
 I undertand that line 1 initialize</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Apr 2021 07:17:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73656/gps-and-lte-work-simultaneously" /><item><title>RE: gps and lte work simultaneously</title><link>https://devzone.nordicsemi.com/thread/307368?ContentTypeID=1</link><pubDate>Thu, 29 Apr 2021 07:17:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33f1fab1-5d48-45f5-9b59-b507a4a0b937</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p&gt;Hello Julio,&lt;/p&gt;
&lt;p&gt;Yes, since you have configured your modem with the option &lt;em&gt;CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y&lt;/em&gt;, you can run GPS with the modem configuration of the AWS IoT sample.&lt;/p&gt;
&lt;p&gt;To make your GPS functionality run as smoothly as possible, it is important that you use the GPS stack “long enough”. You can achieve that by putting the LTE stack to idle using PSM/eDRX.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gps and lte work simultaneously</title><link>https://devzone.nordicsemi.com/thread/307113?ContentTypeID=1</link><pubDate>Wed, 28 Apr 2021 00:03:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fe706f5-3e31-4fd2-9088-f5270e629bbb</guid><dc:creator>tracking</dc:creator><description>&lt;p&gt;Hi Markus!&lt;/p&gt;
&lt;p&gt;I prove with this but still without work&lt;/p&gt;
[quote userid="100109" url="~/f/nordic-q-a/73656/gps-and-lte-work-simultaneously/304334#304334"]I recommend you to initialise the modem by adding CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y to your prj.conf[/quote]
&lt;p&gt;Thank you for thread explanation, I undertand better with and added two threads more for gps control (agps sample)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;k_delayed_work_init(&amp;amp;gps_start_work, gps_start_work_fn);
k_delayed_work_init(&amp;amp;reboot_work, reboot_work_fn);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;if I leave the default modem configuration of aws iot sample (&lt;a title="L372" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L372" rel="noopener noreferrer" target="_blank"&gt;L372&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="L327" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L327" rel="noopener noreferrer" target="_blank"&gt;L327&lt;/a&gt;) can I run gps with these configuration without problems?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void work_init(void)
{   //aws_iot threads
	k_delayed_work_init(&amp;amp;shadow_update_work, shadow_update_work_fn);
	k_delayed_work_init(&amp;amp;connect_work, connect_work_fn);
	k_delayed_work_init(&amp;amp;shadow_update_version_work,
			    shadow_update_version_work_fn);
    //gps threads of agps sample
	k_delayed_work_init(&amp;amp;gps_start_work, gps_start_work_fn);
	k_delayed_work_init(&amp;amp;reboot_work, reboot_work_fn);
}

static void gps_start_work_fn(struct k_work *work)
{
	int err;
	struct gps_config gps_cfg = {
		.nav_mode = GPS_NAV_MODE_PERIODIC,
		.power_mode = GPS_POWER_MODE_DISABLED,
		.timeout = 120,
		.interval = 240,
		.priority = true,
	};
	ARG_UNUSED(work);
	err = gps_start(gps_dev, &amp;amp;gps_cfg);
	if (err) {
	    printk(&amp;quot;Failed to start GPS, error: %d&amp;quot;, err);
		return;
	}
        printk(&amp;quot;Periodic GPS search started with interval %d s, timeout %d s&amp;quot;,  
		gps_cfg.interval, gps_cfg.timeout);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gps and lte work simultaneously</title><link>https://devzone.nordicsemi.com/thread/304334?ContentTypeID=1</link><pubDate>Mon, 12 Apr 2021 14:35:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e66c8b6-391d-44a8-9102-83e064abcd0b</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p&gt;Hello Julio,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I’m sorry for the delayed answer. You asked some very good question and I had to dig a little into the code myself being able to give you a proper answer.&lt;/p&gt;
[quote user="tracking"]and return &amp;quot;Failed to initialize modem&amp;quot; with these values in at command[/quote]
&lt;p&gt;I recommend you to initialise the modem by adding CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y to your prj.conf instead of using the AT Commands.&lt;/p&gt;
[quote user="tracking"]&lt;p&gt;2- which one is the recursive function for transmitt to aws?&lt;/p&gt;
&lt;p&gt;where is the control function of transmittion?&lt;/p&gt;[/quote]
&lt;p&gt;The AWS IoT application is using Threads, which you can read more about here:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/workqueue.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/workqueue.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Basically, the two main threads are connect_work_fn and shadow_update_work_fn, where as connect_work_fn is calling the aws_iot_event_handler via which shadow_update_work_fn will be called. Hence, you should use the shadow_update_work_fn thread to transmit to AWS.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope this will help you!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gps and lte work simultaneously</title><link>https://devzone.nordicsemi.com/thread/304102?ContentTypeID=1</link><pubDate>Fri, 09 Apr 2021 21:58:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44dba159-e02f-442e-8614-5e3e95990836</guid><dc:creator>tracking</dc:creator><description>&lt;p&gt;Hi Markus&lt;/p&gt;
&lt;p&gt;I have read the links that you share, but I still with out undertand two things&lt;/p&gt;
&lt;p&gt;1- LTE and GPS manage&lt;/p&gt;
&lt;p&gt;over the aws iot sample all function to control LTE modem are these?:&lt;/p&gt;
&lt;p&gt;i)&amp;nbsp;&lt;a title="1" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L379" rel="noopener noreferrer" target="_blank"&gt;lte_lc_init_and_connect_async()&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;ii)&amp;nbsp;&lt;a title="2" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L250" rel="noopener noreferrer" target="_blank"&gt;lte_lc_psm_req(true)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;iii)&amp;nbsp;&lt;a title="3" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L281" rel="noopener noreferrer" target="_blank"&gt;lte_lc_offline()&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;iv)&amp;nbsp;&lt;a title="4" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L291" rel="noopener noreferrer" target="_blank"&gt;lte_lc_connect()&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;if they are all, I don&amp;#39;t understand the order called each of them, because (i) must be the first I supouse, but in main function is the last of them&lt;/p&gt;
&lt;p&gt;I try to do this:&lt;/p&gt;
&lt;p&gt;after&amp;nbsp;&lt;a title="l508" href="https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/aws_iot/src/main.c#L508" rel="noopener noreferrer" target="_blank"&gt;L508&lt;/a&gt;&amp;nbsp;I put&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int pr = lte_lc_psm_req(true);
if (pr) {
	printk(&amp;quot;Requesting PSM failed, error: %d\n&amp;quot;, pr);
}
printk(&amp;quot;Starting GPS application\n&amp;quot;);//gps sample code
if (init_app() != 0) { 
    return -1;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and return &amp;quot;Failed to initialize modem&amp;quot; with these values in at command&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define AT_XSYSTEMMODE &amp;quot;AT\%XSYSTEMMODE=0,0,1,0&amp;quot;;//gps sample code
#define AT_ACTIVATE_GPS &amp;quot;AT+CFUN=31&amp;quot;;//gps sample code&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2- which one is the recursive function for transmitt to aws?&lt;/p&gt;
&lt;p&gt;where is the control function of transmittion? in main function there is not a loop, I wanna to know where is the transmition control to apply the manage lte and gps&amp;nbsp; the correct place in code&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am very lost in these code, any help I will appreciate a lot&lt;/p&gt;
&lt;p&gt;Julio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: gps and lte work simultaneously</title><link>https://devzone.nordicsemi.com/thread/303512?ContentTypeID=1</link><pubDate>Wed, 07 Apr 2021 12:47:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:049f8e26-0a48-4213-9938-77c5a3067778</guid><dc:creator>Albrecht Markus Schellenberger</dc:creator><description>&lt;p&gt;Hello Julio,&lt;/p&gt;
[quote user=""]I don&amp;#39;t understand the difference between line 3 and line 5 and therfore how to use that functions[/quote]
&lt;p&gt;The function in line 3 will connect the modem to the LTE network, while the function in line 5 will ask the network for eDRX. You can find an overview of the LTE API in the LTE link controller library:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/modem/lte_lc.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/include/modem/lte_lc.html&lt;/a&gt;&lt;/p&gt;
[quote user=""]which are the functions to control gps work?[/quote]
&lt;p&gt;Please have a look at:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/master/include/drivers/gps.h"&gt;https://github.com/nrfconnect/sdk-nrf/blob/master/include/drivers/gps.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There is also an example which could be a good entry point:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/nrf/samples/nrf9160/agps/README.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/nrf/samples/nrf9160/agps/README.html&lt;/a&gt;&lt;/p&gt;
[quote user=""]how to use psm to achieve gps and lte work tougether?[/quote]
&lt;p&gt;LTE has priority over GPS, but GPS will run when possible. But it should run “long enough” to be of any use. To achieve this, you can use PSM to silence LTE and make sure that your are not transmitting anything to the LTE network.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I hope this answers your questions!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;Markus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>