How to set the cellular APN on nRF9160 with AWS IoT sample?

Hi,

Starting from the AWS IoT sample, I’m having a hard time configuring the connection before calling net_if_up() which abstracts a lot of stuff. I would like to configure the APN and authentication information. I have tried enabling the PDN library and calling pdn_ctx_configure() (and pdn_ctx_auth_set()), but whatever APN I give it (“ibasis.iot” in my case, with the SIM shipped with the nRF9160DK) stops the network connection. Here is the AT_HOST log I’m getting:

[00:00:04.934,082] <dbg> pdn: on_cfun: Subscribing to +CNEC=16 and +CGEREP=1
+CEREG: 2,"7F1A","08561906",7
+CSCON: 1
+CNEC_ESM: 33,0 (Requested service option not subscribed)
+CEREG: 2,"7F1A","08561906",7,0,19
+CSCON: 0
+CEREG: 2,"BEB8","09743A06",7
+CSCON: 1
+CNEC_ESM: 27,0
+CEREG: 2,"BEB8","09743A06",7,0,19
+CSCON: 0
…

When I’m not calling pdn_ctx_configure(), I’m getting this log instead:

com
[00:00:04.926,879] <dbg> pdn: on_cfun: Subscribing to +CNEC=16 and +CGEREP=1
+CEREG: 2,"7F1A","08561906",7
+CSCON: 1
+CGEV: ME PDN ACT 0,0
+CNEC_ESM: 50,0 (PDN type IPv4 only allowed)
+CEREG: 5,"7F1A","08561906",7,,,"11100000","11100000"
[00:00:19.462,951] <inf> aerobox_network: Got an IP address:
[00:00:19.463,256] <inf> aerobox_network: Network connectivity established

I don’t have an easy access to the modem trace alongside the terminal as I am running on a custom board with only one VCOM.

Am I missing something? Do I need to redo everything according to the PDN sample? In that case will the rest of the code properly work (sockets calls and such)?

Thanks!

Related