Tutorial: mbed-Part 1

Overview

In this tutorial, you will use ‘mbed’ online compiler to handle several peripherals of MCU (ARM-Cortex M4). Using the given platform, you will perform some tasks about GPIO, timer and interrupt.

The objectives of this lab are

  • Practice to use ‘mbed’ library in online compiler.

  • Understand digital in/out peripheral in MCU.

  • Understand timer and interrupt function of MCU.

  • Handle GPIO, timer and interrupt using ‘mbed’ library.

Hardware

​ Figure 1. Pin configuration for NUCLEO-F411RE board (same pin configuration with NUCLE-F401Re)

Tutorial

Creating account

Open https://www.mbed.com/en/

Create new account

image-20210811204723487

If you already have an account, then click on 'Compiler'

****

Creating New Program

On menu bar, **** select New>Create New Program.

For the first project, it can ask for ‘add new platform’.

****

Hardware Setting

For the Platform, select your MCU board.

  1. For NUCLEO-F411RE:

  • Click ‘Add Platform’ > Search for ‘NUCLEO-F411RE’ board

  • Click ‘Add to your Mbed Compiler’ and ‘Open Mbed Complier

add_platform
mbed_compiler

2. For NUCLEO-F401RE:

  • Click ‘Add Platform’ > Search for ‘NUCLEO-F401RE’ board

  • Click ‘Add to your Mbed Compiler’ and ‘Open Mbed Complier

401

New program

Set the Program Name as: ‘Tutorial1_GPIO_LED’.

Right-Click on the Program name in Program Workspace. Then, create new file. Name the source file as ‘main.cpp’.

Import 'mbed' Library

Right-Click on the Program name in Program Workspace. Select Import Library.

On the Import Wizard Window > Libraries tab : Search 'mbed'. Choose the mbed created by 'mbed_official'.

Compile

Copy and paste the following source code on ‘main.cpp’.

Then, compile the program by clicking on ‘Compile’ button.

compile

If the compilation is successful, the binary file of the project "**.bin" will be created and downloaded on your computer.

Import to MCU

Connect the MCU board to your PC via USB cable and check if a new memory drive of “NODE_F401RE (E:)” is created in your computer.

To load the binary program onto the MCU, copy the downloaded binary file to the drive “NODE_F401RE (E:)”.

If the program is loaded successfully then LED(LD1) will be green light.

Click reset button on MCU if nothing happens'

****

****

****

Last updated

Was this helpful?