Hi All,
I’m currently attempting to get the Nordic’s nRF Cloud MQTT multi-service working on the nRF9160 Feather and could use some assistance. I’ve successfully connected to the nrfcloud but am having trouble retrieving GPS info from the GNSS; it keeps falling back to cellular.

Here’s the changes I made to the project in attempt to get working on the nRF9160 Feather:

  • Added circuitdojo_feather_nrf9160_ns.conf and circuitdojo_feather_nrf9160_ns.overlay from nfed/samples/tracker/boards to boards/
  • Added circuitdojo,psctl.yaml from nfed/samples/tracker/dts/bindings/circuitdojo,psctl.yaml to dts/bindings/

Next, I executed a build with the following command:

west build --build-dir c:\Git\nrfcloud_gps\build c:\Git\nrfcloud_gps --pristine --board circuitdojo_feather_nrf9160_ns -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="c:/Git/nrfcloud_gps"

console log looks like:

*** Booting Zephyr OS build v3.2.99-ncs2 ***
[00:00:00.491,546] <inf> connection: Setting up modem...
[00:00:00.491,546] <inf> connection: Setting up nRF Cloud library...
[00:00:00.492,034] <inf> main: nRF Cloud MQTT multi-service sample has started.
[00:00:00.501,251] <inf> connection: Setting up LTE...
[00:00:00.507,812] <inf> connection: Starting connection to LTE network...
[00:00:00.566,192] <inf> connection: Connecting to LTE network. This may take several minutes...
[00:00:00.566,223] <inf> connection: Waiting for connection to LTE network...
[00:00:08.310,394] <inf> connection: Connected to LTE network
[00:00:08.310,485] <inf> connection: Connecting to nRF Cloud...
[00:00:08.310,516] <inf> connection: Next connection retry in 30 seconds
[00:00:15.012,268] <inf> nrf_cloud_fsm: CC RX on topic <MY_IMEI>/shadow/get/accepted: {"desired":{"pairing":{"state":"paired","topics":{"d2c":"prod/37fe35f5-ae70-4198-9386-2574c886f523/m/d/<MY_IMEI>/d2c","c2d":"prod/37fe35f5-ae70-4198-9386-2574c886f523/m/d/<MY_IMEI>/+/r"}},"nrfcloud_mqtt_topic_prefix":"prod/37fe35f5-ae70-4198-9386-2574c886f523/"}}
[00:00:17.116,790] <inf> connection: Connected to nRF Cloud
[00:00:17.120,117] <inf> application: Waiting for modem to determine current date and time
[00:00:17.120,147] <inf> application: Current date and time determined
[00:00:17.120,300] <inf> nrf_cloud_pgps: Storage base:0xE8000, size:98304
[00:00:17.120,574] <inf> nrf_cloud_pgps: Checking P-GPS header: Schema version:0, type:0, num:0, count:0
[00:00:17.120,574] <inf> nrf_cloud_pgps:   size:0, period (minutes):0, GPS day:0, GPS time:0
[00:00:17.120,605] <wrn> nrf_cloud_pgps: One or more fields are wrong
[00:00:17.120,666] <inf> nrf_cloud_pgps: Requesting 42 predictions...
[00:00:17.161,468] <inf> nrf_cloud_pgps: Searching for prediction
[00:00:17.161,468] <wrn> nrf_cloud_pgps: Predictions not loaded yet
[00:00:18.947,479] <inf> nrf_cloud_pgps: Searching for prediction
[00:00:18.947,509] <wrn> nrf_cloud_pgps: Predictions not loaded yet
[00:00:21.380,920] <inf> download_client: Setting up TLS credentials, tag 16842753
[00:00:21.381,042] <inf> download_client: Connecting to pgps.nrfcloud.com
...
[00:01:28.321,838] <inf> download_client: Downloaded 84268/84268 bytes (100%)
[00:01:28.321,929] <inf> nrf_cloud_pgps: Storing prediction num:41 idx:41 for gps sec:1369519200
[00:01:28.456,268] <inf> nrf_cloud_pgps: All P-GPS data received. Done.
[00:01:28.456,298] <inf> nrf_cloud_pgps: Searching for prediction
[00:01:28.456,420] <inf> nrf_cloud_pgps: GPS unit needs ephemerides. Injecting 32.
[00:01:28.456,604] <inf> download_client: Download complete
[00:01:28.456,604] <inf> nrf_cloud_pgps: Download client done
[00:02:40.038,970] <inf> location: Method specific timeout expired
[00:02:40.039,001] <wrn> location: GNSS timed out possibly due to too short GNSS time windows
[00:02:40.039,428] <inf> location: Location retrieval failed using 'GNSS', trying with 'Cellular' next
[00:02:42.253,051] <inf> application: Location Updated: -27.443751 N 153.169477 W, accuracy: 427.0 m, Method: Cellular

    Yendor looks like maybe your GPS acquisition timed out. Depending on where you are (i.e. indoor or outdoor), weather, etc it may take some time to get a fix. Also you need an active antenna for this to work. The most important thing is making sure that this is set somewhere in your config if you’re using NCS >= 2.3

    # GPS Antenna configuration
    CONFIG_MODEM_ANTENNA=y
    CONFIG_MODEM_ANTENNA_AT_COEX0="AT\%XCOEX0=1,1,1565,1586"

    Yes, we’re currently using NCS version 2.30. I belive that I’ve set things up correctly.

    Here’s the configuration in boards/circuitdojo_feather_nrf9160_ns.conf:

    #
    # Copyright (c) 2021 Circuit Dojo, Inc.
    #
    # SPDX-License-Identifier: LicenseRef-Circuit-Dojo-5-Clause
    
    # SPI Flash
    CONFIG_SPI=y
    CONFIG_SPI_NOR=y
    CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
    
    # GPS Antenna configuration
    CONFIG_MODEM_ANTENNA=y
    CONFIG_MODEM_ANTENNA_AT_COEX0="AT/%XCOEX0=1,1,1565,1586"
    
    # Adding I2C
    CONFIG_I2C=y
    
    # Add the accelerometer
    CONFIG_SENSOR=y
    CONFIG_LIS2DH=y
    CONFIG_LIS2DH_TRIGGER_GLOBAL_THREAD=y
    CONFIG_LIS2DH_OPER_MODE_LOW_POWER=y
    
    # Add the ADC
    CONFIG_ADC=y

    This configuration is also present in build/zephyr/.config:

    ...
    CONFIG_MODEM_ANTENNA=y
    CONFIG_MODEM_ANTENNA_GNSS_ONBOARD=y
    # CONFIG_MODEM_ANTENNA_GNSS_EXTERNAL is not set
    CONFIG_MODEM_ANTENNA_AT_MAGPIO=""
    CONFIG_MODEM_ANTENNA_AT_COEX0="AT%XCOEX0=1,1,1565,1586"
    # CONFIG_MODEM_ANTENNA_LOG_LEVEL_OFF is not set
    # CONFIG_MODEM_ANTENNA_LOG_LEVEL_ERR is not set
    # CONFIG_MODEM_ANTENNA_LOG_LEVEL_WRN is not set
    CONFIG_MODEM_ANTENNA_LOG_LEVEL_INF=y
    # CONFIG_MODEM_ANTENNA_LOG_LEVEL_DBG is not set
    CONFIG_MODEM_ANTENNA_LOG_LEVEL=3
    ...

    We’re using an antenna that we received from you, and the unit is currently positioned outdoors under clear skies.

    To verify that the setup is functioning correctly, I loaded the nfed/samples/gps project and received a response from the GNSS.

    Tracking: 11 Using:  8 Unhealthy: 1
    -----------------------------------
    Latitude:       -27.444587
    Longitude:      153.165365
    Altitude:       71.5 m
    Accuracy:       5.2 m
    Speed:          0.2 m/s
    Speed accuracy: 1.5 m/s
    Heading:        0.0 deg
    Date:           2023-05-24
    Time (UTC):     19:59:13.937
    PDOP:           2.4
    HDOP:           1.5
    VDOP:           1.9
    TDOP:           1.5
    NMEA strings:
    
    $GPGGA,195913.94,2726.67521,S,15309.92190,E,1,08,1.46,71.51,M,,M,,*56
    $GPGLL,2726.67521,S,15309.92190,E,195913.94,A,A*74
    $GPGSA,A,3,10,18,23,24,28,32,,,,,,,2.40,1.46,1.90,1*16
    $GPGSV,3,1,10,2,32,218,,10,53,179,28,18,38,065,27,21,00,225,,1*5F
    $GPGSV,3,2,10,22,,,24,23,35,132,19,24,17,122,18,27,46,270,06,1*51
    $GPGSV,3,3,10,28,14,009,15,32,71,320,25,1*66
    $GPRMC,195913.94,A,2726.67521,S,15309.92190,E,0.31,0.00,240523,,,A,V*39

    I plan to configure and run the v2.3.0/nrf/samples/nrf9160/gnss to see if I can get that to work as well.

    In the mean time would it be posiable for you to quickly see if you can get the v2.3.0/nrf/samples/nrf9160/nrf_cloud_mqtt_multi_service on a spare board if you have the opportunity? I appreciate your assistance as I seem to be missing something here.

    I was able to make quicker progress than anticipated with the v2.3.0/nrf/samples/nrf9160/gnss sample. I successfully built it and got it working

    Tracking:  8 Using:  6 Unhealthy: 1
    -----------------------------------
    Latitude:       -27.444540
    Longitude:      153.165428
    Altitude:       74.1 m
    Accuracy:       8.3 m
    Speed:          0.8 m/s
    Speed accuracy: 1.6 m/s
    Heading:        75.9 deg
    Date:           2023-05-24
    Time (UTC):     20:57:20.670
    PDOP:           4.7
    HDOP:           2.3
    VDOP:           4.1
    TDOP:           3.2
    
    NMEA strings:
    
    $GPGGA,205720.67,2726.67242,S,15309.92567,E,1,06,2.28,74.09,M,,M,,*5D
    $GPGLL,2726.67242,S,15309.92567,E,205720.67,A,A*72
    $GPGSA,A,3,10,18,23,28,32,,,,,,,,4.68,2.28,4.09,1*12
    $GPGSV,3,1,12,1,01,220,,2,59,221,,10,46,139,25,18,17,044,23,1*6B
    $GPGSV,3,2,12,21,21,220,,22,,,20,23,22,106,15,24,04,140,,1*51
    $GPGSV,3,3,12,27,34,305,,28,37,022,25,31,15,358,,32,75,187,24,1*69
    $GPRMC,205720.67,A,2726.67242,S,15309.92567,E,1.58,75.95,240523,,,A,V*0F

    To get the build to recognize the feather configuration, I had to add both boards/circuitdojo_feather_nrf9160_ns.overlay and boards/circuitdojo_feather_nrf9160_ns.conf. Just the configuration by itself was not working.

    In addition, I included the src/startup.c file from nfed/samples/gps/src/startup.c and adjusted the CMakeLists.txt to look like this:

    #
    # Copyright (c) 2019 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    cmake_minimum_required(VERSION 3.20.0)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(gnss_sample)
    
    zephyr_library_sources(src/main.c)
    
    zephyr_library_sources_ifdef(CONFIG_GNSS_SAMPLE_ASSISTANCE_NRF_CLOUD src/assistance.c)
    zephyr_library_sources_ifdef(CONFIG_GNSS_SAMPLE_ASSISTANCE_SUPL src/assistance_supl.c)
    zephyr_library_sources_ifdef(CONFIG_GNSS_SAMPLE_ASSISTANCE_MINIMAL src/assistance_minimal.c)
    zephyr_library_sources_ifdef(CONFIG_GNSS_SAMPLE_ASSISTANCE_MINIMAL src/mcc_location_table.c)
    
    zephyr_library_sources(src/startup.c)

    My next step will be to incorporate the nfed/samples/gps/src/startup.c into the nRF9160: nRF Cloud MQTT multi-service project and see what happens. I’m at a loss as what to try next if this doesn’t work.

    I’m still encountering the timeout event, despite setting the CONFIG_SENSOR_SAMPLE_INTERVAL_SECONDS to 300 seconds and the CONFIG_GNSS_FIX_TIMEOUT_SECONDS to 280 seconds.

    output log:

    *** Booting Zephyr OS build v3.2.99-ncs2 ***
    [00:00:00.491,455] <inf> battery: Setup AIN7 got 0
    [00:00:00.491,485] <inf> battery: Battery setup: 0 1
    [00:00:00.491,577] <dbg> led_control: start_led_pattern: LED Pattern Requested
    [00:00:00.491,607] <inf> connection: Setting up modem...
    [00:00:00.491,607] <inf> connection: Setting up nRF Cloud library...
    [00:00:00.492,950] <inf> main: nRF Cloud MQTT multi-service sample has started.
    [00:00:00.492,980] <dbg> connection: await_lte_connection: Awaiting LTE Connection
    [00:00:00.493,011] <dbg> led_control: led_animation_thread_fn: LED Management Started
    [00:00:00.493,041] <dbg> led_control: led_animation_thread_fn: LED Pattern Started
    [00:00:00.493,103] <dbg> connection: consume_device_message: Consuming an enqueued device message
    [00:00:00.502,105] <inf> connection: Setting up LTE...
    [00:00:00.508,697] <inf> connection: Starting connection to LTE network...
    [00:00:00.567,016] <inf> connection: Connecting to LTE network. This may take several minutes...
    [00:00:00.567,016] <inf> connection: Waiting for connection to LTE network...
    [00:00:00.567,047] <dbg> led_control: start_led_pattern: LED Pattern Requested
    [00:00:00.567,077] <dbg> connection: await_lte_connection: Awaiting LTE Connection
    [00:00:04.314,605] <dbg> connection: lte_event_handler: LTE_EVENT: Network registration status 2, Searching
    [00:00:04.314,636] <dbg> connection: lte_event_handler: LTE_EVENT: LTE cell changed: Cell ID: 147180546, Tracking area: 28709
    [00:00:04.314,697] <dbg> connection: lte_event_handler: LTE_EVENT: Active LTE mode changed: LTE-M
    [00:00:04.554,962] <dbg> connection: lte_event_handler: LTE_EVENT: RRC mode: Connected
    [00:00:12.093,200] <dbg> connection: lte_event_handler: LTE_EVENT: Modem domain event, type: Search done
    [00:00:12.098,510] <dbg> connection: lte_event_handler: LTE_EVENT: Network registration status 5, Registered Roaming
    [00:00:12.098,663] <inf> connection: Connected to LTE network
    [00:00:12.098,754] <inf> connection: Connecting to nRF Cloud...
    [00:00:12.098,785] <inf> connection: Next connection retry in 30 seconds
    [00:00:12.098,815] <dbg> connection: await_cloud_connected: Awaiting Cloud Connection
    [00:00:12.098,876] <dbg> connection: await_cloud_ready: Awaiting Cloud Ready
    [00:00:12.098,907] <dbg> connection: cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_CONNECTING
    [00:00:12.100,006] <dbg> connection: lte_event_handler: LTE_EVENT: PSM parameter update: TAU: 3960, Active time: -1
    [00:00:12.123,352] <dbg> connection: await_cloud_ready: Awaiting Cloud Ready
    [00:00:16.823,028] <dbg> connection: cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_CONNECTED
    [00:00:18.160,797] <inf> nrf_cloud_fsm: CC RX on topic <MY_IMEI>/shadow/get/accepted: {"desired":{"pairing":{"state":"paired","topics":{"d2c":"prod/37fe35f5-ae70-4198-9386-2574c886f523/m/d/<MY_IMEI>/d2c","c2d":"prod/37fe35f5-ae70-4198-9386-2574c886f523/m/d/<MY_IMEI>/+/r"}},"nrfcloud_mqtt_topic_prefix":"prod/37fe35f5-ae70-4198-9386-2574c886f523/"}}
    [00:00:18.162,994] <dbg> connection: cloud_event_handler: NRF_CLOUD_EVT_RX_DATA_SHADOW
    [00:00:18.204,986] <dbg> connection: cloud_event_handler: NRF_CLOUD_EVT_USER_ASSOCIATED
    [00:00:20.016,601] <dbg> connection: cloud_event_handler: NRF_CLOUD_EVT_READY
    [00:00:20.016,662] <inf> connection: Connected to nRF Cloud
    [00:00:20.020,141] <inf> application: Waiting for modem to determine current date and time
    [00:00:20.020,141] <inf> application: Current date and time determined
    [00:00:20.021,301] <dbg> location_tracking: start_location_tracking: Selected the GNSS location tracking method.
    [00:00:20.021,331] <dbg> location_tracking: start_location_tracking: Selected the Cellular location tracking method.
    [00:00:20.021,484] <inf> nrf_cloud_pgps: Storage base:0xE8000, size:98304
    [00:00:20.022,460] <inf> nrf_cloud_pgps: Checking P-GPS header: Schema version:1, type:10, num:1, count:42
    [00:00:20.022,460] <inf> nrf_cloud_pgps:   size:2006, period (minutes):240, GPS day:15844, GPS time:79200
    [00:00:20.022,491] <inf> nrf_cloud_pgps: Checking stored P-GPS data; count:42, period_min:240
    [00:00:20.023,010] <inf> nrf_cloud_pgps: Checking if P-GPS data is expired...
    [00:00:20.023,071] <inf> nrf_cloud_pgps: Found valid prediction, day:15844, time:79200
    [00:00:20.023,101] <inf> nrf_cloud_pgps: P-GPS data is up to date.
    [00:00:20.023,193] <inf> nrf_cloud_pgps: GPS unit needs time assistance. Injecting day:15844, time:77633
    [00:00:20.024,200] <inf> nrf_cloud_pgps: GPS unit needs ephemerides. Injecting 32.
    [00:00:20.123,840] <inf> application: Temperature is 22 degrees C
    [00:00:20.125,061] <dbg> connection: send_device_message: Enqueued message: {"appId":"TEMP","messageType":"DATA","ts":1684964016000,"data":22.850000000000001}
    [00:00:20.125,213] <dbg> connection: consume_device_message: Waiting for valid connection before transmitting device message
    [00:00:20.125,213] <dbg> connection: await_lte_connection: Awaiting LTE Connection
    [00:00:20.125,244] <dbg> connection: await_cloud_ready: Awaiting Cloud Ready
    [00:00:20.125,244] <dbg> connection: consume_device_message: Attempting to transmit enqueued device message
    [00:00:20.126,556] <dbg> connection: consume_device_message: Enqueued device message consumed successfully
    [00:00:20.126,586] <dbg> led_control: start_led_pattern: LED Pattern Requested
    [00:00:20.126,617] <dbg> connection: consume_device_message: Consuming an enqueued device message
    [00:00:20.129,913] <inf> battery: raw 9514 ~ 2090 mV => 4180 mV
    [00:00:23.208,190] <dbg> led_control: start_led_pattern: LED Pattern Requested
    [00:00:23.208,221] <dbg> led_control: led_animation_thread_fn: LED Pattern Ended
    [00:00:23.208,221] <dbg> led_control: led_animation_thread_fn: LED Pattern Started
    [00:00:33.423,950] <dbg> connection: lte_event_handler: LTE_EVENT: RRC mode: Idle
    [00:05:00.143,249] <inf> location: Method specific timeout expired
    [00:05:00.143,280] <wrn> location: GNSS timed out possibly due to too short GNSS time windows
    [00:05:00.143,920] <inf> location: Location retrieval failed using 'GNSS', trying with 'Cellular' next
    [00:05:00.574,127] <dbg> connection: lte_event_handler: LTE_EVENT: RRC mode: Connected
    [00:05:02.329,711] <dbg> location_tracking: location_event_handler: Location Event: Got location
    [00:05:02.329,772] <inf> application: Location Updated: -27.446128 N 153.169036 W, accuracy: 939.0 m, Method: Cellular
    [00:05:14.880,401] <dbg> connection: lte_event_handler: LTE_EVENT: RRC mode: Idle
    [00:05:20.123,870] <inf> application: Temperature is 23 degrees C
    [00:05:20.125,061] <dbg> connection: send_device_message: Enqueued message: {"appId":"TEMP","messageType":"DATA","ts":1684964316000,"data":23.725000000000001}
    [00:05:20.125,183] <dbg> connection: consume_device_message: Waiting for valid connection before transmitting device message
    [00:05:20.125,213] <dbg> connection: await_lte_connection: Awaiting LTE Connection
    [00:05:20.125,213] <dbg> connection: await_cloud_ready: Awaiting Cloud Ready
    [00:05:20.125,244] <dbg> connection: consume_device_message: Attempting to transmit enqueued device message
    [00:05:20.125,885] <inf> battery: raw 9524 ~ 2092 mV => 4184 mV
    [00:05:20.134,857] <dbg> connection: consume_device_message: Enqueued device message consumed successfully
    [00:05:20.134,857] <dbg> led_control: start_led_pattern: LED Pattern Requested
    [00:05:20.134,887] <dbg> connection: consume_device_message: Consuming an enqueued device message
    [00:05:20.669,464] <dbg> connection: lte_event_handler: LTE_EVENT: RRC mode: Connected
    [00:05:23.209,411] <dbg> led_control: start_led_pattern: LED Pattern Requested
    [00:05:23.209,442] <dbg> led_control: led_animation_thread_fn: LED Pattern Ended
    [00:05:23.209,442] <dbg> led_control: led_animation_thread_fn: LED Pattern Started
    [00:05:34.865,997] <dbg> connection: lte_event_handler: LTE_EVENT: RRC mode: Idle

    With valid P-GPS data, it should typically secure a GPS lock in under 30 to 40 seconds. I’ll leave it outside for a few hours to see if anything turns up, but not holding out hope, should have got a lock in 5 minutes as it only took 3 minutes with the gnss sample from a cold boot.

    Any insights into what could be potentially causing this issue?

      Yendor Any insights into what could be potentially causing this issue?

      Since the LTE shares the same signal path as the GPS is the cloud connection preventing GPS from getting a fix? i.e. are you publishing data and interrupting GPS acquisition? I see this as a culprit often.

      You may be able to look at the GPS event callback and check the Using/Tracking satellite count as a quick gauge to see.

      You prompted me to have a look at the unit, and I can confirm that it is transmitting GNSS data now?, i.e. successfully achieving a GPS fix. However, the time it takes to acquire the initial fix, even with P-GPS data it seems to be longer than it should be.

      I believe it’s time to see if Nordic has any insights. Thank you for your help.

      Terms and Conditions | Privacy Policy