Home

Awesome


page_type: sample languages:


Sample: MT3620 real-time capability application using Azure RTOS

This sample demonstrates how Azure Sphere and Azure RTOS are able to run together on MT3620 Development Kit.

This sample app for an MT3620 real-time core running Azure RTOS that creates several threads and repeatedly transmits message over a UART. These messages can be read in terminal application on a computer using a USB-to-serial adapter. By default, it uses the real-time core's dedicated UART, but if your hardware doesn't expose this UART's TX pin, then the sample can be altered to use a different UART.

To use this sample, clone the repository locally if you haven't already done so:

git clone --recursive https://github.com/Azure-Samples/Azure-RTOS-on-Azure-Sphere-Mediatek-MT3620

Contents

File/folderDescription
demo_threadxSample source code.
threadxAzure RTOS ThreadX source code (submodule).
mt3620_m4_softwareMediaTek 3620 HAL (submodule).
README.mdThis README file.

Prerequisites

  1. Seeed MT3620 Development Kit or other hardware that implements the MT3620 Reference Development Board (RDB) design.

  2. A USB-to-serial adapter (for example, FTDI Friend) to connect the real-time core UART to a USB port on your computer.

  3. A terminal emulator (such as Telnet or Termite to display the output.

Prepare your device

To prepare your device on Windows:

  1. Right-click the Azure Sphere Developer Command Prompt shortcut and select More>Run as administrator.

    The --enable-rt-core-debugging parameter requires administrator privilege because it installs USB drivers for the debugger.

  2. Enter the following azsphere command:

    azsphere device enable-development --enable-rt-core-debugging
    
  3. Close the window after the command completes because administrator privilege is no longer required. As a best practice, you should always use the lowest privilege that can accomplish a task.

To prepare your device on Linux:

  1. Enter the following azsphere command:

    azsphere device enable-development --enable-rt-core-debugging
    

You may need to update the OS by using if you have an older device.

azsphere device recover

Set up hardware to display output

To prepare your hardware to display output from the sample:

  1. Attach the USB-to-serial adapter to your PC.

For Seeed RDB

  1. Connect GND on the USB-to-serial adapter to GND on your dev kit. On MT3620 RDB hardware, GND is Header 2, pin 2.

  2. Connect RX on the USB-to-serial adapter to TXD0 on your dev kit. On MT3620 RDB hardware, TXD0 is Header 2, pin 3.

Pinout

For Avnet Azure Sphere Starter Kit

  1. Connect GND on the USB-to-serial adapter to GND on your dev kit. On Avnet Azure Sphere Starter Kit hardware, GND is Click Socket #1, Header 2, pin 8.

  2. Connect RX on the USB-to-serial adapter to TXD0 on your dev kit. On Avnet Azure Sphere Starter Kit hardware, TXD0 is Click Socket #1, Header 2, pin 4.

Pinout

For Windows:

  1. Determine which COM port the adapter uses on the PC. If you're using the FTDI Friend adapter, start Device Manager, select View > Devices by container, and look for FT232R USB UART.

  2. On the PC, start a terminal emulator and then open a 115200-8-N-1 terminal to the COM port used by the adapter.

For Linux:

  1. Find out which port the serial device is connected to:

    dmesg | grep ttyUSB
    

    The port should be named ttyUSBn, where n indicates the port number.

  2. Set up a terminal program to monitor the port. For example, the following commands set up Minicom to monitor port 5, but you can use any program you prefer:

    sudo apt install minicom
    
    sudo minicom -D /dev/ttyUSB5 -b 115200
    

Build and run the sample

See tutorial to learn how to build and deploy this sample: Tutorial: Build a real-time capable application

Note: You need Azure Sphere SDK version >= 20.07 to build and run the sample.

Observe the output

The connected terminal emulator should display output from the demo_threadx program. The program outputs the threads status incrementally:

Output

References

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.