asset-tracker v2 on custom PCB/board - Device cannot connect to nRF Cloud, even after provisioning and flashing certificates

Hello,

I'm currently using the nrf9160 for a university project and I'm having problems with connecting my custom PCB with nrf9160 to nRF Cloud using the asset-tracker-v2 example. 

I tried flashing new certificates according to https://docs.nrfcloud.com/Guides/GettingStarted/Devices/#securely-generating-credentials-on-the-nrf9160 and have even used the Device Credentials Installer python script to flash certificates to SECTAG "16842753" (https://github.com/nRFCloud/utils/blob/master/python/modem-firmware-1.3%2B/device_credentials_installer.py) using UART. Non of these methods have allowed my PCB to connect to nRF Cloud, although that the certificate flashing has worked, through UART or through AT-Commands using nrf_modem_at_cmd() functions.

I have also provisioned the device using the provision.csv file, that is created using this script, and I can see the device, with the internal UUID of the modem in nRF Cloud, but a connection never gets established.

I have already tried the asset_tracker_v2 example on my other thingy91 board, and can see it in my nRF Cloud account and see its GPS Location and data and that it is connected (LTE icon is green).

I have set CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y in prf.conf file, in order use the internal UUID as stated in the above guide for nRF Cloud.

The Device gets an

[00:00:09.788,299] <dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_DISCONNECT: result = -128

error whenever it tries to connect to nRF Cloud. The connection to the internet works, since the download sample in the nrf9160 sample folder works correctly, and a test file gets downloaded correctly.

I am using a Hologram MFF2 Sim, that has a data plan. I can also see that my PCB can connect to the network (in hologram's dashboard) and data is being used successfully and the device can connect to the network (Telekom Deutschland over LTE-M in this case).

Is it even possible to use a custom PCB with the asset_tracker_v2? The board configuration files work correctly and I can compile and flash the asset_tracker_v2 application with some very small modifications like disabling the LEDs, since my custom board has no LEDs, otherwise the asset_tracker_v2 application is untouched. What am I doing wrong here? Are the certificates the problem? Or the Provisioning?

I am currently using CLion to compile, JLINK edu to flash my board and using nrf connect SDK 1.7.0

Here is a sample of RTT log I've captured (IP addresses and Cell IDs removed):

*** Booting Zephyr OS build v2.6.99-ncs1-1  ***

[00:00:00.202,545] <inf> event_manager: APP_EVT_START
[00:00:00.202,972] <dbg> modules_common.module_start: Module "gps" started
[00:00:00.203,430] <dbg> gps_module.state_set: State: STATE_INIT
[00:00:00.203,918] <dbg> modules_common.module_start: Module "ui" started
[00:00:00.204,345] <dbg> ui_module.state_set: State: STATE_ACTIVE
[00:00:00.204,772] <dbg> ui_module.sub_state_set: Sub state: SUB_STATE_GPS_INACTIVE
[00:00:00.205,322] <dbg> modules_common.module_start: Module "util" started
[00:00:00.205,780] <dbg> util_module.state_set: State: STATE_INIT
[00:00:00.206,268] <dbg> modules_common.module_start: Module "debug" started
[00:00:00.206,817] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: APP_EVT_START[0m
[00:00:00.207,458] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: APP_EVT_START
[00:00:00.208,099] <dbg> modules_common.[00:00:01.968,231] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_DISCONNECTED
[00:00:01.978,881] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:01.979,461] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_CONNECTING
[00:00:01.980,102] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_DISCONNECTED
[00:00:01.980,712] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.216,705] <inf> event_manager: MODEM_EVT_LTE_DISCONNECTED
[00:00:02.217,254] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: MODEM_EVT_LTE_DISCONNECTED
[00:00:02.217,987] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: MODEM_EVT_LTE_DISCONNECTED
[00:00:02.218,750] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: MODEM_EVT_LTE_DISCONNECTED
[00:00:02.219,482] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: MODEM_EVT_LTE_DISCONNECTED
[00:00:02.220,123] <dbg> modules_common.module_get_next_msg: app module: Dequeued MODEM_EVT_LTE_DISCONNECTED
[00:00:02.220,703] <dbg> modem_module.lte_evt_handler: LTE cell changed: Cell ID: XXXXXXX, Tracking area: XXXXX
[00:00:02.221,374] <inf> event_manager: MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.221,923] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.222,625] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.223,388] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.224,121] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.224,731] <dbg> modules_common.module_get_next_msg: app module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.225,433] <dbg> modules_common.module_get_next_msg: modem module: Dequeued MODEM_EVT_LTE_DISCONNECTED
[00:00:02.226,074] <dbg> modules_common.module_get_next_msg: modem module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.226,684] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_DISCONNECTED
[00:00:02.227,325] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.227,905] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_DISCONNECTED
[00:00:02.233,551] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:02.289,611] <dbg> modem_module.lte_evt_handler: RRC mode: Connected
[00:00:05.214,965] <dbg> modem_module.lte_evt_handler: Network registration status: Connected - roaming
[00:00:05.215,606] <inf> event_manager: MODEM_EVT_LTE_CONNECTED
[00:00:05.216,125] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: MODEM_EVT_LTE_CONNECTED
[00:00:05.216,857] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: MODEM_EVT_LTE_CONNECTED
[00:00:05.217,620] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: MODEM_EVT_LTE_CONNECTED
[00:00:05.218,353] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: MODEM_EVT_LTE_CONNECTED
[00:00:05.218,963] <dbg> modules_common.module_get_next_msg: app module: Dequeued MODEM_EVT_LTE_CONNECTED
[00:00:05.219,543] <dbg> modem_module.lte_evt_handler: PSM parameter update: TAU: -1, Active time: -1
[00:00:05.220,184] <inf> event_manager: MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.220,703] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.221,435] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.222,167] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.222,900] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.223,541] <dbg> modules_common.module_get_next_msg: app module: Dequeued MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.224,243] <dbg> modules_common.module_get_next_msg: modem module: Dequeued MODEM_EVT_LTE_CONNECTED
[00:00:05.224,792] <dbg> modem_module.state_set: State transition STATE_CONNECTING --> STATE_CONNECTED
[00:00:05.230,407] <dbg> modules_common.module_get_next_msg: modem module: Dequeued MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.231,018] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_CONNECTED
[00:00:05.231,628] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.232,238] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_CONNECTED
[00:00:05.232,788] <dbg> cloud_module.state_set: State transition STATE_LTE_DISCONNECTED --> STATE_LTE_CONNECTED
[00:00:05.233,367] <dbg> cloud_module.connect_cloud: Connecting to cloud
[00:00:05.233,795] <wrn> cloud_module: Cloud connection establishment in progress
[00:00:05.234,252] <wrn> cloud_module: New connection attempt in 32 seconds if not successful
[00:00:05.234,863] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_PSM_UPDATE
[00:00:05.235,443] <dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 1
[00:00:05.235,931] <dbg> nrf_cloud_integration.nrf_cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_CONNECTING
[00:00:05.352,294] <dbg> nrf_cloud_transport.nct_connect: IPv4 address: XX.XX.XX.XX
[00:00:05.352,783] <dbg> nrf_cloud_transport.nct_mqtt_connect: MQTT clean session flag: 1
[00:00:07.429,870] <dbg> nrf_cloud_transport.nct_mqtt_connect: Using socket send timeout of 60 seconds
[00:00:07.430,419] <dbg> nrf_cloud.nrf_cloud_run: Cloud connection request sent
[00:00:09.788,299] <dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_DISCONNECT: result = -128
[00:00:09.788,848] <dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 1
[00:00:09.789,337] <dbg> nrf_cloud_integration.nrf_cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED
[00:00:09.789,947] <dbg> cloud_module.cloud_wrap_event_handler: CLOUD_WRAP_EVT_DISCONNECTED
[00:00:09.790,527] <inf> event_manager: CLOUD_EVT_DISCONNECTED
[00:00:09.791,046] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:09.791,687] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:09.792,419] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:09.793,090] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:09.793,701] <dbg> modules_common.module_get_next_msg: app module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:09.794,311] <dbg> nrf_cloud.nrf_cloud_run: The cloud socket is already closed
[00:00:09.794,830] <dbg> modules_common.module_get_next_msg: data module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:09.795,440] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:09.796,020] <dbg> modules_common.module_get_next_msg: modem module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:21.600,372] <dbg> modem_module.lte_evt_handler: RRC mode: Idle
[00:00:24.162,261] <dbg> modem_module.lte_evt_handler: LTE cell changed: Cell ID: XXXXX, Tracking area: XXXXXX
[00:00:24.162,963] <inf> event_manager: MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.163,482] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.164,215] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.164,978] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.165,740] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.166,351] <dbg> modules_common.module_get_next_msg: app module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.167,083] <dbg> modules_common.module_get_next_msg: modem module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.167,694] <dbg> modules_common.module_get_next_msg: data module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:24.168,273] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued MODEM_EVT_LTE_CELL_UPDATE
[00:00:30.301,666] <dbg> watchdog.primary_feed_worker: Feeding watchdog
[00:00:37.234,863] <dbg> cloud_module.connect_check_work_fn: Cloud connection timeout occurred
[00:00:37.235,443] <inf> event_manager: CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.235,961] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.236,663] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.237,426] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.238,128] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.238,769] <dbg> modules_common.module_get_next_msg: app module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.239,379] <dbg> modules_common.module_get_next_msg: data module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.239,990] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.240,570] <dbg> cloud_module.connect_cloud: Connecting to cloud
[00:00:37.240,997] <wrn> cloud_module: Cloud connection establishment in progress
[00:00:37.241,485] <wrn> cloud_module: New connection attempt in 64 seconds if not successful
[00:00:37.242,034] <dbg> modules_common.module_get_next_msg: modem module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:00:37.247,650] <dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 1
[00:00:37.248,138] <dbg> nrf_cloud_integration.nrf_cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_CONNECTING
[00:00:37.255,340] <dbg> nrf_cloud_transport.nct_connect: IPv4 address: XXXXXXXXXX
[00:00:37.353,759] <dbg> modem_module.lte_evt_handler: RRC mode: Connected
[00:00:39.671,875] <dbg> nrf_cloud_transport.nct_mqtt_connect: Using socket send timeout of 60 seconds
[00:00:39.672,454] <dbg> nrf_cloud.nrf_cloud_run: Cloud connection request sent
[00:00:41.932,312] <dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_DISCONNECT: result = -128
[00:00:41.932,861] <dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 1
[00:00:41.933,349] <dbg> nrf_cloud_integration.nrf_cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED
[00:00:41.933,959] <dbg> cloud_module.cloud_wrap_event_handler: CLOUD_WRAP_EVT_DISCONNECTED
[00:00:41.934,539] <inf> event_manager: CLOUD_EVT_DISCONNECTED
[00:00:41.935,058] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:41.935,729] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:41.936,462] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:41.937,133] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:00:41.937,744] <dbg> modules_common.module_get_next_msg: app module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:41.938,354] <dbg> nrf_cloud.nrf_cloud_run: The cloud socket is already closed
[00:00:41.938,873] <dbg> modules_common.module_get_next_msg: data module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:41.939,483] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:41.940,063] <dbg> modules_common.module_get_next_msg: modem module: Dequeued CLOUD_EVT_DISCONNECTED
[00:00:53.457,916] <dbg> modem_module.lte_evt_handler: RRC mode: Idle
[00:01:00.302,185] <dbg> watchdog.primary_feed_worker: Feeding watchdog
[00:01:30.302,673] <dbg> watchdog.primary_feed_worker: Feeding watchdog
[00:01:41.242,095] <dbg> cloud_module.connect_check_work_fn: Cloud connection timeout occurred
[00:01:41.242,675] <inf> event_manager: CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.243,194] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.243,896] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.244,659] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.245,330] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.245,971] <dbg> modules_common.module_get_next_msg: app module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.246,582] <dbg> modules_common.module_get_next_msg: data module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.247,222] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.247,802] <dbg> cloud_module.connect_cloud: Connecting to cloud
[00:01:41.248,229] <wrn> cloud_module: Cloud connection establishment in progress
[00:01:41.248,718] <wrn> cloud_module: New connection attempt in 128 seconds if not successful
[00:01:41.249,298] <dbg> modules_common.module_get_next_msg: modem module: Dequeued CLOUD_EVT_CONNECTION_TIMEOUT
[00:01:41.249,877] <dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 1
[00:01:41.250,366] <dbg> nrf_cloud_integration.nrf_cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_CONNECTING
[00:01:41.355,773] <dbg> modem_module.lte_evt_handler: RRC mode: Connected
[00:01:41.793,975] <dbg> nrf_cloud_transport.nct_connect: IPv4 address: XXXXXXXXXXX
[00:01:43.823,760] <dbg> nrf_cloud_transport.nct_mqtt_connect: Using socket send timeout of 60 seconds
[00:01:43.824,340] <dbg> nrf_cloud.nrf_cloud_run: Cloud connection request sent
[00:01:46.198,364] <dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_DISCONNECT: result = -128
[00:01:46.198,913] <dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 1
[00:01:46.199,371] <dbg> nrf_cloud_integration.nrf_cloud_event_handler: NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED
[00:01:46.200,012] <dbg> cloud_module.cloud_wrap_event_handler: CLOUD_WRAP_EVT_DISCONNECTED
[00:01:46.200,561] <inf> event_manager: CLOUD_EVT_DISCONNECTED
[00:01:46.201,080] <dbg> modules_common.module_enqueue_msg: app module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:01:46.201,751] <dbg> modules_common.module_enqueue_msg: data module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:01:46.202,484] <dbg> modules_common.module_enqueue_msg: cloud module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:01:46.203,155] <dbg> modules_common.module_enqueue_msg: modem module: Enqueued: CLOUD_EVT_DISCONNECTED
[00:01:46.203,796] <dbg> modules_common.module_get_next_msg: app module: Dequeued CLOUD_EVT_DISCONNECTED
[00:01:46.204,406] <dbg> nrf_cloud.nrf_cloud_run: The cloud socket is already closed
[00:01:46.204,895] <dbg> modules_common.module_get_next_msg: data module: Dequeued CLOUD_EVT_DISCONNECTED
[00:01:46.205,505] <dbg> modules_common.module_get_next_msg: cloud module: Dequeued CLOUD_EVT_DISCONNECTED
[00:01:46.206,085] <dbg> modules_common.module_get_next_msg: modem module: Dequeued CLOUD_EVT_DISCONNECTED
[00:01:57.709,716] <dbg> modem_module.lte_evt_handler: RRC mode: Idle
[00:02:00.303,192] <dbg> watchdog.primary_feed_worker: Feeding watchdog
[00:02:00.706,726] <inf> event_manager: APP_EVT_DATA_GET_ALL

and the device never connects, even after 20min of waiting.

And my prj.conf file:

#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# General config
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_ASSERT=y
CONFIG_REBOOT=y
CONFIG_RESET_ON_FATAL_ERROR=n
CONFIG_FPU=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=32768
CONFIG_MAIN_STACK_SIZE=1280
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
CONFIG_HW_STACK_PROTECTION=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y

# DK - Used for buttons and LEDs in UI module.
CONFIG_DK_LIBRARY_INVERT_LEDS=n

# nRF modem library
CONFIG_NRF_MODEM_LIB=y

# AT Host library - Used to send AT commands directy from an UART terminal and to allow
#		    integration with nRF Connect for Desktop LTE Link monitor application.
CONFIG_AT_HOST_LIBRARY=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y

# LTE link control
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
## Power saving timers.
### 320 hours PSM.
CONFIG_LTE_PSM_REQ_RPTAU="11000001"
### 20 seconds active time.
CONFIG_LTE_PSM_REQ_RAT="00001010"

# Modem info library to obtain information about network and device
CONFIG_MODEM_INFO=y

# GNSS
## Uncomment to use external antenna for GNSS.
#CONFIG_GPS_MODULE_ANTENNA_EXTERNAL=y

# Cloud backend - To use a specific cloud backend uncomment the corresponding
#                 section.

## AWS IoT
## Mandatory application specific configurations for AWS_IOT.
# CONFIG_AWS_IOT=y
# CONFIG_AWS_IOT_TOPIC_UPDATE_DELTA_SUBSCRIBE=y
# CONFIG_AWS_IOT_TOPIC_GET_REJECTED_SUBSCRIBE=y
# CONFIG_AWS_IOT_AUTO_DEVICE_SHADOW_REQUEST=y
# CONFIG_AWS_IOT_MQTT_RX_TX_BUFFER_LEN=2048
# CONFIG_AWS_IOT_MQTT_PAYLOAD_BUFFER_LEN=2048
# CONFIG_AWS_IOT_APP_SUBSCRIPTION_LIST_COUNT=3
# CONFIG_AWS_IOT_CLIENT_ID_APP=y
# CONFIG_AWS_FOTA=y

## AWS IoT options that must be configured.
# CONFIG_AWS_IOT_SEC_TAG=42
# CONFIG_AWS_IOT_BROKER_HOST_NAME=""

# # Azure IoT Hub
# ## Mandatory application specific configurations for AZURE_IOT_HUB.
# CONFIG_AZURE_IOT_HUB=y
# CONFIG_AZURE_IOT_HUB_DPS=y
# CONFIG_AZURE_IOT_HUB_AUTO_DEVICE_TWIN_REQUEST=y
# CONFIG_AZURE_IOT_HUB_DEVICE_ID_APP=y
# CONFIG_AZURE_IOT_HUB_MQTT_PAYLOAD_BUFFER_LEN=2048
# CONFIG_AZURE_IOT_HUB_MQTT_RX_TX_BUFFER_LEN=2048
# CONFIG_AZURE_IOT_HUB_TOPIC_PROPERTY_BAG_PREFIX=n
# CONFIG_AZURE_IOT_HUB_STACK_SIZE=4096
# CONFIG_AZURE_FOTA=y
# CONFIG_AZURE_FOTA_TLS=y

# ## Azure IoT Hub options that must be configured.
# CONFIG_AZURE_IOT_HUB_DPS_HOSTNAME="global.azure-devices-provisioning.net"
# CONFIG_AZURE_IOT_HUB_DPS_ID_SCOPE=""
# CONFIG_AZURE_IOT_HUB_SEC_TAG=11
# CONFIG_AZURE_FOTA_SEC_TAG=11

# nRF Cloud
CONFIG_NRF_CLOUD=y
CONFIG_NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID=y
CONFIG_NRF_CLOUD_MQTT=y
CONFIG_NRF_CLOUD_CONNECTION_POLL_THREAD=y
CONFIG_NRF_CLOUD_SEND_TIMEOUT=y

# GPS
CONFIG_GPS_MODULE_NMEA=y

## A-GPS and P-GPS

# Set nRF Cloud as source for handling incoming A-GPS and P-GPS data.
# This enables the application to use nRF Cloud specific APIs to process
# incoming A-GPS and P-GPS data that has indirectly been fetched from nRF Cloud
# on the cloud side also when nRF Cloud is not used as the cloud backend.
CONFIG_AGPS=y
CONFIG_AGPS_SRC_NRF_CLOUD=y
CONFIG_NRF_CLOUD=y
CONFIG_NRF_CLOUD_AGPS=y

# Be aware that P-GPS received a lot of data over the network when it's used.
# CONFIG_NRF_CLOUD_PGPS=y
# CONFIG_NRF_CLOUD_PGPS_REQUEST_ALL_UPON_INIT=n

# A-GPS using SUPL server.
# Due to licensing, the SUPL library must be manually downloaded and configured
# according to the instructions found in the SUPL client library documentation in NCS.
# CONFIG_AGPS=y
# CONFIG_AGPS_SRC_SUPL=y

# MQTT
# Keepalive should be set to the maximum specified MQTT keepalive timeout of the
#        selected cloud library.
#        1200 seconds for AWS IoT and nRF Cloud.
#        1767 seconds for Azure IoT Hub.
CONFIG_MQTT_KEEPALIVE=1200
CONFIG_MQTT_CLEAN_SESSION=y

# Settings - Used to store real-time device configuration to flash.
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
CONFIG_FCB=y

# FOTA - Needed by AWS_FOTA and AZURE_FOTA.
CONFIG_FOTA_DOWNLOAD=y
CONFIG_DFU_TARGET=y
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=2300
CONFIG_DOWNLOAD_CLIENT_MAX_HOSTNAME_SIZE=128

# Flash - Used in FOTA, settings and storage for P-GPS.
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_STREAM_FLASH=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# Watchdog
CONFIG_WATCHDOG_APPLICATION=y

# Event Manager
CONFIG_EVENT_MANAGER=y
CONFIG_LINKER_ORPHAN_SECTION_PLACE=y
CONFIG_EVENT_MANAGER_LOG_EVENT_TYPE=n

# cJSON - Used in AWS FOTA and cloud data traffic encoding.
CONFIG_CJSON_LIB=y

# CAF - Common Application Framework
CONFIG_CAF=y
CONFIG_LED=n
CONFIG_CAF_LEDS=n
CONFIG_CAF_INIT_LOG_LED_READY_EVENTS=n
CONFIG_CAF_INIT_LOG_LED_EVENTS=n
CONFIG_CAF_INIT_LOG_MODULE_STATE_EVENTS=n

CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG_MAX_LEVEL=4

# Module debug configurations.
CONFIG_MODULES_COMMON_LOG_LEVEL_DBG=y
CONFIG_APPLICATION_MODULE_LOG_LEVEL_DBG=y
CONFIG_CLOUD_MODULE_LOG_LEVEL_DBG=y
CONFIG_DATA_MODULE_LOG_LEVEL_DBG=y
CONFIG_GPS_MODULE_LOG_LEVEL_DBG=y
CONFIG_MODEM_MODULE_LOG_LEVEL_DBG=y
CONFIG_SENSOR_MODULE_LOG_LEVEL_DBG=y
CONFIG_UI_MODULE_LOG_LEVEL_DBG=y
CONFIG_UTIL_MODULE_LOG_LEVEL_DBG=y
CONFIG_DEBUG_MODULE_LOG_LEVEL_DBG=y

# Cloud integration layer debug logging
CONFIG_CLOUD_INTEGRATION_LOG_LEVEL_DBG=y

# Application Watchdog debug logging
CONFIG_WATCHDOG_LOG_LEVEL_DBG=y

# Cloud codec debug logging
CONFIG_CLOUD_CODEC_LOG_LEVEL_DBG=y

# AGPS
CONFIG_AGPS_LOG_LEVEL_DBG=y

# Date time
CONFIG_DATE_TIME_LOG_LEVEL_DBG=y

# Settings
CONFIG_SETTINGS_LOG_LEVEL_DBG=y

# nRF Cloud
CONFIG_NRF_CLOUD_FOTA_LOG_LEVEL_DBG=y
CONFIG_NRF_CLOUD_LOG_LEVEL_DBG=y
CONFIG_NRF_CLOUD_GPS_LOG_LEVEL_DBG=y
CONFIG_NRF_CLOUD_CONNECTION_POLL_THREAD=y

# Flash
CONFIG_STREAM_FLASH_LOG_LEVEL_DBG=y

# Debug module
CONFIG_DEBUG_MODULE=y

Thanks!

Parents
  • It looks like you have done all the required steps... one last thing would be to check the dependency for using the internal UUID:

    config NRF_CLOUD_CLIENT_ID_SRC_INTERNAL_UUID
    	bool "Modem internal UUID value"
    	depends on MODEM_JWT
    	help
    		Requires modem firmware version 1.3 or later.

    You probably just need to add CONFIG_MODEM_JWT=y to your prj.conf

  • Thank you very much! After hours of flashing certificates and provisioning devices in nRF Cloud, the asset tracker v2 works on my PCB! 

  • Hi Makkash,

    Do you mind sharing with me how to create the provision.csv file?  I generated and downloaded all certificates to my board.  I can see (16842753,0), (16842753,1) and (16842753,2) certificates when I used the command at%cmng=1.  But I kept failing provisioning my device to the nRF Cloud.  You help is very much appreciated.

    Thank you,

    Floyd

  • the API documentation displays a some examples of the csv file format.
    https://api.nrfcloud.com/v1#operation/ProvisionDevices

    Here is the example which uses the device ID (required), FOTA capabilities (not required), and device certificate (required):

    f69c0e45-7f04-4949-8def-bb2215b4223e,,,APP|MODEM,"-----BEGIN CERTIFICATE-----
    MIIB7DCCAZMCFD...Av3CVgjzn5BLS03X7lyf4w==
    -----END CERTIFICATE-----
    "


    The first item is the device ID.  This example uses a UUID format for the device ID.  Replace with your device's ID.

    The APP|MODEM text indicates FOTA capabilities for your device.  You can remove the text if you do not want to include that capability.

    Copy and paste your device certificate in PEM format; it should include the newlines.  Note the required trailing newline.

    Here is a full example for a device with an nrf-<IMEI> formatted device ID with no FOTA capabilities enabled:

    nrf-352656100300204,,,,"-----BEGIN CERTIFICATE-----
    MIICzTCCAbUCCQC0PqjeoGxT9TANBgkqhkiG9w0BAQsFADCBizELMAkGA1UEBhMC
    Tk8xDzANBgNVBAgMBk5vcndheTESMBAGA1UEBwwJVHJvbmRoZWltMR0wGwYDVQQK
    DBROb3JkaWMgU2VtaWNvbmR1Y3RvcjE4MDYGA1UECwwvZWxpdmFnYXItcHJvZC1w
    Y2ExMDA5MC11cC10by0xOTA5MDItdGhpbmctZ3JvdXAwIBcNMjIwMzI5MjEwNzIx
    WhgPMjA1MjAzMjEyMTA3MjFaMIGNMQswCQYDVQQGEwJOTzESMBAGA1UECAwJVHJv
    bmRlbGFnMRIwEAYDVQQHDAlUcm9uZGhlaW0xITAfBgNVBAoMGE5vcmRpYyBTZW1p
    Y29uZHVjdG9yIEFTQTEcMBoGA1UEAwwTbnJmLTM1MjY1NjEwMDMwMDIwNDEVMBMG
    A1UELhMMRTk2NDA3RTAzRTVGMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEiGQ6
    MgMwhr7xVE7nBn42XDDGSBzQhrN6PIYH9hpQbKFF+jLAN/coMdl5FGcKZ3d3MjDk
    wjV7bciIHB7CMGUPyzANBgkqhkiG9w0BAQsFAAOCAQEAP56rTVFPLB1CRpmlAr8o
    W6wHOjQVAkfHEEIybVQ1oTT/9qEF9zZd/cYnyuC6W2A+BuuW1xbGo33MpB5fyVCH
    Fhv736b4pdpisF/H+ZplkSOYnO0yUBpF6STURB5OkFPEjl9gmAQmGWgRBO6MmRxI
    jU0AjK/4RnwB9N0xfbDPGB3X6SSOsyoFssQBKtzJGhdR6OM32N6bmR1BP29I3Vbx
    retSi6rfJkNeX21fBIyLNwtOz87MH7VT3Mzue5kqLk/u3AQIEuY++GrzPVHI6QL6
    bTeGRyEbu3iP+Wn/i37K0bABvzW7Rdx253bGHSjFLlK6glbBsjz6SXe3FFnOffSq
    og==
    -----END CERTIFICATE-----
    "


    You can upload your csv file using the website: https://nrfcloud.com/#/provision-devices
    Or you can use the REST API as described by the API documentation.

  • Hi Justin,

    I tried according to your instruction.  I can see my device in nRF Cloud.  But it is "disconnected".

    And in the Provision Devices page, the status is "Successed".  Any idea why?  The main reason I need to connect to the nRF Cloud is to use its A-GPS data.

    Regards,

    Floyd 

  • The connection status on the device page is for devices connecting via MQTT and running an application like asset_tracker_v2.  So you can probably ignore it.

    The provisioning step completed successfully, which is why your device now appears in your nRF cloud account.  You should be able to now access nRF cloud from your device using MQTT or REST.

  • Hi there, I also planning to run asset tracker on my custom board. Would like to ask you something, in my custom board, we are using JTAG to upload firmware and no USB port on my board. Do you use USB port to do serial communication between PC and nrf9160? Thank you. 

Reply Children
Related