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

A-GPS download fails mid session

Hello,

I am trying to run the A-GPS sample program but am encountering a bit of difficulty with the SUPL code.

I had to modify the LTE connection code to allow access for NB-IoT, APN and User/Pass for the SIMs we are using but encounter this error during the connection and download process:

New AGPS data requested, contacting SUPL server, flags 59
Established LTE link
ip 4a7d:8cc0:: (c08c7d4a) port 7276
Starting SUPL session
ULP encoding length: 38
Bytes sent: 38
Bytes received: 34
ULP ossDecode success, choice 3
SUPL server responded using version 2.0.4
SUPL response received
ULP encoding length: 57
Bytes sent: 57
read again
Bytes received: 708
ULP ossDecode more input 4
Bytes received: 2996
ULP ossDecode success, choice 5
Failed to send AGNSS data, type: 1 (err: 5)
UTC conversion/injection failed, rc: 3
Generic assistance data injection failed, rc: 3
SUPL error: 2
ULP encoding length: 34
Bytes sent: 34
SUPL session internal resources released
SUPL session finished
Done

While building the sample program, I also was warned about an error in the SUPL code:

[38/138] Building C object modules/nrf/lib/supl/CMakeFiles/..__nrf__lib__supl.dir/os/lte_params.c.obj
/Users/xxxxxx/Downloads/ncs/nrf/lib/supl/os/lte_params.c: In function 'parse_lte_mcc':
/Users/xxxxxx/Downloads/ncs/nrf/lib/supl/os/lte_params.c:73:3: warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]
   memset(lte->mcc, 0, 3);

Could I get a bit of help decyphering what went wrong here? I have made no modifications to the SUPL code and only added code to enable connection to the Network in my local area.

	static const char     at_commands_NB[][50]  = {
					AT_CFUN_OFF,
					AT_XSYSTEMMODE,
	#ifdef CONFIG_BOARD_NRF9160_PCA10090NS
					AT_MAGPIO_LTE,
					AT_BANDLOCK,
					AT_APN,
					AT_USER_PASS,
	#endif
					AT_ACTIVATE_LTE
				};
				
*********************************

static int activate_lte(bool activate)
{
	if (activate) {
		for (int i = 0; i < ARRAY_SIZE(at_commands_NB); i++) {

			if (at_cmd_write(at_commands_NB[i], NULL, 0, NULL) != 0) {
				printk("Error with at_commands_NB\n");
				return -1;
			}
		}

The above should be working correctly if the device was able to connect to the SUPL library in the first place so I doubt it's the above changes.

Many thanks,

MJD

  • Hi ,
    Has any progress been made internally on this issue?

    Michael

  • Hello,

    not Simon, but I'm handling the case while he is away. Those that were working on your problem are on vacation now, so I got someone else to take over. Hopefully you will get an answer today or in the near future.

  • Are you using the newest version of A-GPS sample? There seems to be an issue with A-GPS injection possibly being intercepted by GNSS search. Can you please capture a modem log? Just follow these instructions.

  • I was using the SDK v1.2.0 to do this testing. I have updated to v1.3.0 and attached a modem trace below. Please let me know if there are any issues with the trace.

    trace-2020-07-16T12-32-27.611Z.bin

    For reference, the GPS application is modified to use an AT command array with the following commands, without this LTE set-up, the SIM Cards will never make a connection to the network.

    #define AT_CFUN_OFF						"AT+CFUN=4"
    #define AT_APN_zzzz					"AT+CGDCONT=0,\"IP\",\"ep.inetd.gdsp\""
    #define AT_MAGPIO_LTE      			    "AT\%XMAGPIO=1,1,1,1,5,791,849"
    #define AT_BANDLOCK						"AT\%XBANDLOCK=1,\"10000000000000000000\""
    #ifdef CONFIG_BOARD_NRF9160DK_NRF9160NS
    	#define AT_MAGPIO                   "AT\%XMAGPIO=1,0,0,1,1,1574,1577"
    	#define AT_COEX0                    "AT\%XCOEX0=1,1,1570,1580"
    	#define AT_APN_xxx				"AT+CGDCONT=0,\"IP\",\"xxx.com\""
    	#define AT_xxxx_USER_PASS		"AT+CGAUTH=0,\"PAP\",\"xxx\",\"xxx\""
    	#define AT_LEG_PCO					"AT\%XEPCO=1"
    #endif
    
    static const char     at_commands_NB[][50]  = {
    				AT_CFUN_OFF,
    				AT_XSYSTEMMODE,
    #ifdef CONFIG_BOARD_NRF9160DK_NRF9160NS
    				//AT_MAGPIO_LTE,
    				AT_BANDLOCK,
    				AT_APN_xxx,
    				AT_xxx_USER_PASS,
    				AT_LEG_PCO,
    #endif
    				AT_ACTIVATE_LTE
    			};
    			
    static int activate_lte(bool activate)
    {
    	if (activate) {
    		for (int i = 0; i < ARRAY_SIZE(at_commands_NB); i++) {
    			if (at_cmd_write(at_commands_NB[i], NULL, 0, NULL) != 0) {
    				printk("Error with at_commands_NB\n");
    				return -1;
    			}
    		}
    
    		at_notif_register_handler(NULL, wait_for_lte);
    		if (at_cmd_write("AT+CEREG=2", NULL, 0, NULL) != 0) {
    			printk("Error with wait_for_lte 1\n");
    			return -1;
    		}
    
    		k_sem_take(&lte_ready, K_FOREVER);
    
    		at_notif_deregister_handler(NULL, wait_for_lte);
    		if (at_cmd_write("AT+CEREG=0", NULL, 0, NULL) != 0) {
    			printk("Error with wait_for_lte 2\n");
    			return -1;
    		}
    	} else {
    		if (at_cmd_write(AT_DEACTIVATE_LTE, NULL, 0, NULL) != 0) {
    			printk("Error with AT_DEACTIVATE_LTE\n");
    			return -1;
    		}
    	}
    
    	return 0;
    }

    I have tried with and without setting legecy PCO on v1.3.0 as mentioned to try by Simonr in an earlier reply and had no success.

    Note:

    I have had a couple instances today of this:

    New AGPS data requested, contacting SUPL server, flags 59
    Sending AT command: AT+CFUN=4
    Sending AT command: AT%XSYSTEMMODE=0,1,1,0
    Sending AT command: AT%XBANDLOCK=1,"10000000000000000000"
    Sending AT command: AT+CGDCONT=0,"IP","xxx.com"
    Sending AT command: AT+CGAUTH=0,"PAP","xxx","xxx"
    Sending AT command: AT%XEPCO=1
    Sending AT command: AT+CFUN=21
    Established LTE link
    ip 40e9:a6c0::1001:300:1b00:1b00 (c0a6e940) port 7276
    Starting SUPL session
    ULP encoding length: 38
    Bytes sent: 38
    read again
    read again
    read again
    read error: -1
    SUPL error: 1
    ULP encoding length: 18
    Sending SUPL message failed, bytes_sent: -1
    SUPL session internal resources released
    Done
    Failed to start GPS

    The last line of GPS failure to start is appearing in the v1.3.0 example, I not sure why but I have played around in the AT client and can see that swapping between AT+CFUN=21 and 31 can ERROR out so I believe that may be the issue. Does the code call CFUN=20 correctly in the trace after A-GPS failure? GPS starts and works as normal when SUPL is not configured 'y' in the prj.conf

  • Thanks for the log, I will forward it for analysis.

Related