Skip to content

Latest commit

 

History

History
104 lines (66 loc) · 5.73 KB

mbed_get_started.md

File metadata and controls

104 lines (66 loc) · 5.73 KB

Run a simple C sample on Freescale FRDM-K64F device running mbed

Table of Contents

Introduction

About this document

This document describes the steps for connecting an mbed-enabled Freescale FRDM-K64F device to Azure IoT Hub. This multi-step process includes:

  • Configuring Azure IoT Hub
  • Registering your IoT device
  • Build and deploy Azure IoT SDK on device

Step 1: Prerequisites

You should have the following items ready before beginning the process:

Step 2: Prepare your Device

  • Connect the board to your network using an Ethernet cable. This step is required, as the sample depends on internet access.

  • Plug the device into your computer using a micro-USB cable. Be sure to attach the cable to the USB port next to the reset button on the FRDM-K64F device.

  • Follow the instructions on the mbed handbook to set up the serial connection with your device from your development machine. If you are on Windows, install the Windows serial port drivers located here.

Step 3: Build and Run the sample

Create mbed project and import the sample code

Build and run the program

  • Click Compile to build the program. You can safely ignore any warnings, but if the build generates errors, fix them before proceeding.

  • If the build is successful, a .bin file with the name of your project is generated. Copy the .bin file to the device. Saving the .bin file to the device causes the current terminal session to the device to reset. When it reconnects, reset the terminal again manually, or start a new terminal. This enables the mbed device to reset and start executing the program.

  • Connect to the device using an SSH terminal program, such as PuTTY. You can determine which serial port your device uses by checking the Windows Device Manager:

  • In PuTTY, click the Serial connection type. The device most likely connects at 115200, so enter that value in the Speed box. Then click Open: NOTE Try 9600 if unable to communicate with the board.

The program starts executing. You may have to reset the board (press CTRL+Break or press on the board's reset button) if the program does not start automatically when you connect.

Monitor device data and send messages

  • See Manage IoT Hub to learn how to observe the messages IoT Hub receives from the application and how to send cloud-to-device messages to the application.