This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Azure IOT with Keil MDK

I'm trying to implement an Azure IOT hub connection with MQTT using a custom WiFi driver. Has anyone else had any experience with this as I am having some problems?

My problem seems to be with the Azure SDK part of it, I know the WiFI driver is functioning correctly as I've already been using it with the Paho MQTT packet and the Eclipse broker.

I have my iot socket functions currently stubbed off and the first one that seems to get called is iotSocketGetHostByName() with the first argument being a pointer to the broker URL, but the URL is empty.

I believe I have setup the connection string correctly and I can step through the code to see that the url of the azure iot hub is being extracted correctly and is being stored. However it doesn't get passed to the iotSocketGetHostByName() function as it's not stored in the dns->hostname variable.

Any thoughts please.

Parents
  • As you have also realized the Azure IoT SDK is quite complex and not so easy to understand or debug.

    The function STRING_construct_sprintf will allocate needed memory from heap when STRINGS_C_SPRINTF_BUFFER_SIZE is not defined. So it does not need to be defined explicitly.

    I suspect that allocating memory fails in your configuration. You should debug the mentioned function to confirm. Have you tried to increase Heap?

    Alternative would be to define that buffer size however I’m not sure what is a good value because this function is used in many different places and having the buffer too small might lead to other failures.

Reply
  • As you have also realized the Azure IoT SDK is quite complex and not so easy to understand or debug.

    The function STRING_construct_sprintf will allocate needed memory from heap when STRINGS_C_SPRINTF_BUFFER_SIZE is not defined. So it does not need to be defined explicitly.

    I suspect that allocating memory fails in your configuration. You should debug the mentioned function to confirm. Have you tried to increase Heap?

    Alternative would be to define that buffer size however I’m not sure what is a good value because this function is used in many different places and having the buffer too small might lead to other failures.

Children