Skip to content

Getting Started with M.2 Dock

Introduction

This guide is intended to assist users in the initial setup and demonstration of the basic usage with M.2 Dock:

What you'll need

Assemble the hardware

  1. Make sure the M.2 Dock is powered off

  2. Attach the provided 2.4GHz and NFC cabled PCB antennas to the nRF52840 M.2 module as shown in the figure below:

    Attaching Antennas

  3. Insert the module into the connector as shown in the figure below:

    Angle of Insertion

    Angled insertion is allowable and preferred to minimize the insertion force. The angle of insertion is 5° ~ 25°, typically 20°.

    Module Insertion

  4. Secure the module using the provided mounting screw as shown in the figure below:

    Secure the module

Connect the board

  1. Mount the nRF52840 M.2 Module
  2. Connect the Debugger USB port of M.2 Dock to your PC using the provided USB-C Cable
  3. A disk drive called M2-DOCK will be automatically detected by the computer.

Logging via Serial port

M.2 Dock enables developers with a Virtual COM Port which you can use for logging and reporting application state.

There are many Terminal applications available for your host PC. They provide a window where your target can print messages. Select the tool according to your host:

Drag-n-Drop Programming

Drag-n-Drop is an optional intuitive programming feature. It allows programming of your target MCU in a very simple way: dragging and dropping a file (.hex-format) onto the M2-DOCK drive.

There is no need to install application software. Anyone that can drag and drop a file to a USB memory stick can now program the target module.

Tip

Upon completion, the drive remounts. If a failure occurs, the file FAIL.TXT appears on the drive containing information about the failure.

Using pyOCD Command Tool

pyOCD is an open source Python package for programming and debugging Arm Cortex-M microcontrollers using the DAPLink debugger. It is fully cross-platform, with support for Linux, macOS, and Windows.

The latest stable version of pyOCD can be installed via pip as follows. Skip the installation if pyOCD already exists.

pip install -U pyocd

List information about the debugger connected to your computer by running:

pyocd list

The output should be similar as below:

  #   Probe                   Unique ID
--------------------------------------------------------------------------------
  0   ARM DAPLink CMSIS-DAP   10283602185129a100000000000000000000000097969902

The following commands demonstrate how to flash/erase the nRF52840 M.2 Module:

  • To erase the whole flash of the nRF52840 target:

    pyocd erase -t nrf52840 --chip
    
  • To flash the nRF52840 target with .hex-format firmware:

    pyocd flash -t nrf52840 Sample.hex
    
  • To flash the nRF52840 target with a plain binary:

    pyocd flash -t nrf52840 --base-address 0x1000 Sample.bin
    
    The --base-address option is used for setting the address where to flash a binary. Defaults to start of flash.

Tip

Run pyocd --hlep to get the available commands and additional help.

Explore Further

Now that you are familiar with the M.2 Dock, it's time to explore more tutorials available below:

We also offer the nRF52840 M.2 Developer Kit to help you prototype your application and then scale to production faster using the nRF52840 M.2 Module combined with your custom PCB hardware.

Create an Issue

Interested in contributing to this project? Want to report a bug? Feel free to click here: