Copyright ©

Mongoose OS Forum


Problem with connecting to Microsoft Azure

SterlingSterling Zagreb
edited September 2017 in Mongoose OS


I'm trying to connect to Microsoft Azure and send it some data using C code, not JavaScript as shown in the example. Now, I updated all the server config in the mos.yml file:

  • ["wifi.sta.enable", true]
  • ["wifi.sta.ssid", "*****"]
  • ["wifi.sta.pass", "*****"]
  • ["wifi.ap.enable", false]
  • ["", "esp32_050258"]
  • ["mqtt.enable", true]
  • ["mqtt.server", "**********"]
  • ["mqtt.client_id", "esp32_050258"]
  • ["mqtt.user", "**********"]
  • ["mqtt.pass", "SharedAccessSignature sr=*******"]
    # - ["mqtt.ssl_ca_cert", "ca.pem"]

and I'm using this code to publish messages:

mgos_mqtt_pub(topicTemp, tempStr, sizeof(tempStr), 1);

  • topicTemp is string name of the topic: "devices/esp32_050258/messages/events/"
  • tempStr is stringified representation of the measured temperature

After initialization I get the following message in console:
[Sep 6 14:44:09.010] mgos_mqtt_ev MQTT Connect (1)
[Sep 6 14:44:09.097] mgos_mqtt_ev MQTT Disconnect
[Sep 6 14:44:09.097] mqtt_global_reconnec MQTT connecting after 3768 ms
[Sep 6 14:44:09.097] mongoose_poll New heap free LWM: 183060
[Sep 6 14:44:12.154] timer_cb 0 devices/esp32_050258/messages/events/ -> Temperature: 26.799999

The zero in the last line means that mgos_mqtt_pub returned false.

I desperately need help please!
Thanks in advance.


  • SergeySergey Dublin, Ireland

    Per, you need:


    You have ca.pem disabled, meaning it does not use SSL, meaning you can't connect.

    Currently, only esp8266 can connect. ESP32 crashes because of the very time-consuming TLS options, we'll fix that soon.

  • Ok, but when I enable ca.pem it begins core dump.

    Task watchdog got triggered. The following tasks did not feed the watchdog in time:
    [Sep 7 09:38:37.345] - mgos (CPU 0)
    [Sep 7 09:38:37.345] Tasks currently running:
    [Sep 7 09:38:37.345] CPU 0: mgos
    [Sep 7 09:38:37.346] Aborting.
    [Sep 7 09:38:37.346] abort() was called at PC 0x400d213d on core 0
    [Sep 7 09:38:37.346]
    [Sep 7 09:38:37.346] Backtrace: 0x4008723f:0x3ffc05b0 0x40086f4f:0x3ffc05d0 0x400d213d:0x3ffc05f0 0x400817c5:0x3ffc0610
    [Sep 7 09:38:37.346]
    [Sep 7 09:38:37.346] --- BEGIN CORE DUMP ---

    I assume that's because I haven't added ca-bundle lib, but when I do add it, I get the following error during build:

    Error: preparing local copy of the lib "ca-bundle": failed to git checkout 1.14: error: pathspec '1.14' did not match any file(s) known to git.
    exit status 1

    I tried to do "mos update latest" as shown on another topic on this forum but it doesn't work. I get that mos is currently on it's latest version, 1.14.

  • rojerrojer Dublin, Ireland

    1.15 has been released, this should not be a problem anymore

Sign In or Register to comment.