Amazon FreeRTOS
User Guide

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Getting Started with the MediaTek MT7697Hx Development Kit

This tutorial provides instructions for getting started with the MediaTek MT7697Hx Development Kit. If you do not have the MediaTek MT7697Hx Development Kit, visit the AWS Partner Device Catalog to purchase one from our partner.

Before you begin, you must configure AWS IoT and your Amazon FreeRTOS download to connect your device to the AWS Cloud. See First Steps for instructions. In this tutorial, the path to the Amazon FreeRTOS download directory is referred to as <amazon-freertos>.

Overview

This tutorial contains instructions for the following getting started steps:

  1. Installing software on the host machine for developing and debugging embedded applications for your microcontroller board.

  2. Cross compiling an Amazon FreeRTOS demo application to a binary image.

  3. Loading the application binary image to your board, and then running the application.

  4. Interacting with the application running on your board across a serial connection, for monitoring and debugging purposes.

Set Up Your Development Environment

Before you set up your environment, connect your computer to the USB port on the MediaTek MT7697Hx Development Kit.

Download and Install Keil MDK

You can use the GUI-based Keil Microcontroller Development Kit (MDK) to configure, build, and run Amazon FreeRTOS projects on your board. Keil MDK includes the μVision IDE and the μVision Debugger.

Note

Keil MDK is supported on Windows 7, Windows 8, and Windows 10 64-bit machines only.

To download and install Keil MDK

  1. Go to the Keil MDK Getting Started page, and choose Download MDK-Core.

  2. Enter and submit your information to register with Keil.

  3. Right-click the MDK executable and save the Keil MDK installer to your computer.

  4. Open the Keil MDK installer and follow the steps to completion. Make sure that you install the MediaTek device pack (MT76x7 Series).

Establish a Serial Connection

To establish a serial connection with the MediaTek MT7697Hx Development Kit, you must install the Arm Mbed Windows serial port driver. You can download the driver from Mbed. Follow the steps on the Windows serial driver page to download and install the driver for the MediaTek MT7697Hx Development Kit.

After you install the driver, a COM port appears in the Windows Device Manager. For debugging, you can open a session to the port with a terminal utility tool such as HyperTerminal or TeraTerm.

Note

If you are having trouble connecting to your board after you install the driver, you might need to reboot your machine.

Build and Run the Amazon FreeRTOS Demo Project with Keil MDK

To build the Amazon FreeRTOS demo project in Keil μVision

  1. From the Start menu, open Keil μVision 5.

  2. Open the projects/mediatek/mt7697hx-dev-kit/uvision/aws_demos/aws_demos.uvprojx project file.

  3. From the menu, choose Project, and then choose Build target.

    After the code is built, you see the demo executable file at projects/mediatek/mt7697hx-dev-kit/uvision/aws_demos/out/Objects/aws_demo.axf.

To run the Amazon FreeRTOS demo project

  1. Set the MediaTek MT7697Hx Development Kit to PROGRAM mode.

    To set the kit to PROGRAM mode, press and hold the PROG button. With the PROG button still pressed, press and release the RESET button, and then release the PROG button.

  2. From the menu, choose Flash, and then choose Configure Flash Tools.

  3. In Options for Target 'aws_demo', choose the Debug tab. Select Use, set the debugger to CMSIS-DAP Debugger, and then choose OK.

  4. From the menu, choose Flash, and then choose Download.

    μVision notifies you when the download is complete.

  5. Use a terminal utility to open the serial console window. Set the serial port to 115200 bps, none-parity, 8-bits, and 1 stop-bit.

  6. Choose the RESET button on your MediaTek MT7697Hx Development Kit.

Monitoring MQTT Messages on the Cloud

You can use the MQTT client in the AWS IoT console to monitor the messages that your device sends to the AWS Cloud.

To subscribe to the MQTT topic with the AWS IoT MQTT client

  1. Sign in to the AWS IoT console.

  2. In the navigation pane, choose Test to open the MQTT client.

  3. In Subscription topic, enter iotdemo/#, and then choose Subscribe to topic.

Troubleshooting

Debugging Amazon FreeRTOS Projects in Keil μVision

Currently, you must edit the MediaTek package that is included with Keil μVision before you can debug the Amazon FreeRTOS demo project for MediaTek with Keil μVision.

To edit the MediaTek package for debugging Amazon FreeRTOS projects

  1. Find and open the Keil_v5\ARM\PACK\MediaTek\MTx\4.6.1\MediaTek.MTx.pdsc file in your Keil MDK installation folder.

  2. Replace all instances of flag = Read32(0x20000000); with flag = Read32(0x0010FBFC);.

  3. Replace all instances of Write32(0x20000000, 0x76877697); with Write32(0x0010FBFC, 0x76877697);.

To start debugging the project

  1. From the menu, choose Flash, and then choose Configure Flash Tools.

  2. Choose the Target tab, and then choose Read/Write Memory Areas. Confirm that IRAM1 and IRAM2 are both selected.

  3. Choose the Debug tab, and then choose CMSIS-DAP Debugger.

  4. Open vendors/mediatek/boards/mt7697hx-dev-kit/aws_demos/application_code/main.c, and set the macro MTK_DEBUGGER to 1.

  5. Rebuild the demo project in μVision.

  6. Set the MediaTek MT7697Hx Development Kit to PROGRAM mode.

    To set the kit to PROGRAM mode, press and hold the PROG button. With the PROG button still pressed, press and release the RESET button, and then release the PROG button.

  7. From the menu, choose Flash, and then choose Download.

    μVision notifies you when the download is complete.

  8. Press the RESET button on your MediaTek MT7697Hx Development Kit.

  9. From the μVision menu, choose Debug, and then choose Start/Stop Debug Session. The Call Stack + Locals window opens when you start the debug session.

  10. From the menu, choose Debug, and then choose Stop to stop the session. The program counter stops at the following line:

    { volatile int wait_ice = 1 ; while ( wait_ice ) ; }
  11. In the Call Stack + Locals window, change the value for wait_ice to 0.

  12. Set breakpoints in your project's source code, and run the code.

Troubleshooting the IDE Debugger Settings

If you are having trouble debugging an application, your debugger settings might be incorrect.

To verify that your debugger settings are correct

  1. Open Keil μVision.

  2. Right-click the aws_demos project, choose Options, and under the Utilities tab, choose Settings, next to “-- Use Debug Driver --”.

  3. Verify that the settings under the Debug tab appear as follows:

  4. Verify that the settings under the Flash Download tab appear as follows:

For general troubleshooting information about Getting Started with Amazon FreeRTOS, see Troubleshooting Getting Started.