Simple gyroscope program example for Hexiwear featuring UART
Dependencies: FXAS21002
Fork of Hexi_gyro_app by
This project demonstrates the use of the FXAS21002CQ Gyroscope sensor embedded in hexiwear
Open a Hyperterminal tool on your computer and connect it to the "mbed Serial port (COMxx)" with Baud rate "9600bps"
Compile the project and copy the binary "Hexi_Gyro_Example_HEXIWEAR.bin" in the DAP-LINK drive from your computer file explorer Press the K64F-RESET button on the docking station to start the program on your board
Every 1s the value of the Gyroscope for the Axis Roll, Pitch and Yaw plus their RMS value will be displayed in the Hyperterminal window and the LED will blink Green
README.md@1:d26e406e92f9, 2016-08-15 (annotated)
- Committer:
- GregC
- Date:
- Mon Aug 15 23:33:04 2016 +0000
- Revision:
- 1:d26e406e92f9
- Parent:
- 0:b0767be19223
Gyroscope program example for Hexiwear
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maclobdell | 0:b0767be19223 | 1 | # Getting started with Blinky on mbed OS |
maclobdell | 0:b0767be19223 | 2 | |
maclobdell | 0:b0767be19223 | 3 | This is a very simple guide, reviewing the steps required to get Blinky working on an mbed OS platform. |
maclobdell | 0:b0767be19223 | 4 | |
maclobdell | 0:b0767be19223 | 5 | Please install [mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
maclobdell | 0:b0767be19223 | 6 | |
maclobdell | 0:b0767be19223 | 7 | ## Get the example application! |
maclobdell | 0:b0767be19223 | 8 | |
maclobdell | 0:b0767be19223 | 9 | From the command line, import the example: |
maclobdell | 0:b0767be19223 | 10 | |
maclobdell | 0:b0767be19223 | 11 | ``` |
maclobdell | 0:b0767be19223 | 12 | mbed import mbed-os-example-blinky |
maclobdell | 0:b0767be19223 | 13 | cd mbed-os-example-blinky |
maclobdell | 0:b0767be19223 | 14 | ``` |
maclobdell | 0:b0767be19223 | 15 | |
maclobdell | 0:b0767be19223 | 16 | ### Now compile |
maclobdell | 0:b0767be19223 | 17 | |
maclobdell | 0:b0767be19223 | 18 | Invoke `mbed compile` specifying the name of your platform and your favorite toolchain (`GCC_ARM`, `ARM`, `IAR`). For example, for the ARM Compiler 5: |
maclobdell | 0:b0767be19223 | 19 | |
maclobdell | 0:b0767be19223 | 20 | ``` |
maclobdell | 0:b0767be19223 | 21 | mbed compile -m K64F -t ARM |
maclobdell | 0:b0767be19223 | 22 | ``` |
maclobdell | 0:b0767be19223 | 23 | |
maclobdell | 0:b0767be19223 | 24 | Your PC may take a few minutes to compile your code. At the end you should get the following result: |
maclobdell | 0:b0767be19223 | 25 | |
maclobdell | 0:b0767be19223 | 26 | ``` |
maclobdell | 0:b0767be19223 | 27 | [snip] |
maclobdell | 0:b0767be19223 | 28 | +----------------------------+-------+-------+------+ |
maclobdell | 0:b0767be19223 | 29 | | Module | .text | .data | .bss | |
maclobdell | 0:b0767be19223 | 30 | +----------------------------+-------+-------+------+ |
maclobdell | 0:b0767be19223 | 31 | | Misc | 13939 | 24 | 1372 | |
maclobdell | 0:b0767be19223 | 32 | | core/hal | 16993 | 96 | 296 | |
maclobdell | 0:b0767be19223 | 33 | | core/rtos | 7384 | 92 | 4204 | |
maclobdell | 0:b0767be19223 | 34 | | features/FEATURE_IPV4 | 80 | 0 | 176 | |
maclobdell | 0:b0767be19223 | 35 | | frameworks/greentea-client | 1830 | 60 | 44 | |
maclobdell | 0:b0767be19223 | 36 | | frameworks/utest | 2392 | 512 | 292 | |
maclobdell | 0:b0767be19223 | 37 | | Subtotals | 42618 | 784 | 6384 | |
maclobdell | 0:b0767be19223 | 38 | +----------------------------+-------+-------+------+ |
maclobdell | 0:b0767be19223 | 39 | Allocated Heap: unknown |
maclobdell | 0:b0767be19223 | 40 | Allocated Stack: unknown |
maclobdell | 0:b0767be19223 | 41 | Total Static RAM memory (data + bss): 7168 bytes |
maclobdell | 0:b0767be19223 | 42 | Total RAM memory (data + bss + heap + stack): 7168 bytes |
maclobdell | 0:b0767be19223 | 43 | Total Flash memory (text + data + misc): 43402 bytes |
maclobdell | 0:b0767be19223 | 44 | Image: .\.build\K64F\ARM\mbed-os-example-blinky.bin |
maclobdell | 0:b0767be19223 | 45 | ``` |
maclobdell | 0:b0767be19223 | 46 | |
maclobdell | 0:b0767be19223 | 47 | ### Program your board |
maclobdell | 0:b0767be19223 | 48 | |
maclobdell | 0:b0767be19223 | 49 | 1. Connect your mbed device to the computer over USB. |
maclobdell | 0:b0767be19223 | 50 | 1. Copy the binary file to the mbed device . |
maclobdell | 0:b0767be19223 | 51 | 1. Press the reset button to start the program. |
maclobdell | 0:b0767be19223 | 52 | |
maclobdell | 0:b0767be19223 | 53 | You should see the LED of your platform turning on and off. |
maclobdell | 0:b0767be19223 | 54 | |
maclobdell | 0:b0767be19223 | 55 | Congratulations if you managed to complete this test! |
maclobdell | 0:b0767be19223 | 56 | |
maclobdell | 0:b0767be19223 | 57 | ## Export the project to Keil MDK and debug your application |
maclobdell | 0:b0767be19223 | 58 | |
maclobdell | 0:b0767be19223 | 59 | From the command line, run the following command: |
maclobdell | 0:b0767be19223 | 60 | |
maclobdell | 0:b0767be19223 | 61 | ``` |
maclobdell | 0:b0767be19223 | 62 | mbed export -m K64F -i uvision |
maclobdell | 0:b0767be19223 | 63 | ``` |
maclobdell | 0:b0767be19223 | 64 | |
maclobdell | 0:b0767be19223 | 65 | You should see the following output: |
maclobdell | 0:b0767be19223 | 66 | |
maclobdell | 0:b0767be19223 | 67 | ``` |
maclobdell | 0:b0767be19223 | 68 | Successful exports: |
maclobdell | 0:b0767be19223 | 69 | * K64F::uvision .\projectfiles\uvision_K64F\Unnamed_Project |
maclobdell | 0:b0767be19223 | 70 | ``` |
maclobdell | 0:b0767be19223 | 71 | |
maclobdell | 0:b0767be19223 | 72 | To debug the application: |
maclobdell | 0:b0767be19223 | 73 | |
maclobdell | 0:b0767be19223 | 74 | 1. Start uVision. |
maclobdell | 0:b0767be19223 | 75 | 1. Import the uVision project generated earlier. |
maclobdell | 0:b0767be19223 | 76 | 1. Compile your application and generate an `.axf` file. |
maclobdell | 0:b0767be19223 | 77 | 1. Make sure uVision is configured to debug over CMSIS-DAP (From the Project menu > Options for Target '...' > Debug tab > Use CMSIS-DAP Debugger). |
maclobdell | 0:b0767be19223 | 78 | 1. Set breakpoints and start a debug session. |
maclobdell | 0:b0767be19223 | 79 | |
maclobdell | 0:b0767be19223 | 80 | ![Image of uVision](img/uvision.png) |
maclobdell | 0:b0767be19223 | 81 | |
maclobdell | 0:b0767be19223 | 82 | ## Troubleshooting |
maclobdell | 0:b0767be19223 | 83 | |
maclobdell | 0:b0767be19223 | 84 | 1. Make sure `mbed-cli` is working correctly and its version is greater than `0.8.9` |
maclobdell | 0:b0767be19223 | 85 | |
maclobdell | 0:b0767be19223 | 86 | ``` |
maclobdell | 0:b0767be19223 | 87 | mbed --version |
maclobdell | 0:b0767be19223 | 88 | ``` |
maclobdell | 0:b0767be19223 | 89 | |
maclobdell | 0:b0767be19223 | 90 | If not, you can update it easily: |
maclobdell | 0:b0767be19223 | 91 | |
maclobdell | 0:b0767be19223 | 92 | ``` |
maclobdell | 0:b0767be19223 | 93 | pip install mbed-cli --upgrade |
maclobdell | 0:b0767be19223 | 94 | ``` |
maclobdell | 0:b0767be19223 | 95 | |
maclobdell | 0:b0767be19223 | 96 | 2. If using Keil MDK, make sure you have a license installed. [MDK-Lite](http://www.keil.com/arm/mdk.asp) has a 32KB restriction on code size. |