mbed OS V5 BLE UARTService to USB/UART PassThru Example
Moxon Design : mbed OS V5 BLE UartService to USBUART passthru example
This example will advertise on BLE as "BLART" and allow BLE serial echo to the USB Serial port. Open a Bluetooth terminal application, like Nordic "nRF UART" and connect to "BLART", open a terminal emulator program, like "TeraTERM", and connect to the USB COM Port (like JLink CDC UART Port), and echo characters back and forth. Set UART_LoopBack = 1 for local loopback (e.g. BLE to BLE, USB-UART to USB-UART)
README.md@2:3e203cc2a88f, 2017-04-29 (annotated)
- Committer:
- moxondesign
- Date:
- Sat Apr 29 01:32:11 2017 +0000
- Revision:
- 2:3e203cc2a88f
- Parent:
- 0:2d1d68397ff7
mbed OS V5 working version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
moxondesign | 2:3e203cc2a88f | 1 | # Moxon Design mbed OS V5 BLE UartService to USBUART passthru |
moxondesign | 0:2d1d68397ff7 | 2 | |
moxondesign | 2:3e203cc2a88f | 3 | This guide reviews the steps required to get BLU UART working on an mbed OS platform. |
moxondesign | 0:2d1d68397ff7 | 4 | |
moxondesign | 0:2d1d68397ff7 | 5 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
moxondesign | 0:2d1d68397ff7 | 6 | |
moxondesign | 0:2d1d68397ff7 | 7 | ## Import the example application |
moxondesign | 0:2d1d68397ff7 | 8 | |
moxondesign | 0:2d1d68397ff7 | 9 | From the command-line, import the example: |
moxondesign | 0:2d1d68397ff7 | 10 | |
moxondesign | 0:2d1d68397ff7 | 11 | ``` |
moxondesign | 2:3e203cc2a88f | 12 | mbed import MoxDes-mbed-os-BLE-USB-passthru |
moxondesign | 2:3e203cc2a88f | 13 | cd MoxDes-mbed-os-BLE-USB-passthru |
moxondesign | 0:2d1d68397ff7 | 14 | ``` |
moxondesign | 0:2d1d68397ff7 | 15 | |
moxondesign | 0:2d1d68397ff7 | 16 | ### Now compile |
moxondesign | 0:2d1d68397ff7 | 17 | |
moxondesign | 0:2d1d68397ff7 | 18 | Invoke `mbed compile`, and specify the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: |
moxondesign | 0:2d1d68397ff7 | 19 | |
moxondesign | 0:2d1d68397ff7 | 20 | ``` |
moxondesign | 2:3e203cc2a88f | 21 | mbed compile -m nRF42-DK -t ARM |
moxondesign | 0:2d1d68397ff7 | 22 | ``` |
moxondesign | 0:2d1d68397ff7 | 23 | |
moxondesign | 0:2d1d68397ff7 | 24 | |
moxondesign | 0:2d1d68397ff7 | 25 | ### Program your board |
moxondesign | 0:2d1d68397ff7 | 26 | |
moxondesign | 0:2d1d68397ff7 | 27 | 1. Connect your mbed device to the computer over USB. |
moxondesign | 0:2d1d68397ff7 | 28 | 1. Copy the binary file to the mbed device. |
moxondesign | 0:2d1d68397ff7 | 29 | 1. Press the reset button to start the program. |
moxondesign | 0:2d1d68397ff7 | 30 | |
moxondesign | 2:3e203cc2a88f | 31 | The BLE device should advertise as "BLART" (BLe-uART) |
moxondesign | 0:2d1d68397ff7 | 32 | |
moxondesign | 0:2d1d68397ff7 | 33 | ## Export the project to Keil MDK, and debug your application |
moxondesign | 0:2d1d68397ff7 | 34 | |
moxondesign | 0:2d1d68397ff7 | 35 | From the command-line, run the following command: |
moxondesign | 0:2d1d68397ff7 | 36 | |
moxondesign | 0:2d1d68397ff7 | 37 | ``` |
moxondesign | 2:3e203cc2a88f | 38 | mbed export -m nRF42-DK -i uvision |
moxondesign | 0:2d1d68397ff7 | 39 | ``` |
moxondesign | 0:2d1d68397ff7 | 40 | |
moxondesign | 0:2d1d68397ff7 | 41 | To debug the application: |
moxondesign | 0:2d1d68397ff7 | 42 | |
moxondesign | 0:2d1d68397ff7 | 43 | 1. Start uVision. |
moxondesign | 0:2d1d68397ff7 | 44 | 1. Import the uVision project generated earlier. |
moxondesign | 0:2d1d68397ff7 | 45 | 1. Compile your application, and generate an `.axf` file. |
moxondesign | 0:2d1d68397ff7 | 46 | 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). |
moxondesign | 0:2d1d68397ff7 | 47 | 1. Set breakpoints, and start a debug session. |
moxondesign | 0:2d1d68397ff7 | 48 | |
moxondesign | 0:2d1d68397ff7 | 49 | ![Image of uVision](img/uvision.png) |
moxondesign | 0:2d1d68397ff7 | 50 | |
moxondesign | 0:2d1d68397ff7 | 51 | ## Troubleshooting |
moxondesign | 0:2d1d68397ff7 | 52 | |
moxondesign | 0:2d1d68397ff7 | 53 | 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0` |
moxondesign | 0:2d1d68397ff7 | 54 | |
moxondesign | 0:2d1d68397ff7 | 55 | ``` |
moxondesign | 0:2d1d68397ff7 | 56 | mbed --version |
moxondesign | 0:2d1d68397ff7 | 57 | ``` |
moxondesign | 0:2d1d68397ff7 | 58 | |
moxondesign | 0:2d1d68397ff7 | 59 | If not, you can update it: |
moxondesign | 0:2d1d68397ff7 | 60 | |
moxondesign | 0:2d1d68397ff7 | 61 | ``` |
moxondesign | 0:2d1d68397ff7 | 62 | pip install mbed-cli --upgrade |
moxondesign | 0:2d1d68397ff7 | 63 | ``` |
moxondesign | 0:2d1d68397ff7 | 64 | |
moxondesign | 0:2d1d68397ff7 | 65 | 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32 KB restriction on code size. |