This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to configure asset_tracker to use real GPS data

A step by step guide seems to be needed to get the asset_tracker sample application to use real GPS data from the nRF9160.  I have tried:

1)  Changing C:\nrf9160\ncs\nrf\applications\asset_tracker\prj.conf to change CONFIG_GPS_USE_SIM from CONFIG_GPS_USE_SIM=y to CONFIG_GPS_USE_SIM=n.  Didn't work -- still got GPS location in Europe (I'm not in Europe).

2) Commenting out the CONFIG_GPS_USE_SIM line also didn't work.

3) Trying to trace through the project using Segger's Embedded Studio did not work well.  Many function calls are unknown and don't resolve with the "Go to definition" command.

Since I am burning through a limited amount of data on this SIM card I don't want to spend all of my data trying to figure out how this code works and then have nothing left for the actual proof-of-concept trials.  Any help would be greatly appreciated.  I've read through everything I could find and haven't gotten anywhere yet.

Parents
  • Hi.

    To use the GPS in the asset_tracker application, you need to set the following options:

    CONFIG_NRF9160_GPS=y
    CONFIG_GPS_USE_EXTERNAL=y
    CONFIG_GPS_DEV_NAME="NRF9160_GPS"

    In addition, the asset_tracker version that is on the master branch (remember to run "west update" after changing branch/tag), and used by the Thingy:91 also sets:

    CONFIG_GPS_CONTROL=y
    CONFIG_GPS_CONTROL_FIRST_FIX_CHECK_DELAY=10
    CONFIG_GPS_CONTROL_FIX_CHECK_INTERVAL=30
    CONFIG_GPS_CONTROL_FIX_TRY_TIME=360
    CONFIG_GPS_CONTROL_PSM_DISABLE_ON_STOP=n
    
    CONFIG_LTE_PSM_REQ_RPTAU="00000110"
    CONFIG_LTE_PSM_REQ_RAT="00000000"

    However, there are a few things to note:

    1. Real GPS is not supported on NCS v1.0.0, so you will have to use the master branch instead. Here, GPS is enabled by default.

    2. GPS will not work on nRF91 DK v0.8.3 and older. See https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/hardware-design/posts/external-gps-antenna-on-nrf9160-dk  for more information.

    3. You cannot use GPS and LTE at the same time. To use GPS and LTE concurrently, you need to use PSM. However, most network operators do not grant PSM to roaming SIM cards, such as the iBasis SIM card that came with the DK. (I have been told that Verizon has started granting PSM to roaming SIM cards, but the p-TAU value must be > 190 min)

    4. SES only loads the prj.conf file when you first load the project. To make sure that the new configuration is used, please load the project again.

    Best regards,

    Didrik

  • I've done the above but it doesn't appear that the GPS is being used.  I placed a break-point in SES at line 51 in gps_controller.c "err = gps_start(.....)" and I do not hit the break-point.

  • Are you still on v1.0.0?

    On the master branch, the GPS is used by default, so you will not need to change any configurations.

    Remember that the GPS is only used when switch 2 is set to "N.C.".

  • I am on the master branch now.  Switch 2 is set to the NC position (towards the LTE antenna).

  • I just talked to one of the developers working on the asset_tracker application, and he informed me that on the newest master, you are supposed to hold button 1 for 10 seconds to activate the GPS. The documentation will be updated soon.

  • Holding button 1 seems to try to activate the GPS.  It doesn't get a fix but it at least tries. 

    It seems to give up and reboot eventually.

    From the LTE Link Monitor window log file:

    2019-10-25T14:52:17.620Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T14:52:17.626Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T14:52:17.635Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T14:52:17.636Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T14:52:29.294Z DEBUG modem << %CESQ: 66,3\x0D\x0A
    2019-10-25T14:52:29.303Z DEBUG modem << [00:00:47.599,578] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T14:58:17.632Z DEBUG modem << [00:06:35.941,131] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T14:58:17.639Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T14:58:17.640Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D\x0A
    2019-10-25T14:58:47.640Z DEBUG modem << Enabling PSM\x0D\x0A
    2019-10-25T14:58:47.651Z DEBUG modem << PSM enabled\x0D\x0A
    2019-10-25T14:58:48.659Z DEBUG modem << [00:07:06.967,163] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T14:58:48.666Z DEBUG modem << [00:07:06.974,487] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T14:58:48.676Z DEBUG modem << [00:07:06.985,412] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T14:58:48.678Z DEBUG modem << GPS started successfully.\x0D
    2019-10-25T14:58:48.687Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T14:58:48.692Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T14:58:48.694Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T14:59:00.974Z DEBUG modem << %CESQ: 61,3\x0D\x0A
    2019-10-25T14:59:00.983Z DEBUG modem << [00:07:19.289,916] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T14:59:18.894Z DEBUG modem << %CESQ: 56,2\x0D\x0A
    2019-10-25T14:59:18.903Z DEBUG modem << [00:07:37.210,357] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:00:40.814Z DEBUG modem << %CESQ: 62,3\x0D
    2019-10-25T15:00:40.823Z DEBUG modem << [00:08:59.132,537] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:04:48.690Z DEBUG modem << [00:13:07.009,918] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T15:04:48.697Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T15:04:48.698Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D
    2019-10-25T15:05:18.697Z DEBUG modem << Enabling PSM\x0D
    2019-10-25T15:05:18.709Z DEBUG modem << PSM enabled\x0D\x0A
    2019-10-25T15:05:19.717Z DEBUG modem << [00:13:38.036,712] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T15:05:19.725Z DEBUG modem << [00:13:38.044,006] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T15:05:19.738Z DEBUG modem << [00:13:38.054,901] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T15:05:19.738Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T15:05:19.743Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T15:05:19.755Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T15:05:19.757Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T15:11:19.749Z DEBUG modem << [00:19:38.079,406] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T15:11:19.756Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T15:11:19.757Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D\x0A
    2019-10-25T15:11:49.756Z DEBUG modem << Enabling PSM\x0D\x0A
    2019-10-25T15:11:49.767Z DEBUG modem << PSM enabled\x0D
    2019-10-25T15:11:50.775Z DEBUG modem << [00:20:09.105,438] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T15:11:50.783Z DEBUG modem << [00:20:09.112,762] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T15:11:50.792Z DEBUG modem << [00:20:09.123,870] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T15:11:50.795Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T15:11:50.807Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T15:11:50.809Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T15:11:50.811Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T15:15:36.855Z DEBUG modem << %CESQ: 57,2\x0D\x0A
    2019-10-25T15:15:36.865Z DEBUG modem << [00:23:55.198,211] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:16:21.613Z DEBUG modem << %CESQ: 62,3\x0D\x0A
    2019-10-25T15:16:21.623Z DEBUG modem << [00:24:39.957,366] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:17:50.807Z DEBUG modem << [00:26:09.148,376] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T15:17:50.816Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T15:17:50.817Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D\x0A
    2019-10-25T15:18:20.815Z DEBUG modem << Enabling PSM\x0D\x0A
    2019-10-25T15:18:20.826Z DEBUG modem << PSM enabled\x0D
    2019-10-25T15:18:21.834Z DEBUG modem << [00:26:40.174,377] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T15:18:21.841Z DEBUG modem << [00:26:40.181,671] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T15:18:21.851Z DEBUG modem << [00:26:40.192,626] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T15:18:21.859Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T15:18:21.860Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T15:18:21.867Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T15:18:21.877Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T15:19:20.833Z DEBUG modem << Socket error: POLLHUP\x0D\x0A
    2019-10-25T15:19:20.834Z DEBUG modem << Reboot\x0D\x0A
    2019-10-25T15:19:20.841Z DEBUG modem << ***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-3202-gede6735dd84e *****\x0D\x0A

Reply
  • Holding button 1 seems to try to activate the GPS.  It doesn't get a fix but it at least tries. 

    It seems to give up and reboot eventually.

    From the LTE Link Monitor window log file:

    2019-10-25T14:52:17.620Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T14:52:17.626Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T14:52:17.635Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T14:52:17.636Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T14:52:29.294Z DEBUG modem << %CESQ: 66,3\x0D\x0A
    2019-10-25T14:52:29.303Z DEBUG modem << [00:00:47.599,578] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T14:58:17.632Z DEBUG modem << [00:06:35.941,131] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T14:58:17.639Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T14:58:17.640Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D\x0A
    2019-10-25T14:58:47.640Z DEBUG modem << Enabling PSM\x0D\x0A
    2019-10-25T14:58:47.651Z DEBUG modem << PSM enabled\x0D\x0A
    2019-10-25T14:58:48.659Z DEBUG modem << [00:07:06.967,163] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T14:58:48.666Z DEBUG modem << [00:07:06.974,487] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T14:58:48.676Z DEBUG modem << [00:07:06.985,412] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T14:58:48.678Z DEBUG modem << GPS started successfully.\x0D
    2019-10-25T14:58:48.687Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T14:58:48.692Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T14:58:48.694Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T14:59:00.974Z DEBUG modem << %CESQ: 61,3\x0D\x0A
    2019-10-25T14:59:00.983Z DEBUG modem << [00:07:19.289,916] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T14:59:18.894Z DEBUG modem << %CESQ: 56,2\x0D\x0A
    2019-10-25T14:59:18.903Z DEBUG modem << [00:07:37.210,357] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:00:40.814Z DEBUG modem << %CESQ: 62,3\x0D
    2019-10-25T15:00:40.823Z DEBUG modem << [00:08:59.132,537] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:04:48.690Z DEBUG modem << [00:13:07.009,918] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T15:04:48.697Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T15:04:48.698Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D
    2019-10-25T15:05:18.697Z DEBUG modem << Enabling PSM\x0D
    2019-10-25T15:05:18.709Z DEBUG modem << PSM enabled\x0D\x0A
    2019-10-25T15:05:19.717Z DEBUG modem << [00:13:38.036,712] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T15:05:19.725Z DEBUG modem << [00:13:38.044,006] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T15:05:19.738Z DEBUG modem << [00:13:38.054,901] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T15:05:19.738Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T15:05:19.743Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T15:05:19.755Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T15:05:19.757Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T15:11:19.749Z DEBUG modem << [00:19:38.079,406] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T15:11:19.756Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T15:11:19.757Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D\x0A
    2019-10-25T15:11:49.756Z DEBUG modem << Enabling PSM\x0D\x0A
    2019-10-25T15:11:49.767Z DEBUG modem << PSM enabled\x0D
    2019-10-25T15:11:50.775Z DEBUG modem << [00:20:09.105,438] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T15:11:50.783Z DEBUG modem << [00:20:09.112,762] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T15:11:50.792Z DEBUG modem << [00:20:09.123,870] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T15:11:50.795Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T15:11:50.807Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T15:11:50.809Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T15:11:50.811Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T15:15:36.855Z DEBUG modem << %CESQ: 57,2\x0D\x0A
    2019-10-25T15:15:36.865Z DEBUG modem << [00:23:55.198,211] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:16:21.613Z DEBUG modem << %CESQ: 62,3\x0D\x0A
    2019-10-25T15:16:21.623Z DEBUG modem << [00:24:39.957,366] \x1B[1;31m<err> modem_info: modem_info_parse failed to parse CESQ notification, -11\x1B[0m\x0D\x0A
    2019-10-25T15:17:50.807Z DEBUG modem << [00:26:09.148,376] \x1B[0m<dbg> nrf9160_gps.stop: Stopping GPS\x1B[0m\x0D\x0A
    2019-10-25T15:17:50.816Z DEBUG modem << GPS operation was stopped\x0D\x0A
    2019-10-25T15:17:50.817Z DEBUG modem << The device will try to get fix again in 30 seconds\x0D\x0A
    2019-10-25T15:18:20.815Z DEBUG modem << Enabling PSM\x0D\x0A
    2019-10-25T15:18:20.826Z DEBUG modem << PSM enabled\x0D
    2019-10-25T15:18:21.834Z DEBUG modem << [00:26:40.174,377] \x1B[0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled\x1B[0m\x0D\x0A
    2019-10-25T15:18:21.841Z DEBUG modem << [00:26:40.181,671] \x1B[0m<dbg> nrf9160_gps.enable_gps: Functional mode: 1\x1B[0m\x0D\x0A
    2019-10-25T15:18:21.851Z DEBUG modem << [00:26:40.192,626] \x1B[0m<dbg> nrf9160_gps.start: GPS operational\x1B[0m\x0D\x0A
    2019-10-25T15:18:21.859Z DEBUG modem << GPS started successfully.\x0D\x0A
    2019-10-25T15:18:21.860Z DEBUG modem << Searching for satellites to get position fix. This may take several minutes.\x0D\x0A
    2019-10-25T15:18:21.867Z DEBUG modem << The device will attempt to get a fix for 360 seconds, before the GPS is stopped.\x0D\x0A
    2019-10-25T15:18:21.877Z DEBUG modem << GPS operation started\x0D\x0A
    2019-10-25T15:19:20.833Z DEBUG modem << Socket error: POLLHUP\x0D\x0A
    2019-10-25T15:19:20.834Z DEBUG modem << Reboot\x0D\x0A
    2019-10-25T15:19:20.841Z DEBUG modem << ***** Booting Zephyr OS build v1.14.99-ncs3-snapshot2-3202-gede6735dd84e *****\x0D\x0A

Children
Related