A simple guide to quickly and freely connect your B-U585I-IOT02A to Azure IoT Central
1. Introduction The following tutorial outlines how to connect the B-U585I-IOT02A Discovery Kit to Azure IoT Central with the X-CUBE-AZURE package using the following technologies:
Real time sensor data published and displayed in the cloud
2. Getting started
2.1 Hardware setup
You need to plug your STM32U5 development board into a USB port on your PC using the USB 2.0 male to Micro USB male cable (as picture below). Windows should recognize the STM32U5 as a generic USB device. A 2.4 GHz Wi-Fi router connected to the internet with DHCP enabled and the router’s SSID and password is also required for the STM32U5 discovery kit to connect to the cloud.
Download the project zip here and unzip it into a folder of your choice, we recommend: C:\. NOTE: If you unzip the IAR project where it has a long file path it may not build correctly.
3. Connecting the STM32U5 to Azure IoT Central
A Python script has been provided to streamline the setup process. This reference design works with both a paid Azure subscription and a free trial application. This article outlines the free configuration but additional documentation for a paid subscription can be found in the X-CUBE-AZURE package.
3.1 Running the Quick Connect script – Free Azure account
The block diagram below illustrates the progression of the script for a free Azure subscription:
Before you run the script, please check that you satisfy the following checklist:
Your board is connected to your PC
No app or a script with an open com port with the board
Only one STM32 board connected to your PC
2.4 GHz Wi-Fi
The correct AZ CLI version (az --version)
No free central applications already exist in your account. Free applications are limited to one per account. Please refer to troubleshoot section on how to delete an app
Navigate to C:\U5-TFM\STM32Cube_FW_U5_V1.1.1\Projects\B-U585I-IOT02A\Applications\TFM\AzureScripts
Open a PowerShell window in this directory
Enter the command python .\STM32U5_QuickConnect.py
Enter ‘n’ into the console to confirm that you will be using a Free Trial Azure IoT Central Application.
Note: This trial application will only allow for 5 devices and will expire after 7 days.
If not already logged in, in your browser, the script prompts you to log in to a Microsoft account in your browser.
You are redirected to the following Azure IoT Central Application creation webpage. Copy the unique URL name from the browser.
Select the ‘Free’ button and then select ‘Create’ in your browser.
Paste the application URL name into the PowerShell window and press Enter.
Proceed to enter the SSID and Password for a 2.4GHz Wi-Fi network.
The script will again prompt you login with a Microsoft account in a popup browser window.
The central application management page pops up in your browser and the script will prompt you to copy the ID from your browser paste it into the console.
The script will now execute autonomously to configure your environment.
The script sets the correct option bytes, flash the firmware image to the board, and use the provided information to connect the STM32U5 to your 2.4GHz Wi-Fi network.
The script collects the X.509 Certificate from STSAFE-A110. The certificate Common Name is used as the device RegistrationID and will have the following format: "eval3-0102D095415CD42AA20139"
The script will then configure all the required Azure IoT Central resources for the application that is opened in your browser.
The script will then provision a new device in your central application and then configure the STM32U5 to connect and communicate telemetry data to that device. If you navigate to the Devices tab in the central application, you will see that the STM32U5 is connected after a short delay.
4. Additional questions?
Refer to the documentation in the X-CUBE-AZURE Package for additional support