Read accelerometer and gyroscope measurements from the MPU-6050. The MPU-60X0 is the world’s first integrated 6-axis MotionTracking device that combines a 3-axis gyroscope, 3-axis accelerometer, and a Digital Motion Processor™ (DMP) all in a small 4x4x0.9mm package. With its dedicated I2C sensor bus, it directly accepts inputs from an external 3-axis compass to provide a complete 9-axis MotionFusion™ output.
README.md@0:1221112820f7, 2018-10-18 (annotated)
- Committer:
- 213468891
- Date:
- Thu Oct 18 17:04:36 2018 +0000
- Revision:
- 0:1221112820f7
Demonstrates how to read gyroscope and accelerometer values from the MPU-6050 module.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
213468891 | 0:1221112820f7 | 1 | # Getting started with Blinky on mbed OS |
213468891 | 0:1221112820f7 | 2 | |
213468891 | 0:1221112820f7 | 3 | This guide reviews the steps required to get Blinky working on an mbed OS platform. |
213468891 | 0:1221112820f7 | 4 | |
213468891 | 0:1221112820f7 | 5 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
213468891 | 0:1221112820f7 | 6 | |
213468891 | 0:1221112820f7 | 7 | ## Import the example application |
213468891 | 0:1221112820f7 | 8 | |
213468891 | 0:1221112820f7 | 9 | From the command-line, import the example: |
213468891 | 0:1221112820f7 | 10 | |
213468891 | 0:1221112820f7 | 11 | ``` |
213468891 | 0:1221112820f7 | 12 | mbed import mbed-os-example-blinky |
213468891 | 0:1221112820f7 | 13 | cd mbed-os-example-blinky |
213468891 | 0:1221112820f7 | 14 | ``` |
213468891 | 0:1221112820f7 | 15 | |
213468891 | 0:1221112820f7 | 16 | ### Now compile |
213468891 | 0:1221112820f7 | 17 | |
213468891 | 0:1221112820f7 | 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: |
213468891 | 0:1221112820f7 | 19 | |
213468891 | 0:1221112820f7 | 20 | ``` |
213468891 | 0:1221112820f7 | 21 | mbed compile -m K64F -t ARM |
213468891 | 0:1221112820f7 | 22 | ``` |
213468891 | 0:1221112820f7 | 23 | |
213468891 | 0:1221112820f7 | 24 | Your PC may take a few minutes to compile your code. At the end, you see the following result: |
213468891 | 0:1221112820f7 | 25 | |
213468891 | 0:1221112820f7 | 26 | ``` |
213468891 | 0:1221112820f7 | 27 | [snip] |
213468891 | 0:1221112820f7 | 28 | +----------------------------+-------+-------+------+ |
213468891 | 0:1221112820f7 | 29 | | Module | .text | .data | .bss | |
213468891 | 0:1221112820f7 | 30 | +----------------------------+-------+-------+------+ |
213468891 | 0:1221112820f7 | 31 | | Misc | 13939 | 24 | 1372 | |
213468891 | 0:1221112820f7 | 32 | | core/hal | 16993 | 96 | 296 | |
213468891 | 0:1221112820f7 | 33 | | core/rtos | 7384 | 92 | 4204 | |
213468891 | 0:1221112820f7 | 34 | | features/FEATURE_IPV4 | 80 | 0 | 176 | |
213468891 | 0:1221112820f7 | 35 | | frameworks/greentea-client | 1830 | 60 | 44 | |
213468891 | 0:1221112820f7 | 36 | | frameworks/utest | 2392 | 512 | 292 | |
213468891 | 0:1221112820f7 | 37 | | Subtotals | 42618 | 784 | 6384 | |
213468891 | 0:1221112820f7 | 38 | +----------------------------+-------+-------+------+ |
213468891 | 0:1221112820f7 | 39 | Allocated Heap: unknown |
213468891 | 0:1221112820f7 | 40 | Allocated Stack: unknown |
213468891 | 0:1221112820f7 | 41 | Total Static RAM memory (data + bss): 7168 bytes |
213468891 | 0:1221112820f7 | 42 | Total RAM memory (data + bss + heap + stack): 7168 bytes |
213468891 | 0:1221112820f7 | 43 | Total Flash memory (text + data + misc): 43402 bytes |
213468891 | 0:1221112820f7 | 44 | Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin |
213468891 | 0:1221112820f7 | 45 | ``` |
213468891 | 0:1221112820f7 | 46 | |
213468891 | 0:1221112820f7 | 47 | ### Program your board |
213468891 | 0:1221112820f7 | 48 | |
213468891 | 0:1221112820f7 | 49 | 1. Connect your mbed device to the computer over USB. |
213468891 | 0:1221112820f7 | 50 | 1. Copy the binary file to the mbed device. |
213468891 | 0:1221112820f7 | 51 | 1. Press the reset button to start the program. |
213468891 | 0:1221112820f7 | 52 | |
213468891 | 0:1221112820f7 | 53 | The LED on your platform turns on and off. |
213468891 | 0:1221112820f7 | 54 | |
213468891 | 0:1221112820f7 | 55 | ## Export the project to Keil MDK, and debug your application |
213468891 | 0:1221112820f7 | 56 | |
213468891 | 0:1221112820f7 | 57 | From the command-line, run the following command: |
213468891 | 0:1221112820f7 | 58 | |
213468891 | 0:1221112820f7 | 59 | ``` |
213468891 | 0:1221112820f7 | 60 | mbed export -m K64F -i uvision |
213468891 | 0:1221112820f7 | 61 | ``` |
213468891 | 0:1221112820f7 | 62 | |
213468891 | 0:1221112820f7 | 63 | To debug the application: |
213468891 | 0:1221112820f7 | 64 | |
213468891 | 0:1221112820f7 | 65 | 1. Start uVision. |
213468891 | 0:1221112820f7 | 66 | 1. Import the uVision project generated earlier. |
213468891 | 0:1221112820f7 | 67 | 1. Compile your application, and generate an `.axf` file. |
213468891 | 0:1221112820f7 | 68 | 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). |
213468891 | 0:1221112820f7 | 69 | 1. Set breakpoints, and start a debug session. |
213468891 | 0:1221112820f7 | 70 | |
213468891 | 0:1221112820f7 | 71 | ![Image of uVision](img/uvision.png) |
213468891 | 0:1221112820f7 | 72 | |
213468891 | 0:1221112820f7 | 73 | ## Troubleshooting |
213468891 | 0:1221112820f7 | 74 | |
213468891 | 0:1221112820f7 | 75 | 1. Make sure `mbed-cli` is working correctly and its version is `>1.0.0` |
213468891 | 0:1221112820f7 | 76 | |
213468891 | 0:1221112820f7 | 77 | ``` |
213468891 | 0:1221112820f7 | 78 | mbed --version |
213468891 | 0:1221112820f7 | 79 | ``` |
213468891 | 0:1221112820f7 | 80 | |
213468891 | 0:1221112820f7 | 81 | If not, you can update it: |
213468891 | 0:1221112820f7 | 82 | |
213468891 | 0:1221112820f7 | 83 | ``` |
213468891 | 0:1221112820f7 | 84 | pip install mbed-cli --upgrade |
213468891 | 0:1221112820f7 | 85 | ``` |
213468891 | 0:1221112820f7 | 86 | |
213468891 | 0:1221112820f7 | 87 | 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. |