Azure/azure-sdk-for-c

Arduino SDK-c Code: -2 Error

carbonbasedrobot opened this issue · 4 comments

I am following the steps of this github: https://github.com/Azure/azure-sdk-for-c-arduino/blob/main/examples/Azure_IoT_Hub_Arduino_Nano_RP2040_Connect/README.md
to upload the example sketch Azure_IoT_Hub_Arduino_Nano_RP2040_Connect
I've followed every step carefully, have downloaded everything I've been told to download and imported all necessary libraries. I correctly input my hotspot network ssid and password, as well as the relevant Azure IoT resource group, device id and primary key info but when upload the sketch, I get the following error (with blurred out sensitive info ofc):

..............[INFO] Attempting to connect to WIFI SSID: *******

[INFO] WiFi connected, IP address: ************, Strength (dBm): -43
[INFO] Syncing time.
........
[INFO] Time synced!
[INFO] Initializing Azure IoT Hub client.
[INFO] Azure IoT Hub hostname: *******.azure-devices.net
[INFO] Azure IoT Hub client initialized.
[INFO] Initializing MQTT client.
[INFO] UTC Current time: 2023-05-03 04:08:34 (epoch: 1683086914 secs)
[INFO] UTC Expiry time: 2023-05-03 05:08:34 (epoch: 1683090514 secs)
[INFO] Local Current time: 2023-05-02 21:08:34
[INFO] Local Expiry time: 2023-05-02 22:08:34
[INFO] Client ID: *****
[INFO] Username: **********azure-devices.net/
/?api-version=2020-09-30&DeviceClientType=c/1.5.0-beta.1(ard;nanorp2040connect)
[INFO] MQTT client initialized.
[INFO] Connecting to Azure IoT Hub.
[ERROR] Cannot connect to Azure IoT Hub. Reason: MQTT_CONNECTION_REFUSED, Code: -2

I have been unable to identify what the issue is, and havent seen this error anywhere on google. What should I try?
Thanks, I'm getting desperate

Hello!
Since you mentioned Azure IoT resource group, for your IOT_CONFIG_IOTHUB_FQDN, are you using the hostname?
image
And the primary key from your device page?
image

Hi @carbonbasedrobot, I successfully ran the sample, wanted to check if you've taken a look at @vaavva's comment above. Another good thing to check would be if you've installed the latest Arduino libraries.

Hi @carbonbasedrobot. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

Hi @carbonbasedrobot, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!