Performing neighbor cell measurements fails after acquiring GPS fix

Hi, I've noticed a strange behavior of my device. I'm using a nRF9160-based custom board with nCS v2.6.0 and modem version 1.3.6.
Long story short - after trying to acquire a GPS fix, the device fails to perform neighbor cell measurements.

Short story long - the scenario is as follows:

  1. The device connects to the LTE network.
  2. The device performs lte_lc_neighbor_cell_measurement and successfully acquires the neighbor cell measurements.
  3. The device do some stuff and disconnects from the network.
  4. The device sleeps for some time.

The logs are as follows:

[22:32:08.016,662] <inf> connectivity: LTE connection order taken
+CEREG: 2, <hidden data>
[22:32:09.131,622] <inf> connectivity: Searching for network
+CSCON: 1
+CEREG: 5, <hidden data>
[22:32:10.219,573] <inf> connectivity: Connected to: roaming network
%NCELLMEAS: 0, <hidden data>
[22:32:10.222,320] <inf> connectivity: RSRP: -86, RSRQ: -12
%XTIME: <hidden data>
+CSCON: 0
+CSCON: 1

We see that the %NCELLMEAS: 0 message with proper data is received, which means that the neighbor cell measurements were successfully acquired. It happens after the device connects to the network.

After the operations described above have been performed a few times (always with success), we want to acquire the GPS fix:

  1. The device connects to the LTE network.
  2. The device tries to acquire the GPS fix using location_request using LOCATION_METHOD_GNSS, LOCATION_METHOD_CELLULAR methods and successfully acquires the fix.
  3. The device tries to perform lte_lc_neighbor_cell_measurement and fails.
  4. The device disconnects from the network.
  5. The device sleeps for some time.

After acquiring the GPS fix, each try to receive the neighbor cell measurements fails in the following way:

[28:32:08.016,662] <inf> connectivity: LTE connection order taken
%NCELLMEAS: 1
[28:32:08.410,827] <inf> connectivity: RSRP: -140, RSRQ: -20
+CEREG: 2, <hidden data>
[28:32:09.135,833] <inf> connectivity: Searching for network
+CSCON: 1
+CEREG: 5, <hidden data>
[28:32:09.984,832] <inf> connectivity: Connected to: roaming network
%XTIME: <hidden data>
+CSCON: 0
+CSCON: 1

We see that the %NCELLMEAS: 1 message with no data is received (logs shows always RSRP: -140, RSRQ: -20 because of our calculations in the code, but the callback returns "invalid values") at the very beginning of the LTE connection, which means that the neighbor cell measurements were not acquired, even though we didn't call lte_lc_neighbor_cell_measurement yet.

After that, the device performs the lte_lc_neighbor_cell_measurement and fails almost all the time. There is a slight chance that maybe 1/10 times the measurements are acquired successfully. After rebooting the device, everything works fine again until the GPS fix is acquired.

Can you try to reproduce the issue on your side? Do you have any idea what could be the reason for this behavior?

Thanks in advance for your help.

Parents
  • Hi,

    Can you provide your project configuration and full application log?

    Best regards,
    Dejan

  • Regarding project configuration, I'm not including internal application configs (for clarity):

    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    CONFIG_MODEM_INFO=y
    CONFIG_LTE_MODE_PREFERENCE_LTE_M=y
    CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_IPV4=y
    
    # Enable LTE modem usage
    CONFIG_MODEM_KEY_MGMT=y
    CONFIG_LTE_LINK_CONTROL=y
    
    # Enable connection second try if timeout changing LTE standard (M1 <-> NB)
    
    # SNTP
    CONFIG_SNTP=y
    CONFIG_POSIX_CLOCK=y
    CONFIG_NET_UDP=y
    CONFIG_NET_CONFIG_NEED_IPV4=y
    CONFIG_DATE_TIME=y
    CONFIG_DATE_TIME_AUTO_UPDATE=y
    CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=3600
    CONFIG_DATE_TIME_MODEM=y
    CONFIG_DATE_TIME_NTP=y
    
    
    # AT host library
    CONFIG_AT_HOST_LIBRARY=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_GPIO=y
    
    # Enable cpp config
    CONFIG_MINIMAL_LIBC=n
    CONFIG_NEWLIB_LIBC=y
    CONFIG_CPP=y
    CONFIG_STD_CPP14=y
    CONFIG_REQUIRES_FULL_LIBCPP=y
    CONFIG_DISK_ACCESS=y
    
    # Print float
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    
    # Log and debug handling
    CONFIG_STDOUT_CONSOLE=y
    #Enable Config Log and modify default level for desired debug
    CONFIG_LOG=y
    CONFIG_LOG_MODE_DEFERRED=y
    CONFIG_LOG_PROCESS_THREAD=n
    CONFIG_LOG_BLOCK_IN_THREAD=y
    CONFIG_LOG_BUFFER_SIZE=2048
    CONFIG_CUSTOM_LOG_BACKEND_FS=y
    CONFIG_CUSTOM_LOG_BACKEND_FS_DIR="/SD:/log/"
    CONFIG_CUSTOM_LOG_BACKEND_FS_FILE_SIZE=10485760
    CONFIG_CUSTOM_LOG_BACKEND_FS_OUTPUT_TEXT=y
    CONFIG_CUSTOM_LOG_BACKEND_FS_FILES_LIMIT=10
    CONFIG_CUSTOM_LOG_BACKEND_FS_OVERWRITE=y
    CONFIG_CUSTOM_LOG_BACKEND_FS_AUTOSTART=n
    CONFIG_LOG_TIMESTAMP_64BIT=y
    
    # CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_PRINTK=y
    CONFIG_FILE_SYSTEM=y
    CONFIG_FILE_SYSTEM_MKFS=y
    CONFIG_FAT_FILESYSTEM_ELM=y
    CONFIG_FS_FATFS_LFN=y
    CONFIG_FS_FATFS_LFN_MODE_STACK=y
    CONFIG_REQUIRES_FLOAT_PRINTF=y
    CONFIG_CBPRINTF_FP_SUPPORT=y
    # CONFIG_AWS_FOTA_LOG_LEVEL_DBG=y
    
    
    # main thread
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_MAIN_STACK_SIZE=8192
    
    # --- Tamanhos Stacks ---
    CONFIG_IDLE_STACK_SIZE=4096
    CONFIG_ISR_STACK_SIZE=8192
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
    CONFIG_PRIVILEGED_STACK_SIZE=8192
    
    
    # Configure sys_clock to 1ms (1000) or Max (32768) by default
    # CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
    
    # Config LTE connecting timeout to 60s (600s by default) 5s for DBG
    CONFIG_LTE_NETWORK_TIMEOUT=60
    
    
    # System Settings
    CONFIG_REBOOT=y
    CONFIG_MULTITHREADING=y
    CONFIG_INIT_STACKS=y
    CONFIG_STACK_USAGE=y
    CONFIG_HW_ID_LIBRARY=y
    CONFIG_HW_ID_LIBRARY_SOURCE_IMEI=y
    CONFIG_JSON_LIBRARY=y
    # CONFIG_LTO=y
    # CONFIG_ISR_TABLES_LOCAL_DECLARATION=y
    
    # LED
    CONFIG_PWM=y
    CONFIG_HWINFO=y
    CONFIG_PM_DEVICE=y
    CONFIG_PM_DEVICE_RUNTIME=y
    # RTC
    CONFIG_SERIAL=y
    CONFIG_NRFX_RTC0=y
    
    # ADC
    CONFIG_ADC=n
    CONFIG_NRFX_SAADC=y
    
    CONFIG_CJSON_LIB=y
    # AWS IoT library
    CONFIG_AWS_IOT=y
    CONFIG_AWS_IOT_BROKER_HOST_NAME=<hidden_data>
    CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
    CONFIG_AWS_IOT_TOPIC_GET_ACCEPTED_SUBSCRIBE=y
    CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y
    
    # MQTT helper library
    CONFIG_MQTT_HELPER=y
    CONFIG_MQTT_HELPER_SEC_TAG=2
    CONFIG_MQTT_HELPER_LAST_WILL=y
    CONFIG_MQTT_HELPER_STACK_SIZE=4096
    CONFIG_MQTT_KEEPALIVE=1200
    CONFIG_MQTT_CLEAN_SESSION=n
    CONFIG_MQTT_HELPER_RX_TX_BUFFER_SIZE=4096
    
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS=y
    CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
    CONFIG_DFU_TARGET=y
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_FOTA_SOCKET_RETRIES=50
    
    # MCUBOOT
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    
    # Image manager
    CONFIG_IMG_MANAGER=y
    CONFIG_STREAM_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    #I2C
    CONFIG_I2C=y
    CONFIG_I2C_NRFX=y
    
    #Used to reduce FLASH usage
    CONFIG_ASSERT=n
    
    
    
    CONFIG_LZ4=y
    CONFIG_BASE64=y
    
    # Settings
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_CUSTOM=y
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_FPROTECT=n
    
    CONFIG_DISK_LOG_LEVEL_DBG=y
    
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_SD_LOG_LEVEL_DBG=n
    CONFIG_KERNEL_LOG_LEVEL_ERR=y
    CONFIG_FS_LOG_LEVEL_DBG=n
    CONFIG_AWS_IOT_LOG_LEVEL_OFF=y
    CONFIG_MQTT_HELPER_LOG_LEVEL_OFF=y
    
    CONFIG_SIZE_OPTIMIZATIONS=y
    
    # CONFIG_APP_WIPE_STORAGE=y
    CONFIG_THREAD_CUSTOM_DATA=y
    
    # Enable SUPL client support
    CONFIG_SUPL_CLIENT_LIB=n
    
    CONFIG_RING_BUFFER=y
    
    # Watchdog
    CONFIG_WATCHDOG=y
    CONFIG_WDT_DISABLE_AT_BOOT=n
    
    
    # Application Event Manager
    CONFIG_APP_EVENT_MANAGER=y
    CONFIG_CAF=y
    
    CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="1.0.2+8"
    
    # NRF Cloud AGPS
    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_COMPILE_TIME=y
    CONFIG_NRF_CLOUD_CLIENT_ID_PREFIX="nrf-"
    CONFIG_NRF_CLOUD_CLIENT_ID_SRC_IMEI=y
    CONFIG_NRF_CLOUD_AGNSS=y
    CONFIG_NRF_CLOUD_REST=y
    CONFIG_NRF_CLOUD_SEC_TAG=3
    CONFIG_LOCATION_REQUEST_DEFAULT_GNSS_PRIORITY_MODE=y
    CONFIG_LOCATION_REQUEST_DEFAULT_GNSS_ACCURACY_HIGH=y
    CONFIG_LOCATION_METHOD_GNSS_PRIORITIZE_QZSS_ASSISTANCE=y
    CONFIG_LOCATION=y
    CONFIG_MODEM_JWT=y
    CONFIG_AT_MONITOR_HEAP_SIZE=1024
    
    CONFIG_CHARGER=y
    CONFIG_CHARGER_BQ24195=y
    CONFIG_BQ24195_TRIGGER_NONE=y
    
    CONFIG_SENSOR=y
    CONFIG_LOCAL_MAX17055=y
    CONFIG_MAX17055=n
    
    # HTTP requests
    CONFIG_HTTP_CLIENT=y


    Regarding application logs, I'm not including internal logs and logs related to AWS (may contain private data). Also, the whole log file contains 23719 lines, so I'm including only the most important of them (proper neighbor cell measurements, proper gps fix, failed neighbor cell measurements, failed nRF Cloud A-GNSS request):

    [24:32:08.016,662] <inf> connectivity: LTE connection order taken
    <internal_logs>
    +CEREG: 2,"8A02","0B83C40F",7
    [24:32:09.138,977] <inf> connectivity: Searching for network
    +CSCON: 1
    +CEREG: 5,"8A02","0B83C40F",7,,,"00011110","11100000"
    [24:32:09.898,681] <inf> connectivity: Connected to: roaming network
    %XTIME: "2B","4211409180002B","00"
    [24:32:09.963,562] <inf> connectivity: Requesting location
    %NCELLMEAS: 0,"0B83C40F","310410","8A02",208,5110,273,49,7,88326873,88326822
    [24:32:10.059,082] <inf> connectivity: RSRP: -91, RSRQ: -16
    +CSCON: 0
    [24:32:49.733,947] <inf> connectivity: Got location:
    [24:32:49.733,978] <inf> connectivity:   method: GNSS
    [24:32:49.734,008] <inf> connectivity:   latitude: <hidden_data>
    [24:32:49.734,039] <inf> connectivity:   longitude: <hidden_data>
    [24:32:49.734,069] <inf> connectivity:   accuracy: 9.4 m
    [24:32:49.734,100] <inf> connectivity:   date: 2024-11-04
    [24:32:49.734,100] <inf> connectivity:   time: 19:08:39.766 UTC
    [24:32:49.734,130] <inf> connectivity:   Google maps URL: <hidden_data>
    [24:32:49.770,385] <inf> app_event_manager: e:system_state system_state: 12
    [24:32:49.771,667] <inf> connectivity: Current timezone: -32
    <internal_logs>
    +CEREG: 2
    [24:32:49.795,257] <inf> connectivity: Searching for network
    %NCELLMEAS: 0,"0B83C40F","310410","8A02",65535,5110,273,49,8,88367584,0
    [24:32:50.778,533] <inf> connectivity: RSRP: -91, RSRQ: -16
    +CEREG: 5,"8A02","0B83C40F",7,,,"00011110","11100000"
    [24:32:50.879,791] <inf> connectivity: Connected to: roaming network
    +CSCON: 1
    +CSCON: 0
    +CSCON: 1
    +CSCON: 0
    <internal_logs>
    +CSCON: 1
    <internal_logs>
    +CSCON: 0
    +CSCON: 1
    +CEREG: 0
    +CSCON: 0
    [24:33:43.425,903] <inf> connectivity: Turn off LTE connection
    <internal_logs>
    [26:32:08.016,662] <inf> connectivity: LTE connection order taken
    %NCELLMEAS: 1
    [26:32:08.408,752] <inf> connectivity: RSRP: -140, RSRQ: -20
    [26:32:08.409,088] <inf> connectivity: Current timezone: -32
    <internal_logs>
    +CEREG: 2,"8A02","0B83C40F",7
    [26:32:09.132,537] <inf> connectivity: Searching for network
    +CSCON: 1
    +CEREG: 5,"8A02","0B83C40F",7,,,"00011110","11100000"
    [26:32:09.924,285] <inf> connectivity: Connected to: roaming network
    %XTIME: "2B","4211401270952B","00"
    +CSCON: 0
    +CSCON: 1
    <internal_logs>
    +CSCON: 0
    +CSCON: 1
    +CEREG: 0
    +CSCON: 0
    [26:32:44.495,056] <inf> connectivity: Turn off LTE connection
    
    ... (logs from the next GPS fix routine)
    
    [48:01:28.431,488]<inf> connectivity: LTE connection order taken
    [48:01:28.884,490]<inf> connectivity: Requesting location
    %NCELLMEAS: 1
    [48:01:28.953,521]<inf> connectivity: RSRP: -140, RSRQ: -20
    [48:01:28.953,582]<wrn> location: Current cell ID not valid
    [48:01:28.953,582]<wrn> location: Requesting A-GNSS data without location assistance
    [48:01:28.955,535] <err> rest_client: getaddrinfo() failed, error: -11
    [48:01:28.955,535] <err> rest_client: rest_client_do_api_call() failed, err -14
    [48:01:28.955,566] <err> location: nRF Cloud A-GNSS request failed, error: -14
    +CEREG: 2,"8A02","0B83C40F",7
    [48:01:29.618,041]<inf> connectivity: Searching for network
    +CSCON: 1
    +CEREG: 5,"8A02","0B83C40F",7,,,"00011110","11100000"
    [48:01:30.347,015]<inf> connectivity: Connected to: roaming network
    %XTIME: "2B","4211803010702B","00"
    +CSCON: 0
    +CSCON: 1
    +CSCON: 0
    [48:02:24.553,039]<inf> connectivity: Got location:
    [48:02:24.553,100]<inf> connectivity:   method: GNSS
    [48:02:24.553,131]<inf> connectivity:   latitude: <hidden_data>
    [48:02:24.553,161]<inf> connectivity:   longitude: <hidden_data>
    [48:02:24.553,161]<inf> connectivity:   accuracy: 6.8 m
    [48:02:24.553,192]<inf> connectivity:   date: 2024-11-08
    [48:02:24.553,192]<inf> connectivity:   time: 03:02:02.090 UTC
    [48:02:24.553,222]<inf> connectivity:   Google maps URL: <hidden_data>


    I hope this helps. I can't provide you whole log data, because it contains data related to AWS connections etc.

  • Hi,

    Modem reports +CEREG: 2 after %NCELLMEAS: 1 which means that the modem is not yet registered. It looks like you are trying to connect to the network while simultaneously triggering location request. The location library cannot download assistance data because modem is not yet connected to the LTE network. This may also be the reason for %NCELLMEAS failure. You should wait for modem to connect to the network before triggering the location request.

    Best regards,
    Dejan

  • Yes, you're right, except I'm explicitly waiting in my code for network connection before even starting the lte_lc_neighbor_cell_measurement (in both cases after the log "<inf> connectivity: Connected to: roaming network"). So if that's the case, then after acquiring the GPS fix, the device automatically tries to perform the measurements after calling lte_lc_connect_async?

    Also, as far as I'm concerned, the GPS fix itself uses the neighbor_cell_measurement, so they're somehow connected to each other and my problems may be caused because of that.

Reply
  • Yes, you're right, except I'm explicitly waiting in my code for network connection before even starting the lte_lc_neighbor_cell_measurement (in both cases after the log "<inf> connectivity: Connected to: roaming network"). So if that's the case, then after acquiring the GPS fix, the device automatically tries to perform the measurements after calling lte_lc_connect_async?

    Also, as far as I'm concerned, the GPS fix itself uses the neighbor_cell_measurement, so they're somehow connected to each other and my problems may be caused because of that.

Children
  • Hi,

    The correct order would be to first have "connectivity: Connected to: roaming network" followed by "connectivity: Requesting location". Since there is no log for location request, it is not clear what could be causing the failure of %NCELLMEAS  when you have %NCELLMEAS: 1 and +CEREG: 2. When you get "getaddrinfo() failed", location is requested before connection has been established.

    Best regards,
    Dejan

Related