# Can't get GPS location updates

**URL:** <https://forum.legato.io/t/cant-get-gps-location-updates/105>\
**Category:** Legato Application Framework\
**Created:** [February 27, 2015, 10:25am UTC](https://forum.legato.io/t/cant-get-gps-location-updates/105 "2015-02-27T10:25:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![s1nndev](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@s1nndev](https://forum.legato.io/u/s1nndev)\
**Post date:** [February 27, 2015, 10:25am UTC](https://forum.legato.io/t/cant-get-gps-location-updates/105/1 "2015-02-27T10:25:16Z")

</div>

Hello everyone,

I’m using the AirPrime AR7 and I’m trying to get location updates over the legato API, but it doesn’t work.  
My app searches for the GPS signal in a do-while-loop, but le\_pos\_Get2DLocation() returns LE\_OUT\_OF\_RANGE.  
When I start TeraTerm on the NMEA port, it shows that there are 13 satellites in view.

Is there a way to change the configuration of the GPS receiver? Or is there any other way to solve that problem?

Regards,  
Daniel

---

<div class="post-metadata">

**Author:** ![JayM2M](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JayM2M](https://forum.legato.io/u/JayM2M)\
**Post date:** [March 2, 2015, 4:35pm UTC](https://forum.legato.io/t/cant-get-gps-location-updates/105/2 "2015-03-02T16:35:49Z")

</div>

Hi,

Did you call le\_posCtrl\_Request() once (e.g. in COMPONENT\_INIT) prior to use le\_pos\_Get2DLocation()?

Below a simple code running fine on my side (Legato 15.01):

[code]#include “legato.h”  
#include “interfaces.h”

le\_timer\_Ref\_t posQueryTimerRef;  
le\_clk\_Time\_t posQueryTimerInterval={1, 0};

void posQueryTimerHandler(le\_timer\_Ref\_t timerRef)  
{  
le\_result\_t res;  
int32\_t latitude = 0;  
int32\_t longitude = 0;  
int32\_t hAccuracy = 0;

```
res = le_pos_Get2DLocation(&latitude, &longitude, &hAccuracy);

if (res == LE_OK)
{
    LE_INFO("Location: latitude=%d, longitude=%d, hAccuracy=%d", latitude, longitude, hAccuracy);
}
else if (res == LE_FAULT)
{
    LE_INFO("Failed to get the 2D location's data");
}
else if (res == LE_OUT_OF_RANGE)
{
    LE_INFO("One of the retrieved parameter is invalid (set to INT32_MAX)");
}
else
{
    LE_INFO("unknown location error (%d)", res);
}

```

}

COMPONENT\_INIT  
{  
LE\_INFO(“start posDemo app”);

```
le_posCtrl_Request();
posQueryTimerRef = le_timer_Create("POSQUERYTIMER");
le_timer_SetHandler(posQueryTimerRef, posQueryTimerHandler);
le_timer_SetInterval(posQueryTimerRef, posQueryTimerInterval);
le_timer_SetRepeat(posQueryTimerRef, 0);
le_timer_Start(posQueryTimerRef);

LE_INFO("posDemo app is started.");

```

}[/code]

Regards,  
Jay

---

<div class="post-metadata">

**Author:** ![s1nndev](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@s1nndev](https://forum.legato.io/u/s1nndev)\
**Post date:** [March 3, 2015, 7:41am UTC](https://forum.legato.io/t/cant-get-gps-location-updates/105/3 "2015-03-03T07:41:08Z")

</div>

Hello Jay,

thanks for the reply!  
Yes, I use le\_posCtrl\_Request() to activate the GPS service. Still not working.

Regards,  
Daniel

---

<div class="post-metadata">

**Author:** ![JayM2M](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JayM2M](https://forum.legato.io/u/JayM2M)\
**Post date:** [March 3, 2015, 10:12am UTC](https://forum.legato.io/t/cant-get-gps-location-updates/105/4 "2015-03-03T10:12:43Z")

</div>

Hi,

Can you check if there is any errors related to GNSS in the log:

```auto
logread | grep "PA GNSS"
```

Regards,

Jay
