Application Note
R11AN0474EU0100 Rev.1.00 Page 1 of 36
Oct.23.20
Renesas RA Family
RA Azure IoT Cloud Connectivity Solution
Introduction
The objective of this Application Project is to demonstrate the Renesas RA Azure IoT Cloud Connectivity
solution by providing a fully working solution that sends sensor data to the Microsoft
®
Azure IoT Central
cloud over Wi-Fi/Ethernet connection and using HAL drivers and middleware provided with Renesas Flexible
Software Package (FSP).
You will start by setting up the project to read the necessary sensor data from the On-chip temperature
sensor and then view that data within the debug context of e
2
studio IDE. Next, you will setup your Azure IoT
Central software-as-a-service (SaaS) application to send and receive data to and from the evaluation kit.
Lastly you will configure the necessary security credentials on your evaluation kit to securely connect to the
Azure cloud.
This application project contains integrated Azure Embedded C SDK files which are designed to allow
embedded (IoT) MCU devices like RA6M3 to communicate with Azure services such as Azure Device
Provisioning Service (DPS) and Azure IoT Hub to demonstrate Azure cloud connectivity.
Hardware/Software Prerequisites:
Hardware:
Renesas EK-RA6M3 kit with USB micro B cables (2) (renesas.com/ra/ek-ra6m3
)
Silex SX-ULPGN Wi-Fi PMOD module (or) Ethernet cable.(renesas.com/wi-fi-pmod)
PC running Windows
®
10 with at least 2 USB ports
Software:
Renesas Flexible Software Package platform installation, which includes:
e
2
studio 2.10.0 or later
FSP v 2.0.0 or greater
GCC Arm Embedded 9.2.1 (2019-q4-major)
SEGGER J-Link USB driver
Tera Term v4.0 or newer
Web browser (Google Chrome, Mozilla Firefox or Microsoft Edge)
Prerequisites and Intended Audience
This application note assumes that the user has some experience with the Renesas e
2
studio IDE and
Flexible Software Package (FSP). Before running this application, follow the procedure in the FSP User
Manual to build and run the Blinky project. Doing so enables you to become familiar with the e
2
studio and
the FSP and ensures proper functioning of debug connection to your board. In addition, this application note
assumes the user have some knowledge of MQTT/TLS protocols.
The intended audience are users who want to develop Azure Cloud Connectivity applications using FSP
MQTT/TLS modules on Renesas RA6M3 MCU series.
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 2 of 36
Oct.23.20
Contents
RA MQTT/TLS Application Overview ....................................................................................... 3
Powering Up the EK-RA6M3 Evaluation Kit ............................................................................. 4
Importing the FSP Application Project ..................................................................................... 5
Setting up Azure IoT Central Application ................................................................................. 8
Setting up X.509 Certificate based Authentication ................................................................. 16
5.1 Setting up Environment ......................................................................................................................... 16
5.2 Creating and Verifying a Certificate Chain ............................................................................................ 18
5.3 Creating a Device Certificate ................................................................................................................. 23
Building the Application ......................................................................................................... 25
Connecting to Azure IoT Cloud Server................................................................................... 26
Receiving Messages from the IoT Central Application ........................................................... 32
Cleaning up PowerShell and Windows Certificate Store ........................................................ 33
Next Steps and References ................................................................................................... 34
Revision History ............................................................................................................................ 36
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 3 of 36
Oct.23.20
RA MQTT/TLS Application Overview
This application project demonstrates the Renesas RA IoT Cloud Connectivity solution using the FSP
MQTT/TLS modules and uses Microsoft
®
Azure as the cloud provider. Ethernet or Wi-Fi can be used as
primary communication interface between the MQTT device and the Azure IoT Services.
The EK-RA6M3 kit acts as an MQTT node, connects to the Azure IoT service using MQTT/TLS protocol over
Ethernet or Wi-Fi network interface. The application periodically reads the on-chip temperature sensor values
and publishes this information to the Azure IoT Core. It also subscribes to a User LED state MQTT topic. You
can turn the User LEDs ON/OFF by publishing the LED state remotely. This application reads the updated
LED state and turns the Users LEDs ON/OFF.
(Or)
Figure 1. RA MQTT/TLS Application Overview
This application project is a single user thread application and the main thread handles the following major
functions:
1. Initialize network interface (Ethernet in case of Azure_EK_RA6M3_Eth project or Wi-Fi in case of
Azure_EK_RA6M3_WiFi project).
2. Initialize sensors.
3. Initialize USB PCDC interface to print debug message over serial console.
4. Connect to Azure Cloud services.
5. Read sensor data periodically and publish the data on MQTT topics.
6. Toggle the user LED state based on the incoming MQTT message.
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 4 of 36
Oct.23.20
Powering Up the EK-RA6M3 Evaluation Kit
The following hardware components are needed for this application. Refer to EK-RA6M3 user’s manual
(renesas.com/ra/ek-ra6m3
) for the default jumper settings.
Figure 2. EK-RA6M3 Board
Figure 3. Silex SX-ULPGN Wi-Fi PMOD Module
Note: One micro USB cable is provided with the EK-RA6M3 kit. Users will need to supply one additional
cable.
Figure 4. Micro USB Cable
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 5 of 36
Oct.23.20
1. In case of using Wi-Fi network interface, attach Silex SX-ULPGN Wi-Fi Pmod module to PMOD2 (J25,
upper right). The Silex module and components should be facing up.
2. In case of using Ethernet network interface, attach an Ethernet cable to the EK_RA6M3 Ethernet LAN
Port.
3. Connect the EK-RA6M3 kit to the PC using a USB micro-B cable connected to DEBUG (J10) on the
board (right side of board above Ethernet jack).
4. Connect the second USB micro-B cable to the PC and to the USB high speed (J6) port on the opposite
edge of the board. Make sure Jumper J7 has pin 2-3 connected.
5. Once completed, the LEDs should be illuminated as described below.
LED1, LED2, LED3 (below user buttons)
Flashing red, green and blue
LED4 (middle of board)
Illuminating white
LED5 (right side, near USB debug port)
Illuminating yellow
Importing the FSP Application Project
1. Launch e
2
studio. e
2
studio can be launched from the Windows start menu or directly from the FSP folder.
If you have multiple versions of e
2
studio installed, please make sure to launch the version of e
2
studio
that was called out in the prerequisites section on page 1 of this application project.
2. In the Eclipse Launcher window, specify the destination for the new workspace. It is recommended to
keep the path simple and avoid using spaces.
Figure 5. Eclipse Launcher Window
3. Click Launch to start e
2
studio in the specified path. When prompted, press Apply to dismiss pop-up
window asking for permission to log and report usage (it will remain disabled).
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 6 of 36
Oct.23.20
4. The welcome screen may show inside the new workspace. It can be dismissed by clicking on the
Workbench button in the top-right corner.
Figure 6. Workbench Button
5. Go to File > Import option.
Figure 7. Import Option
6. In the import dialog box, select the General option, and then select Existing Projects into Workspace to
import the project into the current workspace and click Next.
Figure 8. Importing Existing Projects into Workspace
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 7 of 36
Oct.23.20
7. Click Select archive file and Click Browse.
Figure 9. Selecting Archive File
8. Browse to the folder where the zip file for the project you want to import is located. Select the file for
import. In our case, it is Azure_EK_RA6M3_WiFi.zip or Azure_EK_RA6M3_Eth.zip file depending
up on the network interface.
9. Click Finish to import the project.
Now that the project has been successfully imported, you can start configuring the project for the
hardware.
10. Open the RA Configuration, if not already open, by double-clicking the configuration.xml file in the project
explorer window.
Figure 10. Project Explorer Window
Note: At this point, the ra_cfg and ra folders have not been created. These two folders contain files
generated by e
2
studio and the FSP. The next step generates these files.
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 8 of 36
Oct.23.20
11. Click the Generate Project Content button in the top-right corner of the Configurator window. When
prompted to Proceed with save and generate, tick the box next to Always save and generate without
asking and click Proceed.
Figure 11. Generate Project Content
12. The RA Configurator will extract all the necessary drivers and generate the code based on the
configurations provided in the Properties tab.
Setting up Azure IoT Central Application
In this section the cloud-side of the application will be created using Microsoft’s Azure IoT Central services.
A device template will be used to structure the devices that will connect to the cloud application. EK-RA6M3
kit will be created as an instance of this template and will be used for communication with IoT Central in the
upcoming sections.
1. Open a web browser and go to http://azureiotcentral.com
. Use the link in the top-right corner to Sign in.
If you have not signed up yet, you will have a chance to do so (sign up is free).
Figure 12. Signing In
2. Once logged in select Build a solution.
Figure 13. Selecting 'Build a solution'
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 9 of 36
Oct.23.20
3. On the upper left, click on the hamburger icon to Expand Side Navigation and then click My apps. Click
+ New application in My Apps.
Figure 14. Clicking New Application
4. Create a custom application with the parameters listed below. Once completed, press Create.
Figure 15. Creating a Custom Application
Pricing plan:
Free
Select an application template:
Custom application
Application name:
(use the generated default or specify a unique name)
Contact information:
(specify required details)
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 10 of 36
Oct.23.20
5. The application dashboard will be shown. Press the Device Templates icon on the left navigation menu
and click + New to create a device template.
Figure 16. Creating a New Device Template
6. Select IoT device to create a custom device template for an IoT device and click Next: Customize
button at the bottom of the page.
Figure 17. Customizing the Device Template
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 11 of 36
Oct.23.20
7. On the next screen, we are not configuring a gateway device, so skip this step and click the Next:
Review button at the bottom of the page.
Figure 18. Clicking Next: Review Button
8. On the next page (Review), Click on Create button. Enter a name for your device template and press
Enter.
9. Next, create a capability model for our IoT device. Click on Custom button.
Figure 19. Creating a Custom Capability Model
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 12 of 36
Oct.23.20
10. Now you should create an interface for our capability model. Click + Add interface button.
Figure 20. Creating an Interface for Capability Model
11. Choose Custom interface as shown below.
Figure 21. Choosing a Custom Interface
12. Click the + Add capability button to create capabilities.
Figure 22. Clicking Capability Button
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 13 of 36
Oct.23.20
13. Start creating the capabilities for the temperature sensor data as shown below. Start with the temperature
capability. Click + Add capability button to add new sensor data capabilities.
14. For this application project, use the following properties:
Temperature Sensor:
Display Name:
“temperature”
Capability type:
“Telemetry”
Semantic type:
“Temperature”
Schema:
“Float”
Unit:
“°F”
Manufacturer String:
Display Name:
“manufacturer”
Capability type:
“Property
Toggle LED:
Display Name:
Capability type:
Command:
Figure 23. Selecting Capabilities for the Application Project
15. Click the Save button to save the capabilities.
16. Click Views tab to Generate default views for the device to quickly begin displaying device information.
Figure 24. Generating Default Views for the Device
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 14 of 36
Oct.23.20
17. In the next window, click Generate default dashboard view(s) button as shown below.
Figure 25. Clicking ‘Generate default dashboard view(s)’ Button
18. Publish the newly created device template. To publish, click the Publish button as highlighted below and
then click Publish again in the pop-up window.
Note: Once the template is published it cannot be edited.
Figure 26. Publishing the Newly Created Device Template
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 15 of 36
Oct.23.20
At this stage, the device templates which includes the capability model and corresponding interfaces are
created and the corresponding view options are configured. Now we need to create Devices. To create
devices, click Devices tab, followed by + New option as highlighted below.
Figure 27. Creating Devices Option
19. A pop-up window appears, choose the Template type for the device template we just created. Leave the
default value for the Device name and click the Create button.
Figure 28. Choosing Template Type and Creating New Device
20. Click on the newly created device and click Connect button as highlighted below.
Figure 29. Connecting the Newly Created Device
A new pop-up window appears with Device Connection information. This information needs to match with
the corresponding values in our e
2
studio project. Open user_cfg.h file in e
2
studio and copy the Scope ID
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 16 of 36
Oct.23.20
to AZURE_SCOPE macro, Device ID to AZURE_DEVICE_ID macro. On the Azure side, it’s recommended
to use the blue copy buttons to reduce the chance of errors in matching these values from Azure to the
application project.
Figure 30. Device Connection Information
Setting up X.509 Certificate based Authentication
To enable X.509 Certificate based authentication mechanism, follow the instructions mentioned in the
following sub-sections to generate device credentials that will be used in this project.
5.1 Setting up Environment
1. Download PowerShell script for creating test CA and leaf certificates. Go to the script file on CA tools
page in Azure IoT SDK repository:
https://github.com/Azure/azure-iot-sdk-
c/blob/master/tools/CACertificates/ca-certs.ps1. Right-click Raw and select Save link as… (in Google
chrome) or equivalent (other browsers).
Figure 31. Save Link as Option
2. Save the file into designated work folder. This folder will later be used to output certificates for Azure IoT
Central and the RA device.
3. If your machine already has OpenSSL installed, you can go directly to step 5.1.5. OpenSSL is typically
installed with other commonly used utilities such as Git for Windows.
4. Download Win32 or Win64 OpenSSL from https://slproweb.com/products/Win32OpenSSL.html
and run
the installer. Make note of the installation directory specified in the wizard.
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 17 of 36
Oct.23.20
5. Run Windows PowerShell as an administrator. Open Start Menu, type powershell and right-click Windows
PowerShell to select Run as Administrator.
Figure 32. Running Windows PowerShell as an Administrator
6. In the PowerShell window, type openssl and hit Enter. If red error message is shown, OpenSSL path is
not present in the system PATH variable. If no error is shown and OpenSSL shell starts executing, write
q, press Enter and skip to step 8.
7. Add OpenSSL directory to temporary PATH variable in current PowerShell session. Execute command
shown below, where text inside quotation marks after the semicolon is replaced with path to bin directory
inside OpenSSL installation directory (specified in step 4):
Figure 33. ..Path to Bin Directory Inside OpenSSL
8. Change active PowerShell directory to work folder used in step 2. Use cd command followed by directory
path and press Enter. Include quotation marks at the start and end of the path if the path includes any
whitespaces.
Figure 34. Changing Active PowerShell Directory to Work Folder
9. Get current execution policy by executing Get-ExecutionPolicy command and make note of the output.
10. If output from step 9 is other than Unrestricted, execute command below to set ExecutionPolicy. Original
setting can be restored after CA and leaf certificates are generated (in section 4.3). Using Unrestricted
execution policy will let PowerShell execute script used in this application project.
Figure 35. Get-ExecutionPolicy Command
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 18 of 36
Oct.23.20
11. Confirm changes to execution policy by typing y and pressing Enter.
12. Execute the script with . .\ca-certs.ps1 (notice the first two dot characters before backward-slash).
This will introduce several new functions into the current PowerShell session. When prompted to confirm
script execution, press r and hit Enter.
Figure 36. Executing Script with ‘. .\ca-certs.ps1
13. Run Test-CACertsPrerequisites command. First two tests should return ok. Final test will return
an error associated with missing OPENSSL_CONF definition. Since OpenSSL will use built-in defaults
under such circumstances, this error message can be ignored.
Figure 37. Running Test-CACertsPrerequisitesCommand
5.2 Creating and Verifying a Certificate Chain
1. Create root certificate, type New-CACertsCertChain rsa into PowerShell and confirm with Enter.
Verify that the function outputs Success, as shown below. The output certificates will be added to the
Windows Certificate store automatically and can be removed at the end of this application project.
Figure 38. Creating the Root Certificate
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 19 of 36
Oct.23.20
2. Go to the IoT Central application in the web browser and select Administration from the menu on the
left side. Once in the Administration view, select Device Connection.
Figure 39. Selecting the Device Connection
3. Click + Create enrollment groupunder Device Connection.
Figure 40. Creating the Enrollment Group
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 20 of 36
Oct.23.20
4. Enter the Name for the new enrollment group, Group type as IoT devices, choose the Attestation type
as Certificate (X.509) option and Save button.
Figure 41. Selecting the Options for the New Enrollment Group
5. Open the enrollment group just created as shown below.
Figure 42. Opening the Enrollment Group Created
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 21 of 36
Oct.23.20
6. Click + Manage primary option as shown below.
Figure 43. Clicking the ‘+Manage primary’ Option
7. Click on Upload button for Primary certificate.
Figure 44. Clicking UploadButton for the Primary Certificate
8. File upload prompt will now open. Navigate to the work folder used in step 1 and select RootCA.pem file.
9. Azure will parse the root certificate and will report that it needs to be verified. Click on the Gear icon to
bring up Primary Certificate pop-up.
Figure 45. Primary Certificate Pop-up
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 22 of 36
Oct.23.20
10. In the Certificate Verification section of the window, press Refresh button to generate Verification
Code against the root certificate.
Figure 46. Generating Verification Code
11. Copy the generated Verification Code into the clipboard. Use Copy button to avoid mistakes.
Figure 47. Certificate Verification Window
12. Keep Primary Certificate pop-up open in the browser and go back to the PowerShell window. Type
New-CACertsVerificationCert followed by space and the verification code copied to the clipboard
in previous step. Right-clicking inside PowerShell window will paste content from the clipboard
automatically. Confirm command execution by hitting Enter.
Figure 48. Verifying Certification
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 23 of 36
Oct.23.20
13. Go back to the web browser where Primary Certificate pop-up should still be left open. Press Verify
button at the bottom of the window.
Figure 49. Pressing Verify Button
14. Another file upload prompt will open. Select verifyCert4.cer file and confirm choice. Azure will
parse the uploaded file and will produce notification that the primary certificate is now verified. Click
Close to go back to IoT Central application.
Figure 50. Primary Certificate Verification
5.3 Creating a Device Certificate
1. To create leaf certificate, type New-CACertsDevice followed by space and the device name into the
PowerShell console. Use name (Device ID) provided on IoT Central in earlier sections (as specified in
section 4, step 20). Function will prompt for user password twice any text can be provided here however
it must be the same on both occasions. Script will output certificate files to the work folder.
Figure 51. Creating Leaf Certificate
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 24 of 36
Oct.23.20
2. Open the device certificate <device_id>-public.pem file using Notepad++ or similar utility. Copy the
contents and convert them into strings. Open azure.h file in src directory, copy the converted string to
DEVICE_X509_TRUST_PEM_FILE macro. Refer to example shown in the following image.
Note: By default, the application project contains a sample device certificate. Refer to the existing format
and replace it with newly generated device certificate.
3. Open the device private key <device_id>-private.pem file using Notepad++ or similar utility. Copy the
contents and convert them into strings. Open azure.h file in src directory, copy the converted string to
DEVICE_PRIVATE_KEY_FILE macro. Refer to example shown in the following image.
Note: By default, the application project contains a sample device private key. Refer to the existing format
and replace it with newly generated device private key.
Figure 52. Device Private Key Generation Example
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 25 of 36
Oct.23.20
Building the Application
1. In case of running Azure_EK_RA6M3_WiFi project, open user_cfg.h insert your Wi-Fi network name
(SSID) and password in the designated defines between the quotation marks.
Figure 53. Entering Wi-Fi Network Name and Password
2. The project is now ready to compile. Press the “hammer” icon to start building the project.
Figure 54. Starting to Build the Project
3. The toolchain will report compilation and build status to the console pane in the lower-right corner of e
2
studio. When the build has completed, it should confirm that there are zero errors and four warnings. All
warnings come from the third-party code.
Figure 55. Compilation and Build Status Report
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 26 of 36
Oct.23.20
Connecting to Azure IoT Cloud Server
This section covers establishing connectivity with the Azure Device Provisioning Service (DPS) server.
Establishing a connection with DPS will be necessary to detect additional connection details such as the
assigned hub these will be needed in subsequent sections when using MQTT.
Using the connection string from DPS, the RA device will establish connection to the corresponding Azure
IoT Hub. Upon, connection, the RA device will be able to periodically upload the sensor telemetry data to the
Microsoft Azure hub. Microsoft’s server-side backend will manage the information so that it will later be
displayed inside an IoT Central application.
1. The application is now ready to be programmed and run on the EK-RA6M3 board. Press the “bug” icon to
begin the debug session.
Figure 56. Starting the Debug Session
2. You may be prompted to update the J-Link debugger firmware. You can click Yes to update. It should not
take long to complete.
Figure 57. J-Link Debugger Firmware Update Prompt
3. Windows could also prompt you to allow the GBD server through your firewall. Click the checkbox to allow
it through private networks, then Allow access.
Figure 58. Allowing Access to the GBD Server
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 27 of 36
Oct.23.20
4. e
2
studio will perform flash programming routines and prompt to switch to Debug perspective. Select the
check box by Remember my decision and click Yes. LED5 near the debug USB port will blink while
programming.
5. The debug session is now started, and the application is paused at its entry function (Reset_Handler).
At this point, you can set up additional debug features such as variable and expressions views before the
program is executed. Select the Expressions tab on the top right pane of the e
2
studio window:
Figure 59. Selecting Expressions Tab on the Top Right Pane
6. Click Add new expression and type “temp” for the symbol. Confirm the symbol name by pressing Enter
on the keyboard. This variable holds temperature readings from the On-chip temperature sensor.
Figure 60. Adding New Expression of Type temp
7. Right-click the temp table entry and select Real-time Refresh. symbol to the left of temp shows that
real-time refresh has been enabled.
Figure 61. Selecting Real-time Refresh
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 28 of 36
Oct.23.20
8. Click the Resume button or press F8 on the keyboard to start the application.
Figure 62. Starting the Application
9. The Program will stop again, this time at the start of the main function. Low-level initialization routines are
now completed, and the temp and hum values reported on the Expressions pane should be 0. Press
Resume or F8 again to resume the application and begin executing user code.
10. As the program is executing the Expressions view will report changing value for the temp and hum
variables.
Figure 63. Expressions View
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 29 of 36
Oct.23.20
11. Open the serial console such as Tera Term to check the serial debug messages from the EK-RA6M3 kit.
The RA device establishes connection with the Azure DPS to obtain the connection string. The RA
device establishes connection with the Azure IoT Hub using the connection string obtained from Azure
DPS and periodically publishes sensor data.
Figure 64. Serial Log Message for X.509 Based Authentication using Ethernet Interface
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 30 of 36
Oct.23.20
Figure 65. Serial Log Message for X.509 Based Authentication using Wi-Fi Interface
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 31 of 36
Oct.23.20
12. The RA device also publishes the read-only device property (manufacturer) string “Renesas Electronics
America only once after connecting to Azure IoT Central application. Go back to the web browser with
the Azure IoT Central application open. Select the Devices tab and click on the device name. If the
About window is not displayed, then select About tab to see this property update.
Figure 66. Read only Device Property in About Tab
13. Go back to the web browser with the Azure IoT Central application open. Select the Devices tab and
click on the device name. If the Overview window is not displayed, then select Overview to see the
temperature sensor readings received from the device.
Figure 67. Viewing Temperature Sensor Readings in Overview Window
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 32 of 36
Oct.23.20
14. Note that the RA device is only sending the value every few seconds to conserve network bandwidth and
the IoT Central application is performing averaging over fixed periods of time, so it may take some time
(15-20 seconds) before the first value is shown on the graph or for subsequent values to be posted to
IoT Central.
Figure 68. Temperature Sensor Readings
15. Click the About tab to check the device property reported from EK-RA6M3 kit.
Figure 69. Checking Device Property in About Tab
16. Click the Terminate button or press Ctrl + F2 on the keyboard to stop the application and terminate the
debug session.
Figure 70. Stopping the Application and Terminating the Debug Session
Receiving Messages from the IoT Central Application
The previous sections showed how we can send MQTT data from our device up to the cloud. We can also
receive information and commands from the cloud and act on them. We already configured a led_toggle
command in IoT Central previously and we will now hook that up to toggle LEDs on the dev kit.
1. Build the project and start the debug session once the project is compiled and error-free.
2. Click the Resume button twice and switch to the Tera Term window. Go to Edit and select Clear Buffer.
3. The RA device establishes connection with the Azure IoT Hub using the connection string obtained from
Azure DPS and periodically publish sensor data.
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 33 of 36
Oct.23.20
4. In the Azure IoT Central application, click on the Devices tab and select the device we created for this
application project. In the device window, go to command tab and click the Run button as highlighted
below.
Figure 71. Clicking Run Button on the Command Tab
5. IoT Central will report that the message was sent, and the Tera Term console will display its contents.
The three LEDs under the user buttons on the EK-RA6M3 kit will toggle on and off for each press of the
Run button.
Figure 72. Tera Term Console Display
Congratulations! You’ve reached the end of this application project. Your RA application is now complete.
You can use it as a starting point for your own Azure cloud applications by utilizing other components of the
Flexible Software Package and Azure IoT Central.
Cleaning up PowerShell and Windows Certificate Store
1. Go back to the PowerShell window and type Set-ExecutionPolicy -ExecutionPolicy followed
by space and the execution policy name retrieved in section 5, step 9. Usually this setting is
Restricted. Press Enter to execute the command. When prompted, write y and press Enter again.
Figure 73. Setting the Execution Policy
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 34 of 36
Oct.23.20
2. The PowerShell window can now be closed.
3. Open start menu and type manage computer certificates and select the best match suggestion pointing to
Control Panel widget.
Figure 74. Managing Computer Certificates
4. Certificate Manager (certlm) will now open. From the menu on the left side, expand Personal and select
Certificates.
5. Select and delete (that is, by pressing Delete on the keyboard) every certificate issued by entity starting
with Azure IoT CA TestOnly.
Figure 75. Deleting Certificates Issued by Entities Starting with ‘Azure IoT Test CA TestOnly’
6. Expand Trusted Root Certification Authorities on the left side and select Certificates. Repeat the
process from step 5 – this category should only have one certificate issued by Azure IoT CA TestOnly
Root CA.
7. Close Certificate Manager.
Next Steps and References
Refer to the following GitHub repository for various FSP modules example projects and application
projects (https://github.com/renesas/ra-fsp-examples/
)
Refer to Establishing and Protecting Device Identity using SCE7 and Security MPU (R11AN0449) on
renesas.com
Refer to Securing Data at Rest utilizing the RA Security MPU (R11AN0416) on renesas.com
Refer to Azure GitHub link for more details on Azure SDK for Embedded C
(https://github.com/Azure/azure-sdk-for-c
)
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 35 of 36
Oct.23.20
Website and Support
Visit the following vanity URLs to learn about key elements of the RA family, download components and
related documentation, and get support.
RA Product Information
renesas.com/ra
RA Product Support Forum
renesas.com/ra/forum
RA Flexible Software Package
renesas.com/FSP
Renesas Support
renesas.com/support
Renesas RA Family RA Azure IoT Cloud Connectivity Solution
R11AN0474EU0100 Rev.1.00 Page 36 of 36
Oct.23.20
Revision History
Rev.
Date
Description
Page
Summary
1.00
Oct.23.20
First release document
© 2020 Renesas Electronics Corporation. All rights reserved.
Notice
1. Descriptions of circuits, software and other related information in this document are provided only to illustrate the operation of semiconductor products
and application examples. You are fully responsible for the incorporation or any other use of the circuits, software, and information in the design of your
product or system. Renesas Electronics disclaims any and all liability for any losses and damages incurred by you or third parties arising from the use
of these circuits, software, or information.
2. Renesas Electronics hereby expressly disclaims any warranties against and liability for infringement or any other claims involving patents, copyrights,
or other intellectual property rights of third parties, by or arising from the use of Renesas Electronics products or technical information described in this
document, including but not limited to, the product data, drawings, charts, programs, algorithms, and application examples.
3. No license, express, implied or otherwise, is granted hereby under any patents, copyrights or other intellectual property rights of Renesas Electronics
or others.
4. You shall not alter, modify, copy, or reverse engineer any Renesas Electronics product, whether in whole or in part. Renesas Electronics disclaims any
and all liability for any losses or damages incurred by you or third parties arising from such alteration, modification, copying or reverse engineering.
5. Renesas Electronics products are classified according to the following two quality grades: “Standard” and “High Quality”. The intended applications for
each Renesas Electronics product depends on the product’s quality grade, as indicated below.
"Standard": Computers; office equipment; communications equipment; test and measurement equipment; audio and visual equipment; home
electronic appliances; machine tools; personal electronic equipment; industrial robots; etc.
"High Quality": Transportation equipment (automobiles, trains, ships, etc.); traffic control (traffic lights); large-scale communication equipment; key
financial terminal systems; safety control equipment; etc.
Unless expressly designated as a high reliability product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas
Electronics document, Renesas Electronics products are not intended or authorized for use in products or systems that may pose a direct threat to
human life or bodily injury (artificial life support devices or systems; surgical implantations; etc.), or may cause serious property damage (space
system; undersea repeaters; nuclear power control systems; aircraft control systems; key plant systems; military equipment; etc.). Renesas Electronics
disclaims any and all liability for any damages or losses incurred by you or any third parties arising from the use of any Renesas Electronics product
that is inconsistent with any Renesas Electronics data sheet, user’s manual or other Renesas Electronics document.
6. When using Renesas Electronics products, refer to the latest product information (data sheets, user’s manuals, application notes, “General Notes for
Handling and Using Semiconductor Devices” in the reliability handbook, etc.), and ensure that usage conditions are within the ranges specified by
Renesas Electronics with respect to maximum ratings, operating power supply voltage range, heat dissipation characteristics, installation, etc. Renesas
Electronics disclaims any and all liability for any malfunctions, failure or accident arising out of the use of Renesas Electronics products outside of such
specified ranges.
7. Although Renesas Electronics endeavors to improve the quality and reliability of Renesas Electronics products, semiconductor products have specific
characteristics, such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. Unless designated as a high reliability
product or a product for harsh environments in a Renesas Electronics data sheet or other Renesas Electronics document, Renesas Electronics
products are not subject to radiation resistance design. You are responsible for implementing safety measures to guard against the possibility of bodily
injury, injury or damage caused by fire, and/or danger to the public in the event of a failure or malfunction of Renesas Electronics products, such as
safety design for hardware and software, including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for
aging degradation or any other appropriate measures. Because the evaluation of microcomputer software alone is very difficult and impractical, you are
responsible for evaluating the safety of the final products or systems manufactured by you.
8. Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas
Electronics product. You are responsible for carefully and sufficiently investigating applicable laws and regulations that regulate the inclusion or use of
controlled substances, including without limitation, the EU RoHS Directive, and using Renesas Electronics products in compliance with all these
applicable laws and regulations. Renesas Electronics disclaims any and all liability for damages or losses occurring as a result of your noncompliance
with applicable laws and regulations.
9. Renesas Electronics products and technologies shall not be used for or incorporated into any products or systems whose manufacture, use, or sale is
prohibited under any applicable domestic or foreign laws or regulations. You shall comply with any applicable export control laws and regulations
promulgated and administered by the governments of any countries asserting jurisdiction over the parties or transactions.
10. It is the responsibility of the buyer or distributor of Renesas Electronics products, or any other party who distributes, disposes of, or otherwise sells or
transfers the product to a third party, to notify such third party in advance of the contents and conditions set forth in this document.
11. This document shall not be reprinted, reproduced or duplicated in any form, in whole or in part, without prior written consent of Renesas Electronics.
12. Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas
Electronics products.
(Note1) “Renesas Electronics” as used in this document means Renesas Electronics Corporation and also includes its directly or indirectly controlled
subsidiaries.
(Note2) “Renesas Electronics product(s)” means any product developed or manufactured by or for Renesas Electronics.
(Rev.4.0-1 November 2017)
Corporate Headquarters
Contact information
TOYOSU FORESIA, 3-2-24 Toyosu,
Koto-ku, Tokyo 135-0061, Japan
www.renesas.com
For further information on a product, technology, the most up-to-date
version of a document, or your nearest sales office, please visit:
www.renesas.com/contact/
.
Trademarks
Renesas and the Renesas logo are trademarks of Renesas Electronics
Corporation. All trademarks and registered trademarks are the property
of their respective owners.