zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
11k stars 6.7k forks source link

unable to connect to azure iot hub via mqtt protocol #34309

Closed ghost closed 3 years ago

ghost commented 3 years ago

Describe the bug I am trying to connect the nucleo-f429zi using the wifi shield esp-01 to my azure-iot-hub. The samples project is here: https://docs.zephyrproject.org/latest/samples/net/cloud/mqtt_azure/README.html i created an iot-hub and i added a device. The sample project requires these parameters:

I set up these parameters in the menuconfig of the project, except the azure cloud server address and port.

To Reproduce Steps to reproduce the behavior:

  1. cd zephyrproject/zephyr
  2. west build -b nucleo_f429zi samples/net/cloud/mqtt_azure -- -DCONF="prj.conf" -DSHIELD=esp_8299
  3. west build -t menuconfig
  4. west build
  5. west flash

Impact the sample project cannot connect to the iot-hub. I guess because i didn´t set up correctly the SAS-token. please see the logs in the picture below. in which format is the SAS token for mqtt protocol ?

Logs and console output azure-error-wifi

Environment (please complete the following information):

jukkar commented 3 years ago

The -116 errno is ETIMEDOUT, so the connection cannot be established. Difficult to know what is going on, there are lot of moving parts involved when setting the Azure configuration parameters etc. I do not have Azure credentials to try this.

jukkar commented 3 years ago

BTW, the current timeout (from your screenshot) seems to be 3 sec. Could you try to increase it as I remember seeing some complaints that the cloud connection establishment can take a long time.