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

questions for AGPS

Hi

I merged the AGPS to serial_lte_modem slm_at_gps.c but it did not work:

1, if I activate LTE in gps_thread_fn(), it will be failed in supl_session();

00> Established LTE link
00> 
00> Starting SUPL session
00> ip 6cb1:61c0:: (c061b16c) port 7276
00> 
00> ossinit failed, rc: 8
00> 
00> SUPL session internal resources released
00> 
00> Done

2, If I activated LTE and attached to network before starting GPS, the gps_data.data_id will never be NRF_GNSS_AGPS_DATA_ID, so the GPS will have no opportunity to download SUPL data from server. why?

Parents
  • Hi.

    Libsupl error 8 is LIBSUPL_SESSION_MISSING_ERR. Are you certain that you integrated the SUPL library correctly?

    Have you enabled debug logging in the library? That might provide more details about what goes wrong.

    Best regards,

    Didrik

  • Hi 

    Are you certain that you integrated the SUPL library correctly?

    How to ensure this? I download the library from your site and put them into "nrf\ext\lib\bin\supl"

    Have you enabled debug logging in the library?

    How to enable the library logging?

    Updated the agps log as below:

    00> Starting SUPL session
    00> [00:00:22.179,504] <inf> lte: +CEREG: 2,"0001","01A2D101",7,0,0,"11100000",~
    00> [00:00:22.490,875] <inf> lte: +CEREG: 1,"0001","01A2D101",7,,,"00001111","1~
    00> [00:00:22.490,875] <inf> lte: Connected to LTE network.
    00> Established LTE link
    00> 
    00> ip 6cb1:61c0:: (c061b16c) port 7276
    00> 
    00> ossinit failed, rc: 8
    00> 
    00> SUPL session internal resources released
    00> 
    00> [00:00:22.644,195] <err> agps: SUPL session failed: -15
    00> Done
    00> 
    00> [00:00:22.682,647] <inf> lte: +CEREG: 0,"0001","01A2D101",7,0,0,"11100000",~

  • Siyou said:
    How to ensure this? I download the library from your site and put them into "nrf\ext\lib\bin\supl"

     What I meant was how you had included it in your application. But yes, you have put the library in the right place.

     

    Siyou said:

    Have you enabled debug logging in the library?

    How to enable the library logging?

     After taking another look at the SUPL library, I might have misunderstood how the logging in the library works. The library should provide debug logging regardless, while you can decide if you want to print it in the log handler you provide to the library.

     

    Didrik Rokhaug said:
    Libsupl error 8 is LIBSUPL_SESSION_MISSING_ERR

     Again, I misunderstood where the error came from. It does not mean LIBSUPL_SESSION_MISSING_ERR, but OUT_MEMORY: https://www.oss.com/asn1/products/documentation/asn1_c_10.7/asn1c-runtime-return-codes.html

    In what thread are you running the SUPL library, how large stack does that thread have, and how much heap do you have?

    What happens if you increase those?

    The SUPL error is LIBSUPL_DECODE_ERR, which is expected, as the library used for decoding fails to be initialized.

  • Hi 

    In what thread are you running the SUPL library, how large stack does that thread have, and how much heap do you have?

    I start supl_session in gps_thread_fn() of slm_at_gps.c, the original THREAD_STACK_SIZE is 1KB, heap size as below:

    CONFIG_MAIN_STACK_SIZE=8192
    CONFIG_HEAP_MEM_POOL_SIZE=16384

    I tried changing the THREAD_STACK_SIZE  to 4KB but the supl_session still was failed as before.

    how large stack does the supl_session need?

  • Hello,

    Sorry to push you, our project is waiting for this agps feature, can anybody provide the support of how to integrate the SUPL client library to serial_lte_modem sample?

Reply Children
  • If you are using Segger Embedded Studio, did you remember to re-open the project after making the changes to the prj.conf file?

    Looking at the GPS sample, it uses a stack of 4KB and heap of 2KB, so I don't know why your configuration did not work.

    I will ask our developers if they have other suggestions for you.

  • If you are using Segger Embedded Studio, did you remember to re-open the project after making the changes to the prj.conf file?

    We built the project by gcc on linux server.

    I will ask our developers if they have other suggestions for you.

    Looking forward to your update, thank you

  • The answer I got was this:

    This code does not use the zephyr kernel memory allocation code (k_malloc), it uses the libc vanilla malloc implementation. So this heap has to be tuned with either CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE or CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE kconfig parameter, depending on which libc version is used.

    However, before you start playing around with those options, I want you to try something else:
    The GPS sample is using the Newlib libc, instead of Zephyr's standard minimal libc. However, the serial_lte_modem sample does not. Could you try to enable the Newlib libc?

    You can do that by adding CONFIG_NEWLIB_LIBC=y to your prj.conf file

  • Hi

    Still failed, the system will crash, here is the error log after enabled the Newlib libc

    And the result will be same with or without option "CONFIG_NEWLIB_LIBC_ALIGNED_HEAP_SIZE=4096"

    Starting SUPL session
    [00:00:17.443,603] <inf> lte: +CEREG: 2,"0001","01A2D101",7,0,0,"11100000",~
    [00:00:17.874,969] <inf> lte: +CEREG: 1,"0001","01A2D101",7,,,"00001111","1~
    [00:00:17.875,000] <inf> lte: Connected to LTE network.
    Established LTE link
    
    ip 6cb1:61c0:: (c061b16c) port 7276
    
    ULP encoding length: 38
    
    [00:00:18.049,774] <err> os: r0/a1:  0x00000002  r1/a2:  0x20023788  r2/a3:  0xf0f0f0f0
    [00:00:18.049,774] <err> os: r3/a4:  0x2002fe58 r12/ip:  0x00000000 r14/lr:  0x00043dcf
    [00:00:18.049,774] <err> os:  xpsr:  0x41000000
    [00:00:18.049,774] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    [00:00:18.049,804] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    [00:00:18.049,804] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
    [00:00:18.049,835] <err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
    [00:00:18.049,835] <err> os: fpscr:  0x20024acc
    [00:00:18.049,835] <err> os: Faulting instruction address (r15/pc): 0x00037bd6
    [00:00:18.049,835] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
    [00:00:18.049,835] <err> os: Current thread: 0x20023788 (unknown)
    [00:00:18.538,238] <err> fatal_error: Resetting system
    *** Booting Zephyr OS build v2.1.99-ncs1  ***

  • It looks like you are able to initialize the decoding library now, which is good.

    The error a stack overflow, as is said in the log.

    You could try to figure out what thread overflows by using k_current_get, but my guess is that it is the GPS thread where you are running the SUPL library.

    You could try to increase the stack size of that thread a bit more.

Related