Table of Contents

  1. mbed Interface v21164

Mbed OS 2 and Mbed OS 5

This is the handbook for Mbed OS 2. If you’re working with Mbed OS 5, please see the new handbook.

A place for listing beta versions of Firmware and Libraries...

mbed Interface v21164

A version of the mbed interface firmware that adds support for:

Functions to control the mbed interface debug connection and power state:

  • mbed_interface_disconnect() - tell the interface to disconnect the debug connection to the target (the channel usually used for semihost calls like LocalFileSystem fopen etc)
  • mbed_interface_powerdown() - tell the interface to disconnect the debug connection, and power down the interface (if not connected to USB)
  • mbed_interface_connected() - determine whether the mbed interface has a debug connection, based on whether debug is enabled in the core
  • mbed_interface_vbus() - check if the mbed interface has a USB connection

Official versions of some of the functions that already existed:

  • mbed_interface_reset() - tell the interface to perform a system reset
  • mbed_interface_uid() - get the unique id (UID) string of the mbed interface
  • mbed_mac_address() - get the 6-byte unique mac address, that is part of the mbed interface UID

To get the new firmware, download the following interface firmware to the mbed and power cycle to load it (disconnect USB/power and reconnect)

To get the new library functionality, delete the mbed library from your project and Import the latest beta library instead:


For the full details of the new APIs, see the mbed_interface.h headerfile documentation:

Powerdown Hello World!

#include "mbed.h"

DigitalOut led1(LED1);

int main() {

    led1 = mbed_interface_connected();  // is connected!
    led1 = mbed_interface_connected();  // no longer connected!

USB Connected Hello World!

#include "mbed.h"

DigitalOut led1(LED1);

int main() {

    while(1) {
        led1 = mbed_interface_vbus();  // led will be on when USB connected to interface (assumes VIN powered too :)

All wikipages