|
| 1 | +# Getting Started with M.2 Dock |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This guide is intended to assist users in the initial setup and demonstration of the basic usage with M.2 Dock: |
| 6 | + |
| 7 | +* [Logging via Serial port](#logging-via-serial-port) |
| 8 | +* [Drag-n-Drop Programming](#drag-n-drop-programming) |
| 9 | +* [Using pyOCD Command Tool](#using-pyocd-command-tool) |
| 10 | + |
| 11 | +## What you'll need |
| 12 | + |
| 13 | +* A [nRF52840 M.2 Developer Kit](https://store.makerdiary.com/products/nrf52840-m2-developer-kit) (including nRF52840 M.2 Module and M.2 Dock) |
| 14 | +* A macOS, Linux or Windows computer |
| 15 | + |
| 16 | +## Assemble the hardware |
| 17 | + |
| 18 | +1. Make sure the M.2 Dock is powered off |
| 19 | + |
| 20 | +2. Attach the provided 2.4GHz and NFC cabled PCB antennas to the nRF52840 M.2 module as shown in the figure below: |
| 21 | + |
| 22 | +  |
| 23 | + |
| 24 | +3. Insert the module into the connector as shown in the figure below: |
| 25 | + |
| 26 | + !!! Warning "Angle of Insertion" |
| 27 | + Angled insertion is allowable and preferred to minimize the insertion force. The angle of insertion is **5° ~ 25°**, **typically 20°**. |
| 28 | + |
| 29 | +  |
| 30 | + |
| 31 | +4. Secure the module using the provided mounting screw as shown in the figure below: |
| 32 | + |
| 33 | +  |
| 34 | + |
| 35 | + |
| 36 | +## Connect the board |
| 37 | + |
| 38 | +1. Mount the nRF52840 M.2 Module |
| 39 | +2. Connect the **Debugger USB port** of M.2 Dock to your PC using the provided USB-C Cable |
| 40 | +3. A disk drive called **M2-DOCK** will be automatically detected by the computer. |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +## Logging via Serial port |
| 45 | + |
| 46 | +M.2 Dock enables developers with a Virtual COM Port which you can use for logging and reporting application state. |
| 47 | + |
| 48 | +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: |
| 49 | + |
| 50 | +* [screen](https://www.gnu.org/software/screen/manual/screen.html) (for macOS/Linux) |
| 51 | +* [PuTTY](https://www.chiark.greenend.org.uk/~sgtatham/putty/) (for Windows) |
| 52 | +* [CoolTerm](http://freeware.the-meiers.org/) (for macOS/Linux/Windows) |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +## Drag-n-Drop Programming |
| 57 | + |
| 58 | +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. |
| 59 | + |
| 60 | +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. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | +!!! tip |
| 65 | + Upon completion, the drive remounts. If a failure occurs, the file `FAIL.TXT` appears on the drive containing information about the failure. |
| 66 | + |
| 67 | +## Using pyOCD Command Tool |
| 68 | + |
| 69 | +[pyOCD](https://github.com/mbedmicro/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. |
| 70 | + |
| 71 | +The latest stable version of pyOCD can be installed via [pip](https://pip.pypa.io/en/stable/index.html) as follows. **Skip** the installation if pyOCD already exists. |
| 72 | + |
| 73 | +``` sh |
| 74 | +pip install -U pyocd |
| 75 | +``` |
| 76 | + |
| 77 | +List information about the probe connected to your computer by running: |
| 78 | + |
| 79 | +``` sh |
| 80 | +pyocd list |
| 81 | +``` |
| 82 | + |
| 83 | +The output should be similar as below: |
| 84 | + |
| 85 | +``` sh |
| 86 | + # Probe Unique ID |
| 87 | +-------------------------------------------------------------------------------- |
| 88 | + 0 ARM DAPLink CMSIS-DAP 10283602185129a100000000000000000000000097969902 |
| 89 | +``` |
| 90 | + |
| 91 | +The following commands demonstrate how to flash/erase the nRF52840 M.2 Module: |
| 92 | + |
| 93 | +* To erase the whole flash of the nRF52840 target: |
| 94 | + |
| 95 | + ``` sh |
| 96 | + pyocd erase -t nrf52840 --chip |
| 97 | + ``` |
| 98 | + |
| 99 | +* To flash the nRF52840 target with `.hex`-format firmware: |
| 100 | + |
| 101 | + ``` sh |
| 102 | + pyocd flash -t nrf52840 Sample.hex |
| 103 | + ``` |
| 104 | + |
| 105 | +* To flash the nRF52840 target with a plain binary: |
| 106 | + |
| 107 | + ``` sh |
| 108 | + pyocd flash -t nrf52840 --base-address 0x1000 Sample.bin |
| 109 | + ``` |
| 110 | + The `--base-address` option is used for setting the address where to flash a binary. Defaults to start of flash. |
| 111 | + |
| 112 | +!!! tip |
| 113 | + Run `pyocd --hlep` to get the available commands and additional help. |
| 114 | + |
| 115 | +## Explore Further |
| 116 | + |
| 117 | +Now that you are familiar with the M.2 Dock, it's time to explore more tutorials available below: |
| 118 | + |
| 119 | +* [Getting Started with Power Profiling](power-profiling.md) |
| 120 | +* [Debugging with pyOCD](debugging/pyocd.md) |
| 121 | +* [Debugging with Visual Studio Code](debugging/vscode.md) |
| 122 | +* [Debugging with Eclipse](debugging/eclipse.md) |
| 123 | +* [Debugging with Keil MDK](debugging/keil-mdk.md) |
| 124 | +* [Debugging with IAR Workbench](debugging/iar-ewarm.md) |
| 125 | +* [Upgrading the DAPLink Firmware](upgrading.md) |
| 126 | + |
| 127 | +We also offer the **[nRF52840 M.2 Developer Kit](https://store.makerdiary.com/products/nrf52840-m2-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. |
| 128 | + |
| 129 | +<a href="https://wiki.makerdiary.com/nrf52840-m2-devkit" target="_blank"><button class="md-tile md-tile--primary" style="width:auto;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M12.17 3.83c-.27-.27-.47-.55-.63-.88-.16-.31-.27-.66-.34-1.02-.58.33-1.16.7-1.73 1.13-.58.44-1.14.94-1.69 1.48-.7.7-1.33 1.81-1.78 2.45H3L0 10h3l2-2c-.34.77-1.02 2.98-1 3l1 1c.02.02 2.23-.64 3-1l-2 2v3l3-3v-3c.64-.45 1.75-1.09 2.45-1.78.55-.55 1.05-1.13 1.47-1.7.44-.58.81-1.16 1.14-1.72-.36-.08-.7-.19-1.03-.34a3.39 3.39 0 01-.86-.63zM16 0s-.09.38-.3 1.06c-.2.7-.55 1.58-1.06 2.66-.7-.08-1.27-.33-1.66-.72-.39-.39-.63-.94-.7-1.64C13.36.84 14.23.48 14.92.28 15.62.08 16 0 16 0z"></path></svg> nRF52840 M.2 Developer Kit</button></a> |
| 130 | + |
| 131 | +## Create an Issue |
| 132 | + |
| 133 | +Interested in contributing to this project? Want to report a bug? Feel free to click here: |
| 134 | + |
| 135 | +<a href="https://github.com/makerdiary/m2-dock/issues/new?title=Getting%20Started:%20%3Ctitle%3E"><button class="md-tile md-tile--primary"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 16" width="14" height="16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 011.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> Create an Issue</button></a> |
0 commit comments