MQTT connect fails to connect to IoT Hub. Generic error of 0x10005 NXD_MQTT_CONNECT_FAILURE
I am using an STM32F429 Nucleo 144 and the Ethernet interface to run an Azure Iot client.
Using STM32Cube IDE version 1.8.0
NetxDuo versios 6.1.7
Nx_SNTP_Client Sample project
I have combined this example with NetxDuo's sample_azure_iot_embedded_sdk_with_retry.c Once the IP address and SNTP server is connected (time is sync'd) I start the Azure client thread.
My code is not able to successfully connect to the iOT hub. The call to mqtt_client_secure_connect() eventually returns the generic NXD_MQTT_CONNECT_FAILURE (i.e. 0x00010005 from file nxd_mqtt_client.h). The response code is generic and does not help with further debugging. Is there some additional logging or method to debug this.
Here is a snippet from the console output
Nx_SNTP_Client application started..
STM32 IpAddress: ***.***.***.***
SNTP client connected to NTP server : < ca.pool.ntp.org >
SNTP update :
Mar 24, 2022 16:34:9.699 UTC
.....
24-03-2022 / 16:34:09
24-03-2022 / 16:34:09
[INFO] Azure IoT Security Module has been enabled, status=0
IoTHub Host Name: xxxxxxxx.azure-devices.net; Device ID: stm32F429xxxxx.
24-03-2022 / 16:34:09
24-03-2022 / 16:37:41
....
24-03-2022 / 16:37:51
24-03-2022 / 16:37:52
24-03-2022 / 16:37:52
24-03-2022 / 16:37:52
24-03-2022 / 16:37:52
[ERROR] IoTHub client connect fail: MQTT CONNECT FAIL status: 65541
Disconnected from IoTHub!: error code = 0x00010005
Failed on nx_azure_iot_hub_client_connect!
reconnecting iothub, after backoff
24-03-2022 / 16:39:54
24-03-2022 / 16:39:54