Skip to main content

Running Application

This section describes how to run Dual-Ethernet Application on ASG210 (For the more details, please refer to Dual Ethernet Operating System Block Diagram. ASG210 Dual-Ethernet Application consists of High-level application and Real-time capable application.

Step 1. Clone repository

Clone the repository

$ git clone https://github.com/WIZnet-Azure-Sphere/ASG210_App

Step 2. Network configuration

This application sends local data to Azure cloud. User should configure ASG210 connection to Local network and Global network as shown below.

Step 3. Real-time Capable Application

Set Local Network Information

To run Real-time capable application, user should set Local Network information. User can select static network and DHCP network.

Set up Static network

User can set up static network in ASG210_RTApp code. Go to this directory in ASG210_App, ASG210_App/Software/ASG210_RTApp_W5500_SPI_BareMetal and open main.c. Enable #define NETINFO_USE_MANUAL and set local network information.

Set up DHCP network

User can set up DHCP network in ASG210_RTApp code. Go to this directory in ASG210_App, ASG210_App/Software/ASG210_RTApp_W5500_SPI_BareMetal and open main.c. Disable #define NETINFO_USE_MANUAL.

Build and download

From the Select Startup Item menum on the tool bar, select GDB Debugger (RTCore). Click Build All on Build menu. Press F5 or Click Startup Item to start the RT application with debugging. (Please check Azure Sphere Development mode with Azure Sphere Developer Command Prompt.)

Prepare Azure Sphere development mode:

azsphere device enable-development

Step 4. Set High-Level application

Set up Azure IoT Hub for ASG210

To run this application, user should set up user’s own Azure IoT Hub service for ASG210. In this link, it describes how to create Azure IoT Hub and DPS service, then guides ASG210 authentication using DPS service.

https://docs.microsoft.com/en-us/azure-sphere/app-development/setup-iot-hub

Set Azure Cloud Parameters

To connect Azure Cloud, user must fullfil the parameters about Azure IoT Hub, DPS and Tenant ID on app_manifest.json in ASG210_HLApp.

Azure DPS Scope ID

Copy the ID Scope from Device Provisioning Service in Azure Portal.

Azure IoT Hub endpoint URL

Copy the IoT Hub endpoint URL from IoT Hun in Azure Portal.

Azure Sphere Tenant ID

Copy the Azure Sphere Tenant ID from Azure Sphere Developer Command Prompt

azsphere tenant show-selected

Set Wi-Fi Information

ASG210 supports auto switching between Public Ethernet and Wi-Fi. Public Ethernet interface has high priority. Please refer Configuration Wi-Fi Network Settings.

Set up Public Ethernet interface

To enable ethernet interface for public network and communication with Azure IoT, install ethernet imagepackage by deploying a board configuration image to ASG210. The board configuration image contains information that the Azure Sphere Security Service requires to add support for Ethernet to the Azure Sphere OS.

Follow these steps to enable public ethernet interface:

  1. Create a board configuration image package
azsphere image-package pack-board-config –-preset lan-enc28j60-isu0-int5 –-output 
  1. Prepare ASG210 for development mode
azsphere device enable-development
  1. Sideload a board configuration image package
azsphere device sideload deploy --imagepackage enc28j60-isu0-int5.imagepackage
  1. Check the sideloaded imagepackage
azsphere device image list-installed

Build and download

From the Select Startup Item menum on the tool bar, select GDB Debugger (HLCore). Click Build All on Build menu. Press F5 or Click Startup Item to start the HL application with debugging. (Please check Azure Sphere Development mode with Azure Sphere Developer Command Prompt.)

Prepare Azure Sphere development mode:

azsphere device enable-development

Step 5. Check application operation

Send data to ASG210 from Local Network

Set user device network address range and connect to ASG210 network address in Local network with TCP Client. After connection between user device and ASG210, user device can send JSON format data to transmit it to Azure Cloud through ASG210.

Check the data in Azure Cloud

ASG210 sends user device data to Azure Cloud. User can check the data sent from user device in Azure Cosmos DB or Storage.

Auto Switch in ASG210 Network Interface

This application supports auto switching network interface to guarantee Azure Cloud connection. If Ethernet connection is not working anymore, ASG210 switches from Ethernet to Wi-Fi interface and re-connects to Azure Cloud. (Vice versa works as well.)