How to configure the nRF9160 to use NB-IoT by default

Description

My network only supports NB-IoT, and I noticed that every time the device connects to the network, the following logs appear, and the wait time is quite long. It usually takes several minutes to connect to the Golioth server.

[00:00:00.536,224] <inf> golioth_samples: Bringing up network interface
[00:00:00.536,224] <inf> golioth_samples: Waiting to obtain IP address
[00:02:34.789,428] <inf> lte_monitor: Network: Searching
[00:02:37.051,910] <inf> lte_monitor: Network: Registered (roaming)

So I suspect that the Golioth connection mode might be trying LTE-M first and then falling back to NB-IoT for network access.

I also tried adding the following configuration to prj.conf, but it didn’t solve the issue of long connection times.

CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=n
CONFIG_LTE_NETWORK_MODE_NBIOT_GPS=y
CONFIG_PDN=y
CONFIG_PDN_LEGACY_PCO=y

Expected Behavior

It is possible to configure the default network mode to NB-IoT.

Actual Behavior

It takes a very long time to connect to the Golioth server.

Environment

*** Booting My Application v1.2.5-1603e1689b71 ***
*** Using nRF Connect SDK v3.0.1-9eb5615da66b ***
*** Using Zephyr OS v4.0.99-77f865b8f8d0 ***
*** Golioth Firmware SDK v0.18.0 ***

Logs and Console Output

[00:00:00.536,224] golioth_samples: Bringing up network interface
[00:00:00.536,224] golioth_samples: Waiting to obtain IP address
[00:02:34.789,428] lte_monitor: Network: Searching
[00:02:37.051,910] lte_monitor: Network: Registered (roaming)

@Jack to determine whether your NB-IoT preference configuration is taking effect, I’d recommend checking out our post on Troubleshooting IoT Cellular Connections with Nordic nRF9160.

Thank you very much for your sharing.
Previously, I had already used the at_client firmware and successfully configured the device to NB-IoT mode using AT commands.

However, in the Zephyr project, adding CONFIG_LTE_NETWORK_MODE_NBIOT=y to prj.conf still had no effect.

Referring to the following method, it still takes a very long time to connect to the network. :rofl:
switch-between-cellular-standard-in-zephyr

[00:00:00.535,919] <inf> golioth_samples: Bringing up network interface
[00:00:00.535,919] <inf> golioth_samples: Waiting to obtain IP address
[00:01:11.900,756] <inf> lte_monitor: Network: Searching
[00:01:14.754,272] <inf> lte_monitor: Network: Registered (roaming)