Range with a (green) VL53L1X Satellite board connected directly to the motherboard, without Expansion board support.
Dependencies: X_NUCLEO_53L1A1_mbed
README.md@0:6b7696e7df5e, 2019-05-17 (annotated)
- Committer:
- johnAlexander
- Date:
- Fri May 17 10:44:38 2019 +0000
- Revision:
- 0:6b7696e7df5e
Simple ranging example using Mbed OS 5.x
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
johnAlexander | 0:6b7696e7df5e | 1 | # Getting started example for Mbed OS |
johnAlexander | 0:6b7696e7df5e | 2 | |
johnAlexander | 0:6b7696e7df5e | 3 | This guide reviews the steps required to get Blinky with the addition of dynamic OS statistics working on an Mbed OS platform. (Note: To see a rendered example you can import into the Arm Online Compiler, please see our [quick start](https://os.mbed.com/docs/mbed-os/latest/quick-start/online-with-the-online-compiler.html#importing-the-code).) |
johnAlexander | 0:6b7696e7df5e | 4 | |
johnAlexander | 0:6b7696e7df5e | 5 | Please install [Mbed CLI](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli). |
johnAlexander | 0:6b7696e7df5e | 6 | |
johnAlexander | 0:6b7696e7df5e | 7 | ## Import the example application |
johnAlexander | 0:6b7696e7df5e | 8 | |
johnAlexander | 0:6b7696e7df5e | 9 | From the command-line, import the example: |
johnAlexander | 0:6b7696e7df5e | 10 | |
johnAlexander | 0:6b7696e7df5e | 11 | ``` |
johnAlexander | 0:6b7696e7df5e | 12 | mbed import mbed-os-example-blinky |
johnAlexander | 0:6b7696e7df5e | 13 | cd mbed-os-example-blinky |
johnAlexander | 0:6b7696e7df5e | 14 | ``` |
johnAlexander | 0:6b7696e7df5e | 15 | |
johnAlexander | 0:6b7696e7df5e | 16 | ### Now compile |
johnAlexander | 0:6b7696e7df5e | 17 | |
johnAlexander | 0:6b7696e7df5e | 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: |
johnAlexander | 0:6b7696e7df5e | 19 | |
johnAlexander | 0:6b7696e7df5e | 20 | ``` |
johnAlexander | 0:6b7696e7df5e | 21 | mbed compile -m K64F -t ARM |
johnAlexander | 0:6b7696e7df5e | 22 | ``` |
johnAlexander | 0:6b7696e7df5e | 23 | |
johnAlexander | 0:6b7696e7df5e | 24 | Your PC may take a few minutes to compile your code. At the end, you see the following result: |
johnAlexander | 0:6b7696e7df5e | 25 | |
johnAlexander | 0:6b7696e7df5e | 26 | ``` |
johnAlexander | 0:6b7696e7df5e | 27 | [snip] |
johnAlexander | 0:6b7696e7df5e | 28 | |
johnAlexander | 0:6b7696e7df5e | 29 | Image: ./BUILD/K64F/GCC_ARM/mbed-os-example-blinky.bin |
johnAlexander | 0:6b7696e7df5e | 30 | ``` |
johnAlexander | 0:6b7696e7df5e | 31 | |
johnAlexander | 0:6b7696e7df5e | 32 | ### Program your board |
johnAlexander | 0:6b7696e7df5e | 33 | |
johnAlexander | 0:6b7696e7df5e | 34 | 1. Connect your Mbed device to the computer over USB. |
johnAlexander | 0:6b7696e7df5e | 35 | 1. Copy the binary file to the Mbed device. |
johnAlexander | 0:6b7696e7df5e | 36 | 1. Press the reset button to start the program. |
johnAlexander | 0:6b7696e7df5e | 37 | |
johnAlexander | 0:6b7696e7df5e | 38 | The LED on your platform turns on and off. The main thread will additionally take a snapshot of the device's runtime statistics and display it over serial to your PC. The snapshot includes: |
johnAlexander | 0:6b7696e7df5e | 39 | |
johnAlexander | 0:6b7696e7df5e | 40 | * System Information: |
johnAlexander | 0:6b7696e7df5e | 41 | * Mbed OS Version: Will currently default to 999999 |
johnAlexander | 0:6b7696e7df5e | 42 | * Compiler ID |
johnAlexander | 0:6b7696e7df5e | 43 | * ARM = 1 |
johnAlexander | 0:6b7696e7df5e | 44 | * GCC_ARM = 2 |
johnAlexander | 0:6b7696e7df5e | 45 | * IAR = 3 |
johnAlexander | 0:6b7696e7df5e | 46 | * [CPUID Register Information](#cpuid-register-information) |
johnAlexander | 0:6b7696e7df5e | 47 | * [Compiler Version](#compiler-version) |
johnAlexander | 0:6b7696e7df5e | 48 | * CPU Statistics |
johnAlexander | 0:6b7696e7df5e | 49 | * Percentage of runtime that the device has spent awake versus in sleep |
johnAlexander | 0:6b7696e7df5e | 50 | * Heap Statistics |
johnAlexander | 0:6b7696e7df5e | 51 | * Current heap size |
johnAlexander | 0:6b7696e7df5e | 52 | * Max heap size which refers to the largest the heap has grown to |
johnAlexander | 0:6b7696e7df5e | 53 | * Thread Statistics |
johnAlexander | 0:6b7696e7df5e | 54 | * Provides information on all running threads in the OS including |
johnAlexander | 0:6b7696e7df5e | 55 | * Thread ID |
johnAlexander | 0:6b7696e7df5e | 56 | * Thread Name |
johnAlexander | 0:6b7696e7df5e | 57 | * Thread State |
johnAlexander | 0:6b7696e7df5e | 58 | * Thread Priority |
johnAlexander | 0:6b7696e7df5e | 59 | * Thread Stack Size |
johnAlexander | 0:6b7696e7df5e | 60 | * Thread Stack Space |
johnAlexander | 0:6b7696e7df5e | 61 | |
johnAlexander | 0:6b7696e7df5e | 62 | #### Compiler Version |
johnAlexander | 0:6b7696e7df5e | 63 | |
johnAlexander | 0:6b7696e7df5e | 64 | | Compiler | Version Layout | |
johnAlexander | 0:6b7696e7df5e | 65 | | -------- | -------------- | |
johnAlexander | 0:6b7696e7df5e | 66 | | ARM | PVVbbbb (P = Major; VV = Minor; bbbb = build number) | |
johnAlexander | 0:6b7696e7df5e | 67 | | GCC | VVRRPP (VV = Version; RR = Revision; PP = Patch) | |
johnAlexander | 0:6b7696e7df5e | 68 | | IAR | VRRRPPP (V = Version; RRR = Revision; PPP = Patch) | |
johnAlexander | 0:6b7696e7df5e | 69 | |
johnAlexander | 0:6b7696e7df5e | 70 | #### CPUID Register Information |
johnAlexander | 0:6b7696e7df5e | 71 | |
johnAlexander | 0:6b7696e7df5e | 72 | | Bit Field | Field Description | Values | |
johnAlexander | 0:6b7696e7df5e | 73 | | --------- | ----------------- | ------ | |
johnAlexander | 0:6b7696e7df5e | 74 | |[31:24] | Implementer | 0x41 = ARM | |
johnAlexander | 0:6b7696e7df5e | 75 | |[23:20] | Variant | Major revision 0x0 = Revision 0 | |
johnAlexander | 0:6b7696e7df5e | 76 | |[19:16] | Architecture | 0xC = Baseline Architecture | |
johnAlexander | 0:6b7696e7df5e | 77 | | | | 0xF = Constant (Mainline Architecture) | |
johnAlexander | 0:6b7696e7df5e | 78 | |[15:4] | Part Number | 0xC20 = Cortex-M0 | |
johnAlexander | 0:6b7696e7df5e | 79 | | | | 0xC60 = Cortex-M0+ | |
johnAlexander | 0:6b7696e7df5e | 80 | | | | 0xC23 = Cortex-M3 | |
johnAlexander | 0:6b7696e7df5e | 81 | | | | 0xC24 = Cortex-M4 | |
johnAlexander | 0:6b7696e7df5e | 82 | | | | 0xC27 = Cortex-M7 | |
johnAlexander | 0:6b7696e7df5e | 83 | | | | 0xD20 = Cortex-M23 | |
johnAlexander | 0:6b7696e7df5e | 84 | | | | 0xD21 = Cortex-M33 | |
johnAlexander | 0:6b7696e7df5e | 85 | |[3:0] | Revision | Minor revision: 0x1 = Patch 1 | |
johnAlexander | 0:6b7696e7df5e | 86 | |
johnAlexander | 0:6b7696e7df5e | 87 | |
johnAlexander | 0:6b7696e7df5e | 88 | |
johnAlexander | 0:6b7696e7df5e | 89 | You can view individual examples and additional API information of the statistics collection tools at the bottom of the page in the [related links section](#related-links). |
johnAlexander | 0:6b7696e7df5e | 90 | |
johnAlexander | 0:6b7696e7df5e | 91 | |
johnAlexander | 0:6b7696e7df5e | 92 | ### Output |
johnAlexander | 0:6b7696e7df5e | 93 | |
johnAlexander | 0:6b7696e7df5e | 94 | To view the serial output you can use any terminal client of your choosing such as [PuTTY](http://www.putty.org/) or [CoolTerm](http://freeware.the-meiers.org/). Unless otherwise specified, printf defaults to a baud rate of 9600 on Mbed OS. |
johnAlexander | 0:6b7696e7df5e | 95 | |
johnAlexander | 0:6b7696e7df5e | 96 | You can find more information on the Mbed OS configuration tools and serial communication in Mbed OS in the related [related links section](#related-links). |
johnAlexander | 0:6b7696e7df5e | 97 | |
johnAlexander | 0:6b7696e7df5e | 98 | The output should contain the following block transmitted at the blinking LED frequency (actual values may vary depending on your target, build profile, and toolchain): |
johnAlexander | 0:6b7696e7df5e | 99 | |
johnAlexander | 0:6b7696e7df5e | 100 | ``` |
johnAlexander | 0:6b7696e7df5e | 101 | =============================== SYSTEM INFO ================================ |
johnAlexander | 0:6b7696e7df5e | 102 | Mbed OS Version: 999999 |
johnAlexander | 0:6b7696e7df5e | 103 | CPU ID: 0x410fc241 |
johnAlexander | 0:6b7696e7df5e | 104 | Compiler ID: 2 |
johnAlexander | 0:6b7696e7df5e | 105 | Compiler Version: 60300 |
johnAlexander | 0:6b7696e7df5e | 106 | RAM0: Start 0x20000000 Size: 0x30000 |
johnAlexander | 0:6b7696e7df5e | 107 | RAM1: Start 0x1fff0000 Size: 0x10000 |
johnAlexander | 0:6b7696e7df5e | 108 | ROM0: Start 0x0 Size: 0x100000 |
johnAlexander | 0:6b7696e7df5e | 109 | ================= CPU STATS ================= |
johnAlexander | 0:6b7696e7df5e | 110 | Idle: 98% Usage: 2% |
johnAlexander | 0:6b7696e7df5e | 111 | ================ HEAP STATS ================= |
johnAlexander | 0:6b7696e7df5e | 112 | Current heap: 1096 |
johnAlexander | 0:6b7696e7df5e | 113 | Max heap size: 1096 |
johnAlexander | 0:6b7696e7df5e | 114 | ================ THREAD STATS =============== |
johnAlexander | 0:6b7696e7df5e | 115 | ID: 0x20001eac |
johnAlexander | 0:6b7696e7df5e | 116 | Name: main_thread |
johnAlexander | 0:6b7696e7df5e | 117 | State: 2 |
johnAlexander | 0:6b7696e7df5e | 118 | Priority: 24 |
johnAlexander | 0:6b7696e7df5e | 119 | Stack Size: 4096 |
johnAlexander | 0:6b7696e7df5e | 120 | Stack Space: 3296 |
johnAlexander | 0:6b7696e7df5e | 121 | |
johnAlexander | 0:6b7696e7df5e | 122 | ID: 0x20000f5c |
johnAlexander | 0:6b7696e7df5e | 123 | Name: idle_thread |
johnAlexander | 0:6b7696e7df5e | 124 | State: 1 |
johnAlexander | 0:6b7696e7df5e | 125 | Priority: 1 |
johnAlexander | 0:6b7696e7df5e | 126 | Stack Size: 512 |
johnAlexander | 0:6b7696e7df5e | 127 | Stack Space: 352 |
johnAlexander | 0:6b7696e7df5e | 128 | |
johnAlexander | 0:6b7696e7df5e | 129 | ID: 0x20000f18 |
johnAlexander | 0:6b7696e7df5e | 130 | Name: timer_thread |
johnAlexander | 0:6b7696e7df5e | 131 | State: 3 |
johnAlexander | 0:6b7696e7df5e | 132 | Priority: 40 |
johnAlexander | 0:6b7696e7df5e | 133 | Stack Size: 768 |
johnAlexander | 0:6b7696e7df5e | 134 | Stack Space: 664 |
johnAlexander | 0:6b7696e7df5e | 135 | |
johnAlexander | 0:6b7696e7df5e | 136 | ``` |
johnAlexander | 0:6b7696e7df5e | 137 | |
johnAlexander | 0:6b7696e7df5e | 138 | ## Troubleshooting |
johnAlexander | 0:6b7696e7df5e | 139 | |
johnAlexander | 0:6b7696e7df5e | 140 | If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it. |
johnAlexander | 0:6b7696e7df5e | 141 | |
johnAlexander | 0:6b7696e7df5e | 142 | ## Related Links |
johnAlexander | 0:6b7696e7df5e | 143 | |
johnAlexander | 0:6b7696e7df5e | 144 | * [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html) |
johnAlexander | 0:6b7696e7df5e | 145 | * [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html) |
johnAlexander | 0:6b7696e7df5e | 146 | * [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html) |
johnAlexander | 0:6b7696e7df5e | 147 | |
johnAlexander | 0:6b7696e7df5e | 148 | ### License and contributions |
johnAlexander | 0:6b7696e7df5e | 149 | |
johnAlexander | 0:6b7696e7df5e | 150 | The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see contributing.md for more info. |
johnAlexander | 0:6b7696e7df5e | 151 | |
johnAlexander | 0:6b7696e7df5e | 152 | This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide. |