NRF9160: PDN Library, default APN error

Hello,

i am trying to set a default apn to a project with the NRF9160 and the NRF Connect SDK 2.4.2.  For this i added the following entries to the prj.conf:

CONFIG_PDN=y
CONFIG_PDN_DEFAULTS_OVERRIDE=y
CONFIG_PDN_DEFAULT_APN="telstra.m2m"

But after startup i got the following error messages and the APN seems not to be set:

[00:00:00.608,917] <err> pdn: Failed to configure CID 0, err, 65536
[00:00:00.608,947] <err> pdn: Failed to configure default CID, err -8

From what i can see in the pdn.c file the error is, that the nrf_modem_at_printf call returns -1, which means the modem_lib is not initalised ? But the pdn lib seem to be automatically startet with the NRF_MODEM_LIB_ON_INIT macro.

Other Issue tell about setting CONFIG_PDN_SYS_INIT to n and manually initing the libabry, but that seems to be an old config entry which is not available on NRF Connect SDK 2.4.2 anymore ?

Any help is appreciated,

kind regards,

Dominik

Parents
  • Hello,

    i also tried to update the SDK to 2.5.2 and tried the the PDN Sample. But i get a similar error:

    *** Booting nRF Connect SDK v2.5.2 ***
    PDN sample started
    [00:00:00.565,399] <err> lte_lc: Failed to configure RAI, err 65536
    Event: PDP context 0 activated
    Event: PDP context 0, PDN type IPv4 only allowed
    Default APN is lpwa.vodafone.com
    Created new PDP context 1
    [00:00:07.376,586] <err> pdn: Failed to configure CID 1, err, 65536
    pdn_ctx_configure() failed, err -8

    can you help me on what i need todo to succesfully set a default APN ?

  • Hello,

    i think i just found the error. The nrf_modem_at_printf comands in pdn.c are just wrong. According to the documentation for +CGDCONT the strings need to be encased in "". Which is missing in pdn.c of sdk 2.4.2 and 2.5.2.

    If i change the command to nrf_modem_at_printf("AT+CGDCONT=%u,\"%s\",\"%s\"", cid, family, apn); i do not get an error.

    Can you confirm that this is correct ?

  • Hello Michal,

    yes, if look at this file at line 410 it looks like this:

    nrf_modem_at_printf("AT+CGDCONT=%u,%s,%s", cid, family, apn);

    Which puts the strings into the +CGDCONT command without "" and it produces the error 65536 from my logs.

    According to https://infocenter.nordicsemi.com/index.jsp?topic=%2Fref_at_commands%2FREF%2Fat_commands%2Fpacket_domain%2Fcgdcont.html the strings should be enclosed in ""

    So if i change the line to nrf_modem_at_printf("AT+CGDCONT=%u,\"%s\",\"%s\"", cid, family, apn);   - lokk at the escaped "" chars.  Then the error goes away and it looks like the default apn is appiled.

    kind regards,

    Dominik Wenger

  • Normally it should work even without the quotation marks as well, could you also print it to UART and see what data do you get without the escaped chars?

    Also, are you using our PDN sample?

    Best regards,

    Michal

  • Hi,

    yes, as i wrote before, i also tried the pdn sample code (with SDK 2.5.2) and got the following output:

    *** Booting nRF Connect SDK v2.5.2 ***
    PDN sample started
    [00:00:00.565,399] <err> lte_lc: Failed to configure RAI, err 65536
    Event: PDP context 0 activated
    Event: PDP context 0, PDN type IPv4 only allowed
    Default APN is lpwa.vodafone.com
    Created new PDP context 1
    [00:00:07.376,586] <err> pdn: Failed to configure CID 1, err, 65536
    pdn_ctx_configure() failed, err -8

    Do you mean i should output the full string which is sent to nrf_modem_at_printf to uart ? My project only has RTT output, so i added a LOG_ERR("AT+CGDCONT=%u,%s,%s", cid, family, apn);

    The output is as follows

    [00:00:00.609,588] <err> pdn: AT+CGDCONT=0,IPV4V6,telstra.m2m
    [00:00:00.609,619] <err> pdn: Failed to configure CID 0, err, 65536

    As you can see, no extra "" and the at library responses with error 65536, so the modem lib here definitly does not accept the string without the "" around the strings.

    kind regards,

    Dominik

  • Thank you.

    I did some basic tests with Serial LTE Modem and the result was the same independent of the quotation marks or not.

    Are you able to send me your modified sample that is causing errors, so that I can try to do some debugging myself before forwarding it to the developers?

    Best regards,

    Michal

  • Hi,

    the pdn sample where i also get the error code is unmodified, apart from the prj.conf where i added for my RTT logging:

    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_BACKEND_RTT=y

    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG=y
    CONFIG_CONSOLE=n

    and for the default apn:

    CONFIG_PDN_DEFAULTS_OVERRIDE=y
    CONFIG_PDN_DEFAULT_APN="telstra.m2m"

    This error probably depends on the used modem library/ the library where nrf_modem_at_printf is implemented (not sure which lib that is and which part would need to be updated to get a new version). I only know i can not step into this function with the debugger and see where the error 65563 comes from.

    kind regards,

    Dominik

Reply
  • Hi,

    the pdn sample where i also get the error code is unmodified, apart from the prj.conf where i added for my RTT logging:

    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_BACKEND_RTT=y

    CONFIG_RTT_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG=y
    CONFIG_CONSOLE=n

    and for the default apn:

    CONFIG_PDN_DEFAULTS_OVERRIDE=y
    CONFIG_PDN_DEFAULT_APN="telstra.m2m"

    This error probably depends on the used modem library/ the library where nrf_modem_at_printf is implemented (not sure which lib that is and which part would need to be updated to get a new version). I only know i can not step into this function with the debugger and see where the error 65563 comes from.

    kind regards,

    Dominik

Children
Related