Getting started with ARM mbed

ARM® mbed™ is an IoT development platform for ARM based microcontrollers. The most beautiful thing is they move the IDE on your browser. You don’t have to use or install SDKs on your PC. There are a lot of example applications on their community. You can visit ARM mbed to know more about it.

We will bring you step by step, introduce how to develop MtConnect04S with ARM® mbed™.

Prepare devices

In this example,  we will build a motion sensor. It need 2 items, Motion Sensor Kits and DIPDAP debug probe.

First, the motion sensor kit is include MtConnnect04S with BLE mcu M904S,  MtSense03 with motion sensors, and MtAid01, the extension board.motion-kit-240

Order Motion Sensor Kit

Then, you need a DIPDAP. It is a debug probe which help to update the application to MtConnect04S. You can buy it on rs-online which is recommended by mbed™.daplink

BUY DIPDAP ON RS-ONLINE

Reprogram DIPDAP

When you get a new DIPDAP, it doesn’t contain a valid firmware to use. We program it now and it is easy, just copy and paste.

  • Push the button and connect to PC: It will appear as a disk drive called “CRP Disabled”
  • Download firmware: lpc11u35_swdap_nrf51822_if_crc.bin
  • Rename as and copy it onto the “CRP Disabled” drive.
    • On Linux/Mac, use command: dd if={new_firmware.bin} of={firmware.bin} conv=notrunc
  • Unplug your DIPDAP, and plug it back in
  • It should now appear as a disk drive called DAPLink

You could visit the DIPDAP page on mbed™ to know more detail, too.

Connect DIPDAP

mtaid01_dipdap.jpeg

Follow the upper chart to connect MtAid01 and DIPDAP with dupont wire. And stack MtConnect04S, MtSense03 and MtAid01 together.

Be careful! DO NOT connect micro USB to the MtAid01 in the same time,
or MtConnect04S will be broken.

mtc04s-mbed-connected.jpeg

Sign up

Register a new account on mbed developer%e8%9e%a2%e5%b9%95%e5%bf%ab%e7%85%a7-2016-11-16-%e4%b8%8a%e5%8d%8810-10-45

Build

Open the page of Compiler

螢幕快照 2016-11-16 上午10.18.33.png

Click import a program, it will need to add a platform in the first time. It shows a lot of mbed supported boards. MtConnect04S is compatible with Nordic nRF51-DK. Select Platform vendor as Nordic Semiconductor ASA on the left side then the Nordic nRF51-DK board will show up. Click it.
螢幕快照 2016-11-16 上午10.29.09.png

Then click the button Add to your mbed Compiler on the right side.螢幕快照 2016-11-16 上午10.41.58.pngBack to compiler page and reload. Then search mtconnect04s. There will be a program named MtConnect04S_Motion_Sensing in list. Select it and click Import! button.螢幕快照 2016-11-16 上午10.49.21.png

Now you have your first mbed program! It just likes any typical IDE which you usually use on PC. File explorer is on the left side, center is the editor, compile messages are on the bottom and the relative attributes are showed on the right side. main.cpp in the right side is the source code that read data from sensors via I²C bus, and advertise over bluetooth.

We don’t have to modify the code for now. So, click Compile.螢幕快照 2016-11-16 上午10.53.24.png

The compiler will start to compile. When it finishes, it will download a .hex file automatically. Save to anywhere you want. It is the firmware binary which we will run on MtConnect04S.

If you are familiar with Nordic SDK, the .hex file downloaded is include both application and softdevice.

Run

Drag the .hex file to the USB Drive DAPLINK. The DIPDAP will program MtConnect04. When it finishes, the drive will be removed automatically, and you may see an unexpected removing drive message.

螢幕快照 2016-11-16 下午12.12.11.png

Then push the button on DIPDAP, or replug USB to re-power up the kit. The LED on MtConnect04S will begin blinking. At the same time, MtConnect04S is also continuously reading the 3-axis accelerometer and gyrometer data from MtSense03, and advertise them to bluetooth in real-time.mbed-motion-blinking

App

Get it on Google Play
Download the app. It will show the measured value from the MtSense03. When you move the kit, the app will read the value measured in realtime.

Screenshot_2015-12-03-15-52-04Screenshot_2015-12-03-15-42-06

This tutorial is applicable with
 ✅MtConnect03
 ✅MtConnect04
 ✅MtConnect04S

Please feel free to contact us, if you need further information