R-Car/Boards/Yocto-Gen3/Azure IoT Edge/v5.9.0

Introduction
This page describes how to setup the Yocto environment to use the Azure IoT Edge with R-Car and run it.

This page contains information abot building and running AWS GreenGrass on Yocto environment on:
 * Renesas R-Car-H3 Starter Kit Premier (unofficial name - H3ULCB)
 * Renesas R-Car-M3 Starter Kit Pro (unofficial name - M3ULCB)
 * https://www.renesas.com/us/en/products/automotive-products/automotive-system-chips-socs/r-car-h3-m3-starter-kit
 * R-Car/Boards/CCPF-SK
 * http://www.shimafuji.co.jp/products/2308

Boards confirmed to work
NT='Not Tested' but will work

See also:
 * R-Car/Boards/H3SK
 * R-Car/Boards/M3SK

Set up in the Azure

 * 1) Create an Azure account
 * Create an Azure account with reference to https://azure.microsoft.com/en-us/free/.
 * 1) Create an Azure IoT Hub
 * Create an Azure IoT Hub with reference to Create an IoT hub.
 * 1) Register an Azure Device
 * Access https://portal.azure.com/ and select your IoT Hub.
 * Select "IoT Edge" under "Device Management" from the side menu, and then click "+ Add IoT Edge Device".
 * Azure-device-1.png
 * Then, set an arbitrary name for "Device ID" and click "Save" without changing the other settings.
 * And then, select "IoT Edge" under "Device Management" from the side menu, and click the device ID you created to check the "Primary Connection String".
 * (The "Primary Connection String" is used in Receive telemetry messages.)
 * Azure-device-3.png
 * 1) Add the Azure module
 * Add the Simulated Temperature Sensor module with reference to Deploy a module.

Required packages

 * 1) Install the required packages
 * Refer to Yocto Project Quick Start for more information.
 * 1) Set up initial git configuration
 * 1) Set up initial git configuration

Building the BSP

 * 1) Create the following script(build.sh) for building
 * 2) Build
 * target_board_name is specified for each board according to the following table:
 * R-car-sk-target-board-name.png
 * Depending on the performance of the host PC, it may take several hours for the build to complete.
 * When the build completes successfully, you will see the following output:
 * 1) Check the built images
 * The built images are stored in the following:
 * /build/tmp/deploy/images//
 * 1) Write the images to the SD card
 * Write the images to the SD card with reference to Loading kernel and rootfs via eMMC/SD card.
 * Please replace "core-image-weston" with "core-image-minimal".
 * 1) Write the images to the SD card
 * Write the images to the SD card with reference to Loading kernel and rootfs via eMMC/SD card.
 * Please replace "core-image-weston" with "core-image-minimal".

Receive telemetry messages

 * 1) Procedure on the target board
 * 2) Turn on the target board
 * 3) Insert the SD card into the target board, and connect the LAN cable to it.
 * 4) Use a microUSB cable to connect the target board, connect a power supply to it, and connect to serial console.
 * 5) Power on.
 * Short-press SW8 "Power" to switch the board on.
 * If the board is attached to the CCPF board, short-press SW4 "Power" instead of SW8.
 * 1) Configure U-Boot to boot from SD card
 * Refer to Configure U-Boot to boot from SD card.
 * 1) Connect to your IoT Hub
 * Configure to connect to your IoT Hub.
 * 1) Add a write permission to "/etc/iotedge/config.yaml".
 * 2) Set the "Primary Connection String" to device_connection_string.
 * See Register an Azure Device for the "Primary Connection String".
 * 1) Remove a write permission from "/etc/iotedge/config.yaml".
 * 2) Restart the IoT Edge daemon.
 * 3) Check that the IoT Edge daemon is running.
 * Azure-status-no-page.png
 * 1) Check that the following modules are deployed and are running.
 * It may take several minutes for the deployment to complete.
 * Azure-list.png
 * 1) Procedure on the Azure IoT Explorer
 * Check that it receives telemetry messages from the IoT Edge Device.
 * 1) Install the Azure IoT Explorer.
 * Download the installer from https://github.com/Azure/azure-iot-explorer/releases/tag/v0.14.1.
 * Use v0.14.1 because v0.14.7(latest version) does not receive any telemetry messages.
 * 1) Launch the Azure IoT Explorer.
 * 2) Get the "Primary Connection String" for the iothubowner.
 * Go the IoT Hub page on the Azure Portal, click your "IoT Hub", "Shared access policies" from the side menu, and then click "iothubowner". Next, copy the "Primary Connection string".
 * Azure-iot-exp-1.png
 * 1) Register your IoT Hub to the IoT Explorer
 * Select the "IoT hubs" from the side menu of the Azure IoT Explorer, and click "+ Add connection".
 * Paste the "Primary Connection string" you copied into the "Connection string" text box, finally click the "Save".
 * 1) Receive telemetry messages
 * Select the "Telemetry" from the side menu, and click "Start".
 * When a message is received, the following log is displayed.
 * Azure-iot-exp-3.png
 * Select the "IoT hubs" from the side menu of the Azure IoT Explorer, and click "+ Add connection".
 * Paste the "Primary Connection string" you copied into the "Connection string" text box, finally click the "Save".
 * 1) Receive telemetry messages
 * Select the "Telemetry" from the side menu, and click "Start".
 * When a message is received, the following log is displayed.
 * Azure-iot-exp-3.png