PPPOS GNSS code

  1. My goal is: To use the PPPOS code to connect to GNSS
  2. My actions are: uncommenting the gnss code block from the pppos.h file pulled from the mongoose server

// Retrieve GNSS status from SimCom GPS-capable modem:

const struct mgos_pppos_cmd cmds = {
{.cmd = “AT+CGNSPWR=1”}, // Turn on GNSS (if not already).
{.cmd = “AT+CGNSINF”, .cb = gnsinf_cb},
{.cmd = NULL},
};

mgos_pppos_run_cmds(0, cmds);

bool gnsinf_cb(void *cb_arg, bool ok, struct mg_str data)
{
if (!ok)
return false;
int run = 0, fix = 0;
char time[20];
float lat = 0, lon = 0, alt = 0, speed = 0, course = 0;
sscanf(data.p, “+CGNSINF: %d,%d,%18s,%f,%f,%f,%f,%f”,
&run, &fix, time, &lat, &lon, &alt, &speed, &course);
if (fix)
{
LOG(LL_INFO, (“lat,lon: %f,%f alt: %.3f speed: %.2f course: %.2f”,
lat, lon, alt, speed, course));
}
else
{
LOG(LL_INFO, (“No GNSS fix yet”));
}
(void)cb_arg;
return true;
};

  1. The result I see is: build errors

make: Entering directory ‘/app’
Toolchain path: /opt/Espressif/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a
Compiler version: 5.2.0
/c/mos/faris/deps/modules/mongoose-os/platforms/esp32/Makefile.build:186: warning: overriding recipe for target ‘defconfig’
/opt/Espressif/esp-idf/make/project_config.mk:76: warning: ignoring old recipe for target ‘defconfig’
/c/mos/faris/deps/modules/mongoose-os/platforms/esp32/Makefile.build:186: warning: overriding recipe for target ‘menuconfig’
/opt/Espressif/esp-idf/make/project_config.mk:63: warning: ignoring old recipe for target ‘menuconfig’
/c/mos/faris/deps/modules/mongoose-os/platforms/esp32/Makefile.build:228: warning: overriding recipe for target ‘clean’
/opt/Espressif/esp-idf/components/app_update/Makefile.projbuild:60: warning: ignoring old recipe for target ‘clean’
make[1]: Entering directory ‘/opt/Espressif/esp-idf/components/bootloader/subproject’
Python requirements from /opt/Espressif/esp-idf/requirements.txt are satisfied.
make[1]: Leaving directory ‘/opt/Espressif/esp-idf/components/bootloader/subproject’
make[1]: Entering directory ‘/c/mos/faris/build/objs/mosapp’
CC mgos_net.o
CC mgos_pppos.o
In file included from /c/mos/faris/deps/pppos/src/mgos_pppos.c:18:0:
/c/mos/faris/deps/pppos/include/mgos_pppos.h:108:35: error: ‘gnsinf_cb’ undeclared here (not in a function)
{.cmd = “AT+CGNSINF”, .cb = gnsinf_cb},
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:112:23: error: expected declaration specifiers or ‘…’ before numeric constant
mgos_pppos_run_cmds(0, cmds);
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:112:26: error: expected declaration specifiers or ‘…’ before ‘cmds’
mgos_pppos_run_cmds(0, cmds);
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h: In function ‘gnsinf_cb’:
/c/mos/faris/deps/pppos/include/mgos_pppos.h:125:7: error: implicit declaration of function ‘LOG’ [-Werror=implicit-function-declaration]
LOG(LL_INFO, (“lat,lon: %f,%f alt: %.3f speed: %.2f course: %.2f”,
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:125:11: error: ‘LL_INFO’ undeclared (first use in this function)
LOG(LL_INFO, (“lat,lon: %f,%f alt: %.3f speed: %.2f course: %.2f”,
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:125:11: note: each undeclared identifier is reported only once for each function it appears in
/c/mos/faris/deps/pppos/include/mgos_pppos.h:125:72: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
LOG(LL_INFO, (“lat,lon: %f,%f alt: %.3f speed: %.2f course: %.2f”,
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:126:24: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
lat, lon, alt, speed, course));
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:126:29: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
lat, lon, alt, speed, course));
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:126:34: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
lat, lon, alt, speed, course));
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:126:41: error: left-hand operand of comma expression has no effect [-Werror=unused-value]
lat, lon, alt, speed, course));
^
In file included from /c/mos/faris/deps/modules/mongoose-os/src/mgos_net.c:29:0:
/c/mos/faris/deps/pppos/include/mgos_pppos.h:108:35: error: ‘gnsinf_cb’ undeclared here (not in a function)
{.cmd = “AT+CGNSINF”, .cb = gnsinf_cb},
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:112:23: error: expected declaration specifiers or ‘…’ before numeric constant
mgos_pppos_run_cmds(0, cmds);
^
/c/mos/faris/deps/pppos/include/mgos_pppos.h:112:26: error: expected declaration specifiers or ‘…’ before ‘cmds’
mgos_pppos_run_cmds(0, cmds);
^
make[1]: *** [mgos_net.o] Error 1
make[1]: *** Waiting for unfinished jobs…
/c/mos/faris/deps/modules/mongoose-os/platforms/esp32/src/esp32_src.mk:104: recipe for target ‘mgos_net.o’ failed
cc1: all warnings being treated as errors
make[1]: *** [mgos_pppos.o] Error 1
/c/mos/faris/deps/modules/mongoose-os/platforms/esp32/src/esp32_src.mk:104: recipe for target ‘mgos_pppos.o’ failed
make[1]: Leaving directory ‘/c/mos/faris/build/objs/mosapp’
/opt/Espressif/esp-idf/make/project.mk:530: recipe for target ‘component-mosapp-build’ failed
make: Leaving directory ‘/app’
make: *** [component-mosapp-build] Error 2
Error: exit status 2
/go/src/github.com/mongoose-os/mos/mos/build_local.go:679:
/go/src/github.com/mongoose-os/mos/mos/build_local.go:666:
/go/src/github.com/mongoose-os/mos/mos/build_local.go:431:
/go/src/github.com/mongoose-os/mos/mos/build.go:223:
/go/src/github.com/mongoose-os/mos/mos/build.go:166:
/go/src/github.com/mongoose-os/mos/mos/main.go:194: build failed

  1. My expectation & question is: Is there anything that I need to add to the code to make it work? I am seeing functions prototypes but there are no function definitions.

Leave that example commented out in pppos.h and move it in your application’s code taking care to declare gnsinf_cb before using it.

Hi

I have added

bool gnsinf_cb(void *cb_arg, bool ok, struct mg_str data) {
   LOG(LL_INFO, ("What is ok %d", ok));
    if (!ok) return false;
    int fix = 0;
    char time[20];
    float lat = 0, lon = 0, hdop = 0, alt = 0, speed = 0, course = 0;
    sscanf(data.p, "$GPSACP:%18s,%f,%f,%f,%f,%d,%f,%f",
                   time, &lat, &lon, &hdop, &alt, &fix, &course, &speed);
     LOG(LL_INFO, ("Scan Sentence %s", data.p));              
     LOG(LL_INFO, ("What is fix %d", fix));
    if (fix == 1) {
      LOG(LL_INFO, ("lat,lon: %f,%f alt: %.3f speed: %.2f course: %.2f",
                    lat, lon, alt, speed, course));
    } else {
      LOG(LL_INFO, ("No GNSS fix yet"));
    }
    (void) cb_arg;
    return true;
 }

to my pppos.c code

and written this

#include "mgos.h"
#include "mgos_pppos.h"

struct mgos_pppos_cmd cmds[] = {
        {.cmd = "AT$GPSP=0"},  
        {.cmd = "AT$GPSP=1"},  
        {.cmd = "AT$GPSACP", .cb = gnsinf_cb},
        {.cmd = NULL},
 };

static void gps_cb (void *gps) {
    LOG(LL_INFO, ("Timer test"));
    mgos_pppos_run_cmds(0, gps);
}

enum mgos_app_init_result mgos_app_init(void) {


// Retrieve GNSS status from SimCom GPS-capable modem:

 
    mgos_set_timer(1000, true, gps_cb, cmds);

  return MGOS_APP_INIT_SUCCESS;
}

to my main.c code.

And I am receiving an output such as this with a core dump happening every minute or so.

[May 21 19:34:10.814] mgos_pppos.c:1015       What is ok 1
[May 21 19:34:10.814] mgos_pppos.c:1022       Scan Sentence $GPSACP: ,,,,,1,,,,,,
[May 21 19:34:10.821] 
[May 21 19:34:10.821] OK
[May 21 19:34:10.821] }%}&  * }'}"}(}"  ~
[May 21 19:34:10.821] OK
[May 21 19:34:10.826] ~ }# !}! } }8}"}&} } } } }#}$ #}%}&  * }'}"}(}"HU3
[May 21 19:34:10.826] mgos_pppos.c:1023       What is fix 0
[May 21 19:34:10.832] mgos_pppos.c:1028       No GNSS fix yet
[May 21 19:34:11.103] main.c:29               Timer test
[May 21 19:34:12.103] main.c:29               Timer test
[May 21 19:34:13.102] main.c:29               Timer test
[May 21 19:34:13.907] mgos_pppos.c:1015       What is ok 1
[May 21 19:34:13.907] mgos_pppos.c:1022       Scan Sentence $GPSACP: ,,,,,1,,,,,,
[May 21 19:34:13.913] 
[May 21 19:34:13.913] OK
[May 21 19:34:13.913] }%}&  * }'}"}(}"  ~
[May 21 19:34:13.913] OK
[May 21 19:34:13.918] ~ }# !}! } }8}"}&} } } } }#}$ #}%}&  * }'}"}(}"HU~~3~
[May 21 19:34:13.918] mgos_pppos.c:1023       What is fix 0
[May 21 19:34:13.924] mgos_pppos.c:1028       No GNSS fix yet
[May 21 19:34:14.102] main.c:29               Timer test
[May 21 19:34:15.103] main.c:29               Timer test
[May 21 19:34:16.102] main.c:29               Timer test
[May 21 19:34:16.907] mgos_pppos.c:1015       What is ok 1
[May 21 19:34:16.907] mgos_pppos.c:1022       Scan Sentence $GPSACP: ,,,,,1,,,,,,
[May 21 19:34:16.913] 
[May 21 19:34:16.913] OK
[May 21 19:34:16.913] }%}&  * }'}"}(}"  ~
[May 21 19:34:16.913] OK
[May 21 19:34:16.919] ~ }# !}! } }8}"}&} } } } }#}$ #}%}&  * }'}"}(}"HU~~3~
[May 21 19:34:16.919] mgos_pppos.c:1023       What is fix 0
[May 21 19:34:16.926] mgos_pppos.c:1028       No GNSS fix yet
[May 21 19:34:17.102] main.c:29               Timer test
[May 21 19:34:18.103] main.c:29               Timer test
[May 21 19:34:19.102] main.c:29               Timer test
[May 21 19:34:19.906] mgos_pppos.c:1015       What is ok 1
[May 21 19:34:19.906] mgos_pppos.c:1022       Scan Sentence $GPSACP: ,,,,,1,,,,,,
[May 21 19:34:19.912] 
[May 21 19:34:19.912] OK
[May 21 19:34:19.912] }%}&  * }'}"}(}"  
[May 21 19:34:19.912] OK
[May 21 19:34:19.919] ~ }# !}! } }8}"}&} } } } }#}$ #}%}&  * }'}"}(}"HU~~3
[May 21 19:34:19.919] mgos_pppos.c:1023       What is fix 0
[May 21 19:34:19.924] mgos_pppos.c:1028       No GNSS fix yet
[May 21 19:34:20.103] main.c:29               Timer test
[May 21 19:34:21.102] main.c:29               Timer test
[May 21 19:34:22.102] main.c:29               Timer test
[May 21 19:34:22.326] mgos_pppos.c:189        Error 6 (phase 0), reconnect
[May 21 19:34:22.326] mgos_net.c:85           PPP: connecting
[May 21 19:34:23.103] main.c:29               Timer test
[May 21 19:34:24.103] main.c:29               Timer test
[May 21 19:34:25.104] main.c:29               Timer test
[May 21 19:34:25.104] mgos_pppos.c:1015       What is ok 1
[May 21 19:34:25.109] mgos_pppos.c:1022       Scan Sentence $GPSACP: ,,,,,1,,,,,,
[May 21 19:34:25.115] 
[May 21 19:34:25.115] OK
[May 21 19:34:25.115] 
[May 21 19:34:25.115] mgos_pppos.c:1023       What is fix 0
[May 21 19:34:25.115] mgos_pppos.c:1028       No GNSS fix yet
[May 21 19:34:25.134] Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[May 21 19:34:25.139] Core 0 register dump:
[May 21 19:34:25.139] PC      : 0x40144471  PS      : 0x00060e30  A0      : 0x800fff3d  A1      : 0x3ffb4f80  
[May 21 19:34:25.150] A2      : 0x00000000  A3      : 0x3ffbae1c  A4      : 0x0000000e  A5      : 0x3ffbb008  
[May 21 19:34:25.157] A6      : 0x00000a0d  A7      : 0x52414320  A8      : 0x80144471  A9      : 0x3ffb4f60  
[May 21 19:34:25.161] A10     : 0x00000000  A11     : 0x3ffbae1c  A12     : 0x0000000e  A13     : 0x00000000  
[May 21 19:34:25.173] A14     : 0x0000000e  A15     : 0x0000000e  SAR     : 0x00000016  EXCCAUSE: 0x0000001c  
[May 21 19:34:25.178] EXCVADDR: 0x00000028  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
[May 21 19:34:25.190] 
[May 21 19:34:25.190] Backtrace: 0x40144471 0x400fff3a 0x400fff4d 0x400fffeb 0x400e38b8 0x4017e0dd 0x4008398a 0x40083b25
[May 21 19:34:25.195] 
[May 21 19:34:25.195] --- BEGIN CORE DUMP ---
[May 21 19:34:25.200] mos: catching core dump
[May 21 19:34:28.057] .............
[May 21 19:35:05.083] ---- END CORE DUMP ----

It seems to me that the loop is not running the GPS AT commands every second but is instead running some other AT commands together. May I know how exactly the PPPOP library handles the connections? It seems to be core dumping everytime the below happens.

[May 21 19:34:22.326] mgos_pppos.c:189        Error 6 (phase 0), reconnect
[May 21 19:34:22.326] mgos_net.c:85           PPP: connecting

mgos_pppos.c:189

mos analyzes the core dump if you run mos console in the root directory of your firmware. It needs docker to be installed.

The received sentence looks like it does not match at all with the format arguments.
I’d suggest to check its format before using sscanf.

Also modify

LOG(LL_INFO, (“Scan Sentence %s”, data.p));

into

LOG(LL_INFO, (“Scan Sentence %.*s”, data.len, data.p));

to have the string logged correctly.

The console is showing this after the core dump

[May 23 16:32:29.787] mgos_pppos.c:189        Error 6 (phase 0), reconnect
[May 23 16:32:29.787] mgos_net.c:85           PPP: connecting
[May 23 16:32:30.657] main.c:29               Timer test
[May 23 16:32:31.656] main.c:29               Timer test
[May 23 16:32:32.365] mgos_pppos.c:1015       What is ok 1
[May 23 16:32:32.365] mgos_pppos.c:1022       Scan Sentence $GPSACP: 083232.000,0305.3024N,10137.9435E,0.6,27.0,3,215.6,0.0,0.0,230519,09,05
[May 23 16:32:32.377] mgos_pppos.c:1023       What is fix 0
[May 23 16:32:32.382] mgos_pppos.c:1028       No GNSS fix yet
[May 23 16:32:32.396] Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[May 23 16:32:32.402] Core 0 register dump:
[May 23 16:32:32.402] PC      : 0x401444d5  PS      : 0x00060e30  A0      : 0x800fff9d  A1      : 0x3ffb4f60  
[May 23 16:32:32.412] A2      : 0x00000000  A3      : 0x3ffbae40  A4      : 0x0000000e  A5      : 0x3ffbaf9c  
[May 23 16:32:32.419] A6      : 0x00000a0d  A7      : 0x52414320  A8      : 0x801444d5  A9      : 0x3ffb4f40  
[May 23 16:32:32.423] A10     : 0x00000000  A11     : 0x3ffbae40  A12     : 0x0000000e  A13     : 0x00000000  
[May 23 16:32:32.435] A14     : 0x0000000e  A15     : 0x0000000e  SAR     : 0x00000017  EXCCAUSE: 0x0000001c  
[May 23 16:32:32.440] EXCVADDR: 0x00000028  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
[May 23 16:32:32.452] 
[May 23 16:32:32.452] Backtrace: 0x401444d5 0x400fff9a 0x400fffad 0x4010004b 0x400e38b8 0x4017e141 0x4008398a 0x40083b25
[May 23 16:32:32.457] 
[May 23 16:32:32.457] --- BEGIN CORE DUMP ---
[May 23 16:32:32.462] mos: catching core dump
[May 23 16:32:35.319] .............
[May 23 16:33:12.346] ---- END CORE DUMP ----
[May 23 16:33:12.371] mos: wrote to c:\mos\orion-test-firmware\PPPOS_GNSS\core-PPPOS_GNSS-esp32-20190523-163312.526210411 (459475 bytes)
[May 23 16:33:12.394] mos: analyzing core dump
Core dump by PPPOS_GNSS/esp32 1.0 20190523-071306/g93f3b6a-master-dirty
Using ELF file at: c:\mos\orion-test-firmware\PPPOS_GNSS\build\objs\PPPOS_GNSS.elf
Using Docker image: docker.io/mgos/esp32-build:3.2-r6
Running docker run --rm -v /c/mos/orion-test-firmware/PPPOS_GNSS/build/objs/PPPOS_GNSS.elf:/fw.elf -v /c/mos/orion-test-firmware/PPPOS_GNSS/core-PPPOS_GNSS-esp32-20190523-163312.526210411:/core -v c:\mos\orion-test-firmware\PPPOS_GNSS:/c/mos/orion-test-firmware/PPPOS_GNSS docker.io/mgos/esp32-build:3.2-r6 bash -c /usr/local/bin/serve_core.py --rom=/opt/Espressif/rom/rom.bin --rom_addr=0x40000000 --xtensa_addr_fixup=true /fw.elf /core & $MGOS_TARGET_GDB /fw.elf -ex 'target remote 127.0.0.1:1234' -ex 'set confirm off' -ex bt -ex quit
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /fw.elf...done.
Remote debugging using 127.0.0.1:1234
pppos_input_tcpip (ppp=0x0, 
    s=0x3ffbae40 "\r\nNO CARRIER\r\n232.000,0305.3024N,10137.9435E,0.6,27.0,3,215.6,0.0,0.0,230519,09,05\r\n\r\nOK\r\nL*\021\257\373?\210\265\373?\230\257\373?_pppos.c:189        Error 6 (phase 0), reconnect\n\256\373?", 
    l=<optimized out>)
    at /opt/Espressif/esp-idf/components/lwip/lwip/src/netif/ppp/pppos.c:421
421	  err = tcpip_inpkt(p, ppp_netif(ppp), pppos_input_sys);
#0  pppos_input_tcpip (ppp=0x0, 
    s=0x3ffbae40 "\r\nNO CARRIER\r\n232.000,0305.3024N,10137.9435E,0.6,27.0,3,215.6,0.0,0.0,230519,09,05\r\n\r\nOK\r\nL*\021\257\373?\210\265\373?\230\257\373?_pppos.c:189        Error 6 (phase 0), reconnect\n\256\373?", 
    l=<optimized out>)
    at /opt/Espressif/esp-idf/components/lwip/lwip/src/netif/ppp/pppos.c:421
#1  0x400fff9d in mgos_pppos_dispatch_once (pd=0x3ffc23c0)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/pppos/src/mgos_pppos.c:769
#2  0x400fffb0 in mgos_pppos_dispatch (pd=0x3ffc23c0)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/pppos/src/mgos_pppos.c:779
#3  0x4010004e in mgos_pppos_uart_dispatcher (uart_no=<optimized out>, 
    arg=0x3ffc23c0)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/pppos/src/mgos_pppos.c:805
#4  0x400e38bb in mgos_uart_dispatcher (arg=0x2)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/modules/mongoose-os/src/mgos_uart.c:69
#5  0x4017e144 in mongoose_poll (ms=0)
    at /data/tmp/mos_prebuild/tmp/cesanta/mos-libs/mongoose/src/mgos_mongoose.c:55
#6  0x4008398d in mgos_mg_poll_cb (arg=<optimized out>)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/freertos/src/mgos_freertos.c:101
#7  0x40083b28 in mgos_task (arg=<optimized out>)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/freertos/src/mgos_freertos.c:220
Detaching from program: /fw.elf, Remote target
Found core at 23 - 459426
Mapping DRAM: 335872 @ 0x3ffae000
Mapping /opt/Espressif/rom/rom.bin at 0x40000000
Mapping /fw.elf .rtc.text: 52 @ 0x400c0000
Mapping /fw.elf .rtc.dummy: 52 @ 0x3ff80000
Mapping /fw.elf .iram0.vectors: 1024 @ 0x40080000
Mapping /fw.elf .iram0.text: 70333 @ 0x40080400
Mapping /fw.elf .dram0.data: 10156 @ 0x3ffb0000
Mapping /fw.elf .dram0.bss: 32832 @ 0x3ffb27b0
Mapping /fw.elf .flash.rodata: 164836 @ 0x3f400020
Mapping /fw.elf .flash.text: 792922 @ 0x400d0018
Loaded core dump from last snippet in  /core
GDB closed the connection
Waiting for gdb on 1234
Dump contains FreeRTOS task info
Ending remote debugging.
[May 23 16:33:19.894] Rebooting...

Is this the core dump analysis? Are there any tools available to help us understand it better?

The sscanf string is now being logged correctly. Am looking into the format arguments.

I’ve just realized that you added your custom commands in mgos_pppos.c.
Don’t do it. If the library is updated upstream, the local code will not be updated and you can miss bug fixes or new functionality.

The custom commands should be in your application’s code, e.g. in main.c

Yes, this is the core dump analysis and it shows the sequnce of calls which led to the core dump.

Hi nliviu, thanks for the support so far. I have moved it to main.c but am still seeing a core dump happening at the same place

#include "mgos.h"
#include "mgos_pppos.h"
#include "math.h"

struct mgos_pppos_cmd cmds[] = {
        // {.cmd = "AT$GPSP=0"},  
        // {.cmd = "AT$GPSP=1"},  
        {.cmd = "AT$GPSACP", .cb = gnsinf_cb},
        {.cmd = NULL},
 };

bool gnsinf_cb(void *cb_arg, bool ok, struct mg_str data)
{
  LOG(LL_INFO, ("What is ok %d", ok));
  if (!ok)
    return false;
  int fix = 0;
  char ns, ew;
  float time = 0, lon = 0, hdop = 0, alt = 0, speed = 0, course = 0, lat = 0;
  //  $GPSACP: 095903.000,0305.3127N,10137.9417E,0.6,87.0,3,292.1,0.0,0.0,230519,10,05
  sscanf(data.p, "$GPSACP: %f,%f%c,%f%c,%f,%f,%d,%f,%f",
         &time, &lat, &ns, &lon, &ew, &hdop, &alt, &fix, &course, &speed);
  // LOG(LL_INFO, ("Scan Sentence %.*s", data.len, data.p));
  LOG(LL_INFO, ("What is fix %d\n", fix));
  // LOG(LL_INFO, ("What is time %f\n", time));
  // LOG(LL_INFO, ("What is lat %f\n", lat));
  // LOG(LL_INFO, ("What is ns %c\n", ns));
  // LOG(LL_INFO, ("What is lon %f\n", lon));

  if (fix > 2)
  {
    if (ns == 'S')
    {
      lat *= -1.0;
    }
    if (ew == 'W')
    {
      lon *= -1.0;
    }
    float degrees = trunc(lat / 100.0f);
    float minutes = lat - (degrees * 100.0f);
    lat = degrees + minutes / 60.0f;
    degrees = trunc(lon / 100.0f);
    minutes = lon - (degrees * 100.0f);
    lon = degrees + minutes / 60.0f;
   

    LOG(LL_INFO, ("lat,lon: %f,%f alt: %.3f speed: %.2f course: %.2f",
                  lat, lon, alt, speed, course));
  }
  else
  {
    LOG(LL_INFO, ("No GNSS fix yet"));
  }
  (void)cb_arg;
  return true;
}

static void gps_cb (void *gps) {
    LOG(LL_INFO, ("Timer test"));
    mgos_pppos_run_cmds(0, gps);
}

enum mgos_app_init_result mgos_app_init(void) {

LOG(LL_INFO, ("\n\n\n\nDoes it work?"));

// Retrieve GNSS status from SimCom GPS-capable modem:

 
    // mgos_pppos_run_cmds(0, cmds);

    LOG(LL_INFO, ("Yes it does\n\n\n\n"));

    mgos_set_timer(5000, true, gps_cb, cmds);

  return MGOS_APP_INIT_SUCCESS;
}

The core dump happens when connection to the network is lost. I have simulated this by changing AT+COPS=2 to deregister from the network and the system core dumps as soon as that happens. After it reboots, it outputs the “not connected to mobile network” printout until connection is re-established. The code runs fine until another

[May 24 16:47:44.644] mgos_pppos.c:215        Error 6 (phase 0), reconnect
[May 24 16:47:44.644] mgos_net.c:85           PPP: connecting

happens again. I am quite stumped to why this is happening right now. Is there any other sample code that we can refer to or any proposed solutions to this problem?

Below is the console output

[May 24 16:47:43.565] main.c:82               Timer test
[May 24 16:47:44.644] mgos_pppos.c:215        Error 6 (phase 0), reconnect
[May 24 16:47:44.644] mgos_net.c:85           PPP: connecting
[May 24 16:47:47.170] main.c:31               What is ok 1
[May 24 16:47:47.170] main.c:41               What is fix 3
[May 24 16:47:47.175] 
[May 24 16:47:47.175] main.c:66               lat,lon: 3.088380,101.632370 alt: 68.100 speed: 0.00 course: 189.40
[May 24 16:47:47.194] Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.
[May 24 16:47:47.199] Core 0 register dump:
[May 24 16:47:47.199] PC      : 0x40144585  PS      : 0x00060e30  A0      : 0x80100179  A1      : 0x3ffb4f60  
[May 24 16:47:47.212] A2      : 0x00000000  A3      : 0x3ffc8f6c  A4      : 0x0000000e  A5      : 0x3ffbae40  
[May 24 16:47:47.217] A6      : 0x00000a0d  A7      : 0x52414320  A8      : 0x80144585  A9      : 0x3ffb4f40  
[May 24 16:47:47.221] A10     : 0x00000000  A11     : 0x3ffc8f6c  A12     : 0x0000000e  A13     : 0x00000000  
[May 24 16:47:47.233] A14     : 0x0000000e  A15     : 0x0000000e  SAR     : 0x00000015  EXCCAUSE: 0x0000001c  
[May 24 16:47:47.238] EXCVADDR: 0x00000028  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff  
[May 24 16:47:47.249] 
[May 24 16:47:47.249] Backtrace: 0x40144585 0x40100176 0x40100189 0x40100227 0x400e38b8 0x4017e269 0x4008398a 0x40083b25
[May 24 16:47:47.256] 
[May 24 16:47:47.256] --- BEGIN CORE DUMP ---
[May 24 16:47:47.262] mos: catching core dump
[May 24 16:47:50.116] .............
[May 24 16:48:27.145] ---- END CORE DUMP ----
[May 24 16:48:27.152] mos: wrote to c:\mos\orion-test-firmware\PPPOS_GNSS\core-PPPOS_GNSS-esp32-20190524-164827.617415983 (459473 bytes)
[May 24 16:48:27.163] mos: analyzing core dump
Core dump by PPPOS_GNSS/esp32 1.0 20190524-041338/g93f3b6a-master-dirty
Using ELF file at: c:\mos\orion-test-firmware\PPPOS_GNSS\build\objs\PPPOS_GNSS.elf
Using Docker image: docker.io/mgos/esp32-build:3.2-r6
Running docker run --rm -v /c/mos/orion-test-firmware/PPPOS_GNSS/build/objs/PPPOS_GNSS.elf:/fw.elf -v /c/mos/orion-test-firmware/PPPOS_GNSS/core-PPPOS_GNSS-esp32-20190524-164827.617415983:/core -v c:\mos\orion-test-firmware\PPPOS_GNSS:/c/mos/orion-test-firmware/PPPOS_GNSS docker.io/mgos/esp32-build:3.2-r6 bash -c /usr/local/bin/serve_core.py --rom=/opt/Espressif/rom/rom.bin --rom_addr=0x40000000 --xtensa_addr_fixup=true /fw.elf /core & $MGOS_TARGET_GDB /fw.elf -ex 'target remote 127.0.0.1:1234' -ex 'set confirm off' -ex bt -ex quit
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /fw.elf...done.
Remote debugging using 127.0.0.1:1234
pppos_input_tcpip (ppp=0x0, 
    s=0x3ffc8f6c "\r\nNO CARRIER\r\n747.000,0305.3028N,10137.9424E,0.7,68.1,3,189.4,0.0,0.0,240519,08,03\r\n\r\nOK\r\n\374?\325\217\374?\004\230\374?", 
    l=<optimized out>)
    at /opt/Espressif/esp-idf/components/lwip/lwip/src/netif/ppp/pppos.c:421
421	  err = tcpip_inpkt(p, ppp_netif(ppp), pppos_input_sys);
#0  pppos_input_tcpip (ppp=0x0, 
    s=0x3ffc8f6c "\r\nNO CARRIER\r\n747.000,0305.3028N,10137.9424E,0.7,68.1,3,189.4,0.0,0.0,240519,08,03\r\n\r\nOK\r\n\374?\325\217\374?\004\230\374?", 
    l=<optimized out>)
    at /opt/Espressif/esp-idf/components/lwip/lwip/src/netif/ppp/pppos.c:421
#1  0x40100179 in mgos_pppos_dispatch_once (pd=0x3ffc233c)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/pppos/src/mgos_pppos.c:926
#2  0x4010018c in mgos_pppos_dispatch (pd=0x3ffc233c)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/pppos/src/mgos_pppos.c:938
#3  0x4010022a in mgos_pppos_uart_dispatcher (uart_no=<optimized out>, 
    arg=0x3ffc233c)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/pppos/src/mgos_pppos.c:971
#4  0x400e38bb in mgos_uart_dispatcher (arg=0x2)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/modules/mongoose-os/src/mgos_uart.c:69
#5  0x4017e26c in mongoose_poll (ms=0)
    at /data/tmp/mos_prebuild/tmp/cesanta/mos-libs/mongoose/src/mgos_mongoose.c:55
#6  0x4008398d in mgos_mg_poll_cb (arg=<optimized out>)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/freertos/src/mgos_freertos.c:101
#7  0x40083b28 in mgos_task (arg=<optimized out>)
    at /c/mos/orion-test-firmware/PPPOS_GNSS/deps/freertos/src/mgos_freertos.c:220
Detaching from program: /fw.elf, Remote target
Found core at 23 - 459424
Mapping DRAM: 335872 @ 0x3ffae000
Mapping /opt/Espressif/rom/rom.bin at 0x40000000
Mapping /fw.elf .rtc.text: 52 @ 0x400c0000
Mapping /fw.elf .rtc.dummy: 52 @ 0x3ff80000
Mapping /fw.elf .iram0.vectors: 1024 @ 0x40080000
Mapping /fw.elf .iram0.text: 70333 @ 0x40080400
Mapping /fw.elf .dram0.data: 10156 @ 0x3ffb0000
Mapping /fw.elf .dram0.bss: 32832 @ 0x3ffb27b0
Mapping /fw.elf .flash.rodata: 164812 @ 0x3f400020
Mapping /fw.elf .flash.text: 793218 @ 0x400d0018
Loaded core dump from last snippet in  /core
GDB closed the connection
Waiting for gdb on 1234
Dump contains FreeRTOS task info
Ending remote debugging.
[May 24 16:48:33.816] Rebooting...
[May 24 16:48:33.816] ets Jun  8 2016 00:22:57
[May 24 16:48:33.816] 
[May 24 16:48:33.816] rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[May 24 16:48:33.816] configsip: 0, SPIWP:0xee
[May 24 16:48:33.816] clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[May 24 16:48:33.816] mode:DIO, clock div:1
[May 24 16:48:33.816] load:0x3fff0018,len:4
[May 24 16:48:33.816] load:0x3fff001c,len:6188
[May 24 16:48:33.816] load:0x40078000,len:9588
[May 24 16:48:33.816] load:0x40080400,len:6968
[May 24 16:48:33.816] entry 0x40080740
[May 24 16:48:33.816] e[0;32mI (29) boot: ESP-IDF v3.2-r6 2nd stage bootloadere[0m
[May 24 16:48:33.816] e[0;32mI (29) boot: compile time 06:38:46e[0m
[May 24 16:48:33.816] e[0;32mI (29) boot: Enabling RNG early entropy source...e[0m
[May 24 16:48:33.816] e[0;32mI (34) qio_mode: Enabling default flash chip QIOe[0m
[May 24 16:48:33.816] e[0;32mI (39) boot: SPI Speed      : 80MHze[0m
[May 24 16:48:33.816] e[0;32mI (43) boot: SPI Mode       : QIOe[0m
[May 24 16:48:33.816] e[0;32mI (47) boot: SPI Flash Size : 4MBe[0m
[May 24 16:48:33.816] e[0;32mI (51) boot: Partition Table:e[0m
[May 24 16:48:33.816] e[0;32mI (55) boot: ## Label            Usage          Type ST Offset   Length   Flagse[0m
[May 24 16:48:33.816] e[0;32mI (63) boot:  0 nvs              WiFi data        01 02 00009000 00004000 00000000e[0m
[May 24 16:48:33.816] e[0;32mI (71) boot:  1 otadata          OTA data         01 00 0000d000 00002000 00000000e[0m
[May 24 16:48:33.816] e[0;32mI (79) boot:  2 app_0            OTA app          00 10 00010000 00180000 00000000e[0m
[May 24 16:48:33.816] e[0;32mI (87) boot:  3 fs_0             SPIFFS           01 82 00190000 00040000 00000000e[0m
[May 24 16:48:33.816] e[0;32mI (96) boot:  4 app_1            OTA app          00 11 001d0000 00180000 00000000e[0m
[May 24 16:48:33.816] e[0;32mI (104) boot:  5 fs_1             SPIFFS           01 82 00350000 00040000 00000000e[0m
[May 24 16:48:33.816] e[0;32mI (112) boot: End of partition tablee[0m
[May 24 16:48:33.816] e[0;32mI (117) boot: OTA data 0: seq 0x00000001, st 0x10, CRC 0x157a2b85, valid? 1e[0m
[May 24 16:48:33.816] e[0;32mI (124) boot: OTA data 1: seq 0x00000000, st 0x00, CRC 0x00000000, valid? 0e[0m
[May 24 16:48:33.816] e[0;32mI (132) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x283cc (164812) mape[0m
[May 24 16:48:33.816] e[0;32mI (184) esp_image: segment 1: paddr=0x000383f4 vaddr=0x3ffb0000 size=0x027ac ( 10156) loade[0m
[May 24 16:48:33.816] e[0;32mI (187) esp_image: segment 2: paddr=0x0003aba8 vaddr=0x40080000 size=0x00400 (  1024) loade[0m
[May 24 16:48:33.816] e[0;32mI (191) esp_image: segment 3: paddr=0x0003afb0 vaddr=0x40080400 size=0x05060 ( 20576) loade[0m
[May 24 16:48:33.816] e[0;32mI (206) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0xc1a84 (793220) mape[0m
[May 24 16:48:33.816] e[0;32mI (415) esp_image: segment 5: paddr=0x00101aa4 vaddr=0x40085460 size=0x0c260 ( 49760) loade[0m
[May 24 16:48:33.816] e[0;32mI (430) esp_image: segment 6: paddr=0x0010dd0c vaddr=0x400c0000 size=0x00034 (    52) loade[0m
[May 24 16:48:33.816] e[0;32mI (441) boot: Loaded app from partition at offset 0x10000e[0m
[May 24 16:48:33.816] e[0;32mI (441) boot: Disabling RNG early entropy source...e[0m
[May 24 16:48:33.816] e[0;32mI (442) cpu_start: Pro cpu up.e[0m
[May 24 16:48:33.816] e[0;32mI (446) cpu_start: Single core modee[0m
[May 24 16:48:33.816] e[0;32mI (450) heap_init: Initializing. RAM available for dynamic allocation:e[0m
[May 24 16:48:33.816] e[0;32mI (457) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAMe[0m
[May 24 16:48:33.816] e[0;32mI (463) heap_init: At 3FFBA7F0 len 00025810 (150 KiB): DRAMe[0m
[May 24 16:48:33.816] e[0;32mI (469) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAMe[0m
[May 24 16:48:33.816] e[0;32mI (476) heap_init: At 40078000 len 00008000 (32 KiB): IRAMe[0m
[May 24 16:48:33.816] e[0;32mI (482) heap_init: At 400916C0 len 0000E940 (58 KiB): IRAMe[0m
[May 24 16:48:33.816] e[0;32mI (488) cpu_start: Pro cpu start user codee[0m
[May 24 16:48:33.816] e[0;32mI (170) cpu_start: Starting scheduler on PRO CPU.e[0m
[May 24 16:48:33.816] 
[May 24 16:48:33.816] 
[May 24 16:48:33.816] mgos_freertos.c:175     PPPOS_GNSS 1.0 (20190524-041338/g93f3b6a-master-dirty)
[May 24 16:48:33.816] mgos_freertos.c:177     Mongoose OS 201905221818 (20190523-065926/2.14.0-1-gaee6b1d-master)
[May 24 16:48:33.816] mgos_freertos.c:181     CPU: 160 MHz, FreeRTOS 8.2.0, heap: 289560 total, 257584 free
[May 24 16:48:33.816] mgos_freertos.c:183     Newlib 2.2.0
[May 24 16:48:33.816] esp32_main.c:116        ESP-IDF v3.2-r6
[May 24 16:48:33.816] esp32_main.c:119        Boot partition: app_0; flash: 4M
[May 24 16:48:33.816] mg_lwip_ev_mgr.c:93     Mongoose 6.14, LwIP 2.0.3
[May 24 16:48:33.816] mg_ssl_if_mbedtls.c:57  mbed TLS 2.16.0-cesanta4
[May 24 16:48:33.816] mgos_vfs_dev.c:73       fs_0: esp32part ({"label": "fs_0"}), size 262144
[May 24 16:48:33.816] mgos_vfs_dev.c:73       fs_1: esp32part ({"label": "fs_1"}), size 262144
[May 24 16:48:33.816] mgos_vfs.c:147          /: SPIFFS @ fs_0, opts {"bs": 4096, "ps": 256, "es": 4096}
[May 24 16:48:33.816] mgos_vfs.c:320          /: size 233681, used: 96133, free: 137548
[May 24 16:48:33.816] mgos_sys_config.c:368   MAC: 24:0a:c4:1c:a8:48
[May 24 16:48:33.816] mgos_sys_config.c:376   WDT: 30 seconds
[May 24 16:48:33.816] mgos_pppos.c:1136       PPPoS UART2 (RX:16 TX:17 CTS:14 RTS:15), 115200, fc off, APN 'diginet'
[May 24 16:48:33.816]  mgos_rpc_channel_ua:313 0x3ffc2808 UART0
[May 24 16:48:33.816] mgos_wifi.c:458         WiFi mode: AP
[May 24 16:48:33.816] esp32_wifi.c:196        WiFi mode: AP
[May 24 16:48:33.816] I (691) wifi: wifi driver task: 3ffc3ec4, prio:23, stack:3584, core=0
[May 24 16:48:33.816] I (691) wifi: wifi firmware version: 2af77cc
[May 24 16:48:33.816] I (701) wifi: config NVS flash: enabled
[May 24 16:48:33.816] I (701) wifi: config nano formating: disabled
[May 24 16:48:33.816] I (711) wifi: Init dynamic tx buffer num: 32
[May 24 16:48:33.816] I (711) wifi: Init data frame dynamic rx buffer num: 64
[May 24 16:48:33.818] I (721) wifi: Init management frame dynamic rx buffer num: 64
[May 24 16:48:33.818] I (721) wifi: Init management short buffer num: 32
[May 24 16:48:33.818] I (731) wifi: Init static rx buffer size: 1600
[May 24 16:48:33.818] I (731) wifi: Init static rx buffer num: 10
[May 24 16:48:33.818] I (741) wifi: Init dynamic rx buffer num: 0
[May 24 16:48:33.818] e[0;32mI (801) phy: phy_version: 4008, 544f89f, Jan 24 2019, 14:54:06, 0, 0e[0m
[May 24 16:48:33.818] I (801) wifi: mode : softAP (24:0a:c4:1c:a8:49)
[May 24 16:48:33.818] I (811) wifi: Total power save buffer number: 16
[May 24 16:48:33.818] I (821) wifi: Init max length of beacon: 752/752
[May 24 16:48:33.818] I (821) wifi: Init max length of beacon: 752/752
[May 24 16:48:33.818] I (831) wifi: Set ps type: 0
[May 24 16:48:33.818] 
[May 24 16:48:33.818] esp32_wifi.c:442        WiFi AP: SSID Mongoose_1CA848, channel 6
[May 24 16:48:33.818] I (1671) wifi: Total power save buffer number: 16
[May 24 16:48:33.818] esp32_wifi.c:492        WiFi AP IP: 192.168.4.1/255.255.255.0 gw 192.168.4.1, DHCP range 192.168.4.2 - 192.168.4.100
[May 24 16:48:33.818] esp32_wifi.c:497        WiFi AP: SSID Mongoose_1CA848, channel 6
[May 24 16:48:33.818] main.c:88               
[May 24 16:48:33.818] 
[May 24 16:48:33.818] 
[May 24 16:48:33.818] 
[May 24 16:48:33.818] Does it work?
[May 24 16:48:33.818] main.c:95               Yes it does
[May 24 16:48:33.818] 
[May 24 16:48:33.818] 
[May 24 16:48:33.818] 
[May 24 16:48:33.818] 
[May 24 16:48:33.818] mgos_init.c:36          Init done, RAM: 288892 total, 221736 free, 221508 min free
[May 24 16:48:33.818] mgos_mongoose.c:66      New heap free LWM: 217212
[May 24 16:48:33.818] mgos_net.c:85           PPP: connecting
[May 24 16:48:33.818] mgos_net.c:85           PPP: connecting
[May 24 16:48:33.818] mgos_pppos.c:727        Connecting (UART2, APN 'diginet')...
[May 24 16:48:33.818] mgos_pppos.c:301        332, IMEI: 
[May 24 16:48:33.818] mgos_pppos.c:388        SIM is ready, IMSI: , ICCID: 
[May 24 16:48:33.818] mgos_pppos.c:454        Not connected to mobile network, status 0 (idle)
[May 24 16:48:33.818] mgos_pppos.c:454        Not connected to mobile network, status 0 (idle)
[May 24 16:48:33.936] main.c:82               Timer test
[May 24 16:48:34.556] mgos_pppos.c:454        Not connected to mobile network, status 0 (idle)
[May 24 16:48:35.657] mgos_pppos.c:454        Not connected to mobile network, status 0 (idle)

Your mgos_pppos.c looks heavily modified:
line 215: mgos_pppos.c:215 Error 6 (phase 0), reconnect
The github code has this log message at line 189

There might be a bug in the library.
Delete the deps directory, rebuild, collect the logs and file an issue against the pppos library

The only part of the mgos_pppos.c that i modified is at line 640. Where I changed

add_cmd(pd, NULL, "AT+CGDCONT=1,\"IP\",\"%s\"", pd->cfg->apn);

to

add_cmd(pd, NULL, "AT+CGDCONT?");

I am doing this because the Telit modem I’m using gives me an error with the AT+CGDCONT=1 command. The device still connects fine to the network as I had preset the necessary APN’s at the modem level.

I have done a fresh build with the latest libraries and am seeing the same issue. Have filed an issue against the pppos library here

Hi I found that when I run this part of the GNSS code

struct mgos_pppos_cmd cmds[] = {
    // {.cmd = "AT$GPSP=0"},
    // {.cmd = "AT$GPSP=1"},
    {.cmd = "AT$GPSACP", .cb = gnsinf_cb},
    {.cmd = NULL},
};

it also runs this block of code from mgos_pppos.c Line 879 to 906

bool mgos_pppos_run_cmds(int if_instance, const struct mgos_pppos_cmd *cmds) {
  if (cmds == NULL) return false;
  struct mgos_pppos_data *pd;
  SLIST_FOREACH(pd, &s_pds, next) {
    if (pd->if_instance == if_instance) break;
  }
  if (pd == NULL || pd->cmds != NULL) return false;
  /* Insert ATE0 at the beginning. */
  add_cmd2(pd, strdup("AT"), NULL, NULL);
  const struct mgos_pppos_cmd *cmd = cmds;
  while (true) {
    if (cmd->cmd != NULL) {
      add_cmd2(pd, strdup(cmd->cmd), cmd->cb, cmd->cb_arg);
      cmd++;
      LOG(LL_INFO, ("Running add_cmd2(pd, strdup(cmd->cmd), cmd->cb, cmd->cb_arg) : LINE 890)"));
    } else {
      add_cmd2(pd, NULL, cmd->cb, cmd->cb_arg);
      LOG(LL_INFO, ("Running add_cmd2(pd, NULL, cmd->cb, cmd->cb_arg) : LINE 894)"));
      break;
    }
  }
  LOG(LL_DEBUG, ("Begin user command seq, state: %d", pd->state));
  pd->cmd_success_state = pd->state;
  pd->cmd_error_state = pd->state;
  mgos_pppos_set_state(pd, PPPOS_START_SEQ);
  mgos_pppos_dispatch_once(pd);
  return true;
}

Shown by my console logs

[Jun  4 16:55:39.398] mgos_pppos.c:893        Running add_cmd2(pd, strdup(cmd->cmd), cmd->cb, cmd->cb_arg) : LINE 890)
[Jun  4 16:55:39.404] mgos_pppos.c:896        Running add_cmd2(pd, NULL, cmd->cb, cmd->cb_arg) : LINE 894)
[Jun  4 16:55:39.435] Published 
[Jun  4 16:55:45.398] mgos_pppos.c:893        Running add_cmd2(pd, strdup(cmd->cmd), cmd->cb, cmd->cb_arg) : LINE 890)
[Jun  4 16:55:45.404] mgos_pppos.c:896        Running add_cmd2(pd, NULL, cmd->cb, cmd->cb_arg) : LINE 894)
[Jun  4 16:55:45.435] Published 

May I know why this is happening and if there is anyway to just run the AT commands for GPS instead of running the entire command list?