Thingy:91 Azure IOT sample azure_iot_hub_connect failed: -116

I am trying to Azure IOT Hub sample code on thingy91. I have followed  Azure IoT Hub and generated certicated and updated it to the modem. In order to create certificate I use this method. These are the certificates which I upload to the modem.

  

From this discussion I also upload the certs to project folder.

This for .pem files in the project.

There is the prj.conf:

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

# General config
CONFIG_LOG=y
CONFIG_LOG_MODE_DEFERRED=y

# NEWLIB C
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_LTE_M=y

# Modem library
CONFIG_NRF_MODEM_LIB=y

# AT Host
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_AT_HOST_LIBRARY=y

# Azure IoT Hub library
CONFIG_AZURE_IOT_HUB=y
CONFIG_AZURE_IOT_HUB_DEVICE_ID="testdevice"
# Host name must be configured if DPS is not used
CONFIG_AZURE_IOT_HUB_HOSTNAME="{link for the Azure Hostname xxx.azure-devices.net}"
# Change the security tag to the tag where Azure IoT Hub certificates
# are provisioned
CONFIG_MQTT_HELPER_SEC_TAG=10

# Uncomment to get more verbose logging when debugging
# CONFIG_AZURE_IOT_HUB_LOG_LEVEL_DBG=y

# MQTT - Maximum MQTT keepalive timeout specified by Azure IoT Hub
CONFIG_MQTT_KEEPALIVE=1767

# LED control
CONFIG_DK_LIBRARY=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096


# cJSON
CONFIG_CJSON_LIB=y

# Settings, needed for Azure Device Provisioning Service
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FCB=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y

This is at command result for certificates:

This is my the build config:

On Azure my Certificate:

In addition I added the "testdevice" under Devices menu on Azure with as "While Registering the device with Azure IoT Hub, make sure that you select X.509 CA Signed as the Authentication type."

From the serial port I got this error.

[00:00:03.011,322] <inf> azure_iot_hub_sample: LTE cell changed: Cell ID: 7432737, Tracking area: 12017
+CSCON: 1
[00:00:07.211,395] <inf> azure_iot_hub_sample: RRC mode: Connected
+CEREG: 5,"2EF1","00716A21",7,,,"11100000","11100000"
[00:00:08.801,300] <inf> azure_iot_hub_sample: Network registration status: Connected - roaming
[00:00:08.801,452] <inf> azure_iot_hub_sample: Connected to LTE network
[00:00:08.801,574] <inf> azure_iot_hub_sample: Azure IoT Hub library initialized
[00:00:08.801,605] <inf> azure_iot_hub_sample: AZURE_IOT_HUB_EVT_CONNECTING
[00:00:08.802,642] <inf> azure_iot_hub_sample: PSM parameter update: TAU: 3600, Active time: -1
+CSCON: 0
[00:00:18.894,012] <inf> azure_iot_hub_sample: RRC mode: Idle
+CEREG: 5,"2EF1","00716420",7,,,"11100000","11100000"
[00:02:30.254,608] <inf> azure_iot_hub_sample: LTE cell changed: Cell ID: 7431200, Tracking area: 12017
+CSCON: 1
[00:02:50.628,662] <err> mqtt_helper: mqtt_connect, error: -116
[00:02:50.628,692] <err> azure_iot_hub: mqtt_helper_connect failed, error: -116
[00:02:50.628,692] <err> azure_iot_hub_sample: azure_iot_hub_connect failed: -116
[00:02:50.822,357] <inf> azure_iot_hub_sample: RRC mode: Connected
+CSCON: 0
[00:02:57.252,899] <inf> azure_iot_hub_sample: RRC mode: Idle

Parents Reply Children
No Data
Related