How can I evaluate that AGPS data downloaded and been processed?

Hello,

I’m trying to understand exactly how the location module works in the Assert Tracker V2 application. I want to see the NMEA data in the logs, but I’m not sure how to enable it or if that’s even possible. My main goal is to confirm that the AGPS data downloaded by the library has been processed. It’s easy to see this in the GNSS sample, but you don’t see the same information in the Assert Tracker’s PVT data.

  • Hi,

    I add the next code to the ncs\v2.9.0\nrf\lib\location\method_gnss.c

    static struct k_work method_gnss_nmea_work;
    
    void method_gnss_event_handler(int event)
    {
    	switch (event) {
    	case NRF_MODEM_GNSS_EVT_PVT:
    		k_work_submit_to_queue(location_core_work_queue_get(), &method_gnss_pvt_work);
    		break;
    	case NRF_MODEM_GNSS_EVT_NMEA:
    		k_work_submit_to_queue(location_core_work_queue_get(), &method_gnss_nmea_work);
    		break;
    
    	default:
    		break;
    	}
    }
    
    static void method_gnss_print_nmea(const struct nrf_modem_gnss_nmea_data_frame *nmea)
    {
    
    	char local_nmea[NRF_MODEM_GNSS_NMEA_MAX_LEN + 1];
    	strncpy(local_nmea, nmea->nmea_str, NRF_MODEM_GNSS_NMEA_MAX_LEN);
    	local_nmea[NRF_MODEM_GNSS_NMEA_MAX_LEN] = '\0';
    
    	for (int i = 0; i < NRF_MODEM_GNSS_NMEA_MAX_LEN; i++) {
    
    		if (local_nmea[i] == '\r' || local_nmea[i] == '\n') {
    
    			local_nmea[i] = '\0';
    
    			break;
    		}
    	}
    
    	LOG_WRN("GNSS: NMEA: %s", local_nmea);
    }
    
    static void method_gnss_nmea_work_fn(struct k_work *item)
    {
    	struct nrf_modem_gnss_nmea_data_frame nmea_data;
    
    	if (!running) {
    		/* Cancel has already been called, so ignore the notification. */
    		return;
    	}
    
    	if (nrf_modem_gnss_read(&nmea_data, sizeof(nmea_data), NRF_MODEM_GNSS_DATA_NMEA) != 0) {
    		LOG_ERR("Failed to read NMEA data from GNSS");
    		return;
    	}
    
    	method_gnss_print_nmea(&nmea_data);
    }
    
    k_work_init(&method_gnss_nmea_work, method_gnss_nmea_work_fn);


    But the issue is that I never get the NRF_MODEM_GNSS_EVT_NMEA event. Do I need to enable additional config option? 

  • Hi

    Have you included the ...\nrfxlib\nrf_modem\include\nrf_modem_gnss.h on your end. I don't see a specific config needing to be enabled here.

    Best regards,

    Simon

  • Hi  ,

    Yes, the nrf_modem_gnss.h was included in the C:\ncs\v2.9.0\nrf\lib\location\method_gnss.c file. 

    #include <stdio.h>
    #include <zephyr/kernel.h>
    #include <zephyr/logging/log.h>
    #include <modem/location.h>
    #include <modem/lte_lc.h>
    #include <nrf_modem_at.h>
    #include <nrf_modem_gnss.h>
    #include <nrf_errno.h>
    #include "location_core.h"
    #include "location_utils.h"
    #if defined(CONFIG_NRF_CLOUD_AGNSS)
    #include "scan_cellular.h"
    #include <net/nrf_cloud_rest.h>
    #include <net/nrf_cloud_agnss.h>
    #include <stdlib.h>
    #endif
    #if defined(CONFIG_NRF_CLOUD_PGPS)
    #include <net/nrf_cloud_rest.h>
    #include <net/nrf_cloud_pgps.h>
    #endif
    #if defined(CONFIG_NRF_CLOUD_COAP)
    #include <net/nrf_cloud_coap.h>
    #endif
    #if defined(CONFIG_LOCATION_SERVICE_NRF_CLOUD_GNSS_POS_SEND)
    #include <net/nrf_cloud_codec.h>
    #include <zephyr/sys/timeutil.h>
    #include <time.h>
    #endif

  • Okay, I also meant to mention you should use the C:\ncs\v2.9.0\nrf\samples\cellular\gnss project as a reference, as this sample uses NMEA strings.

    Best regards,

    Simon

  • Sorry but this is not help at all. I need to see the NMEA in the assert tracking I know that I can just build the gnss sample and I will have the NMEA, but I need it in the Assert tracker sample. 

Related