How to customize the project that connects B-L475E-IOT01A1 to Azure IoT Central

Chia Li 20 Reputation points
2023-08-01T01:50:16.65+00:00

Hi everyone,

I started my projects using this tutorial and successfully connected to IoT Central. Additionally, I configured an STM32 project that reads two sensors (DS3231 and HC SR501).

I am still reading the documents and learning the source files to understand the original tutorial.

I have modified the .ioc file in the getting-started\STMicroelectronics\B-L475E-IOT01A\lib\stm32cubel4\stmcubemx\ My modification enabled I2C and a GPIO input in the pin map.

I am unsure of my next step, but I made a list that might be helpful for discussion: (for what I planned to do)

  1. Make sure the board_init.c in app folder includes I2C's initialization.
  2. Put sensors' functions under C:\Git_repo\AzureRTOS\getting-started\STMicroelectronics\B-L475E-IOT01A\lib\stm32cubel4\stmcubemx\Core\Src C:\Git_repo\AzureRTOS\getting-started\STMicroelectronics\B-L475E-IOT01A\lib\stm32cubel4\stmcubemx\Core\Inc
  3. Send the reading Azure RTOS and the thread will handle the rest (This part I am really unsure how it works)

Thank you for any discussion and help!

Azure RTOS
Azure RTOS
An Azure embedded development suite including a small but powerful operating system for resource-constrained devices.
331 questions
{count} votes

Accepted answer
  1. LeelaRajeshSayana-MSFT 14,676 Reputation points Microsoft Employee
    2023-08-04T00:04:33.42+00:00

    Hi @Chia Li Greetings! Thank you for posting the question on this forum.

    Send the reading Azure RTOS and the thread will handle the rest (This part I am really unsure how it works)

    The answer to this question lies in the Prepare the device section of the Tutorial you have mentioned in your question. Once you created an IoT Central Application and added a device following the steps outlined in the article, you would be able to capture the credentials needed for establishing a connection to this device. Step 7 of the Create a new device section shows the details need to configure the connection with your SMT32 device. Please refer the below image for reference.

    User's image

    Once you capture the ID scope, Device ID and the Primary Key details, you can provide them in the getting-started\STMicroelectronics\B-L475E-IOT01A\app\azure_config.h file. The SDK will utilize these settings from the code through STMicroelectronics/B-L475E-IOT01A/app/nx_client.c and establish the connection to the device.

    I would recommend testing the sensors independent of IoT Central and come up with a code that successfully works on STM32. Once you have this code working, try to embed it into the file getting-started/STMicroelectronics/B-L475E-IOT01A/app/nx_client.c. This file contains the methods that are responsible for pushing telemetry data on to Azure IoT Central. You can modify the code to capture the sensors data and publish it on to the device.

    Hope this answers your question. Please let me know if you have any additional questions or need further assistance.


    Converting this to comment for further discussion!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.