Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
doc/examples.md@24:5a2272a25ff1, 2018-01-22 (annotated)
- Committer:
- danodonovan
- Date:
- Mon Jan 22 17:40:50 2018 +0000
- Revision:
- 24:5a2272a25ff1
- Parent:
- 19:a6d4bdcffb84
Updating example to adisense1000 v1.0.1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kevin1990 | 19:a6d4bdcffb84 | 1 | Examples |
| kevin1990 | 19:a6d4bdcffb84 | 2 | ======== |
| kevin1990 | 19:a6d4bdcffb84 | 3 | |
| kevin1990 | 19:a6d4bdcffb84 | 4 | [TOC] |
| kevin1990 | 19:a6d4bdcffb84 | 5 | |
| kevin1990 | 19:a6d4bdcffb84 | 6 | # Overview {#overview} |
| kevin1990 | 19:a6d4bdcffb84 | 7 | |
| kevin1990 | 19:a6d4bdcffb84 | 8 | # Getting Started {#getting_started} |
| kevin1990 | 19:a6d4bdcffb84 | 9 | |
| kevin1990 | 19:a6d4bdcffb84 | 10 | ## ST Nucleo F411RE / Mbed OS {#stnucleo_mbed} |
| kevin1990 | 19:a6d4bdcffb84 | 11 | |
| kevin1990 | 19:a6d4bdcffb84 | 12 | ### Hardware Setup |
| kevin1990 | 19:a6d4bdcffb84 | 13 | |
| kevin1990 | 19:a6d4bdcffb84 | 14 | The following examples assume that the ADI Sense 1000 module is connected to the |
| kevin1990 | 19:a6d4bdcffb84 | 15 | ST Nucleo FR11RE as follows: |
| kevin1990 | 19:a6d4bdcffb84 | 16 | |
| kevin1990 | 19:a6d4bdcffb84 | 17 | ADI Sense 1000 | ST Nucleo FR11RE |
| kevin1990 | 19:a6d4bdcffb84 | 18 | --------------- | ------------- |
| kevin1990 | 19:a6d4bdcffb84 | 19 | SPI\_SLAVE\_CS | D10 |
| kevin1990 | 19:a6d4bdcffb84 | 20 | SPI\_SLAVE\_MOSI | D11 |
| kevin1990 | 19:a6d4bdcffb84 | 21 | SPI\_SLAVE\_MISO | D12 |
| kevin1990 | 19:a6d4bdcffb84 | 22 | RESET | D6 |
| kevin1990 | 19:a6d4bdcffb84 | 23 | ERROR | D3 |
| kevin1990 | 19:a6d4bdcffb84 | 24 | ALERT | D4 |
| kevin1990 | 19:a6d4bdcffb84 | 25 | DRDY | D5 |
| kevin1990 | 19:a6d4bdcffb84 | 26 | |
| kevin1990 | 19:a6d4bdcffb84 | 27 | ### Software Setup |
| kevin1990 | 19:a6d4bdcffb84 | 28 | |
| kevin1990 | 19:a6d4bdcffb84 | 29 | ### Building an example |
| kevin1990 | 19:a6d4bdcffb84 | 30 | |
| kevin1990 | 19:a6d4bdcffb84 | 31 | #### Using mbed online tools |
| kevin1990 | 19:a6d4bdcffb84 | 32 | An mbed online account is required. For more information, |
| kevin1990 | 19:a6d4bdcffb84 | 33 | see (https://developer.mbed.org/account/signup/). |
| kevin1990 | 19:a6d4bdcffb84 | 34 | |
| kevin1990 | 19:a6d4bdcffb84 | 35 | Once logged into mbed, visit the following URL to locate the ADI Sense Host Library repository: |
| kevin1990 | 19:a6d4bdcffb84 | 36 | (https://os.mbed.com/teams/AnalogDevices/code/AdiSense1000) |
| kevin1990 | 19:a6d4bdcffb84 | 37 | |
| kevin1990 | 19:a6d4bdcffb84 | 38 | Select the "Import into Compiler" option to add this library to your project. |
| kevin1990 | 19:a6d4bdcffb84 | 39 | |
| kevin1990 | 19:a6d4bdcffb84 | 40 | Navigate to one of the examples (e.g. AdiSense1000/examples/sensors/) and click |
| kevin1990 | 19:a6d4bdcffb84 | 41 | to open the source file named 'main.cpp'. Then click on compile at the top of |
| kevin1990 | 19:a6d4bdcffb84 | 42 | the page to build the binary image. This will download the binary to your PC. |
| kevin1990 | 19:a6d4bdcffb84 | 43 | |
| kevin1990 | 19:a6d4bdcffb84 | 44 | #### Using mbed-cli (command line interface) tools |
| kevin1990 | 19:a6d4bdcffb84 | 45 | Follow the instructions at (https://github.com/ARMmbed/mbed-cli) to download and |
| kevin1990 | 19:a6d4bdcffb84 | 46 | install the mbed-cli. |
| kevin1990 | 19:a6d4bdcffb84 | 47 | |
| kevin1990 | 19:a6d4bdcffb84 | 48 | In a command-line terminal window, navigate to the directory containing one of |
| kevin1990 | 19:a6d4bdcffb84 | 49 | the examples included in the ADI Sense Host Library software package, set up the |
| kevin1990 | 19:a6d4bdcffb84 | 50 | mbed-os environment, and build the code: |
| kevin1990 | 19:a6d4bdcffb84 | 51 | |
| kevin1990 | 19:a6d4bdcffb84 | 52 | cd <path_to_library>/examples/sensors/ |
| kevin1990 | 19:a6d4bdcffb84 | 53 | mbed deploy |
| kevin1990 | 19:a6d4bdcffb84 | 54 | mbed new . |
| kevin1990 | 19:a6d4bdcffb84 | 55 | mbed compile -m nucleo_f411re -t GCC_ARM |
| kevin1990 | 19:a6d4bdcffb84 | 56 | |
| kevin1990 | 19:a6d4bdcffb84 | 57 | The resulting binary image will be created as: |
| kevin1990 | 19:a6d4bdcffb84 | 58 | |
| kevin1990 | 19:a6d4bdcffb84 | 59 | <path_to_library>/examples/sensors/BUILD/nucleo_f411re/GCC_ARM/sensors.bin |
| kevin1990 | 19:a6d4bdcffb84 | 60 | |
| kevin1990 | 19:a6d4bdcffb84 | 61 | ### Running an example |
| kevin1990 | 19:a6d4bdcffb84 | 62 | Assuming the Nucleo board is plugged in to your PC via a micro-USB cable, copy |
| kevin1990 | 19:a6d4bdcffb84 | 63 | the binary image (built in the previous step) to the "NODE_F411RE" USB storage |
| kevin1990 | 19:a6d4bdcffb84 | 64 | device. The programming LED on the F411RE should flash for a few seconds while |
| kevin1990 | 19:a6d4bdcffb84 | 65 | the program is being loaded, and the device should then automatically reboot |
| kevin1990 | 19:a6d4bdcffb84 | 66 | and start running the example. |
| kevin1990 | 19:a6d4bdcffb84 | 67 | |
| kevin1990 | 19:a6d4bdcffb84 | 68 | Output messages from the example are transmitted on UART6 (pins PA\_11, PA\_12) |
| kevin1990 | 19:a6d4bdcffb84 | 69 | by default. This pins may be routed via the micro-USB cable COM/serial |
| kevin1990 | 19:a6d4bdcffb84 | 70 | by connecting PA\_11 and PA\_12 to the RX and TX pins on CN3 of the F411RE board. |
| kevin1990 | 19:a6d4bdcffb84 | 71 | Alternatively, it is possible to specify a different UART by modifying the |
| kevin1990 | 19:a6d4bdcffb84 | 72 | following file and rebuilding the example: |
| kevin1990 | 19:a6d4bdcffb84 | 73 | |
| kevin1990 | 19:a6d4bdcffb84 | 74 | <path_to_library>/host/src/mbed/adi_sense_log.cpp |
| kevin1990 | 19:a6d4bdcffb84 | 75 | |
| kevin1990 | 19:a6d4bdcffb84 | 76 | # API Usage Examples {#api_examples} |
| kevin1990 | 19:a6d4bdcffb84 | 77 | The following examples are intended to demonstrate the correct usage of the [ADI Sense API](@ref ADI_Sense_Api) in a variety of scenarios and configurations. |
| kevin1990 | 19:a6d4bdcffb84 | 78 | |
| kevin1990 | 19:a6d4bdcffb84 | 79 | ## Sensors {#api_examples_sensors} |
| kevin1990 | 19:a6d4bdcffb84 | 80 | The "sensors" example demonstrates configurations that may be used to enable a |
| kevin1990 | 19:a6d4bdcffb84 | 81 | selection of analog and digital sensors which may be connected to the ADI Sense |
| kevin1990 | 19:a6d4bdcffb84 | 82 | 1000 module and used in various modes of operation. Different configurations |
| kevin1990 | 19:a6d4bdcffb84 | 83 | may be selected by modifying the value of 'pSelectedConfig' in main.cpp. The |
| kevin1990 | 19:a6d4bdcffb84 | 84 | example application code will show how the selected configuration is loaded to |
| kevin1990 | 19:a6d4bdcffb84 | 85 | the ADI Sense 1000 device and applied before measurement cycles are started. |
| kevin1990 | 19:a6d4bdcffb84 | 86 | |
| kevin1990 | 19:a6d4bdcffb84 | 87 | ## User-Defined Look-Up Table Data {#api_examples_user_lut_data} |
| kevin1990 | 19:a6d4bdcffb84 | 88 | The "user_lut_data" example aims to show how a user may specify sensor |
| kevin1990 | 19:a6d4bdcffb84 | 89 | correction data to linearise the raw results from a custom sensor (a |
| kevin1990 | 19:a6d4bdcffb84 | 90 | thermocouple and bridge sensor in this case). The data is encapsulated in a |
| kevin1990 | 19:a6d4bdcffb84 | 91 | series of individual tables and corresponding descriptors |
| kevin1990 | 19:a6d4bdcffb84 | 92 | (see 'sample\_lut\_data.c') which are assembled into a single monolithic Look-Up |
| kevin1990 | 19:a6d4bdcffb84 | 93 | Table (LUT) data structure. That LUT data structure is loaded onto the ADI |
| kevin1990 | 19:a6d4bdcffb84 | 94 | Sense 1000 module and applied as part of the module configuration before any |
| kevin1990 | 19:a6d4bdcffb84 | 95 | measurement cycles are started. |
| kevin1990 | 19:a6d4bdcffb84 | 96 | |
| kevin1990 | 19:a6d4bdcffb84 | 97 | ## Save/Restore Configuration {#api_examples_save_restore} |
| kevin1990 | 19:a6d4bdcffb84 | 98 | The "save_restore_config" example demonstrates how configuration settings may be |
| kevin1990 | 19:a6d4bdcffb84 | 99 | saved to non-volatile memory on the ADI Sense module. Saved settings are loaded |
| kevin1990 | 19:a6d4bdcffb84 | 100 | automatically when the module is subsequently powered on, and may also be |
| kevin1990 | 19:a6d4bdcffb84 | 101 | loaded (restored) at any time by the user if required. Note that settings must |
| kevin1990 | 19:a6d4bdcffb84 | 102 | always be applied explicitly with @ref adi_sense_ApplyConfigUpdates before they |
| kevin1990 | 19:a6d4bdcffb84 | 103 | take effect. |
| kevin1990 | 19:a6d4bdcffb84 | 104 | |
| kevin1990 | 19:a6d4bdcffb84 | 105 | ## Diagnostics {#api_examples_diagnostics} |
| kevin1990 | 19:a6d4bdcffb84 | 106 | The "diagnostics" example demonstrates how some of the various diagnostic |
| kevin1990 | 19:a6d4bdcffb84 | 107 | functions of the ADI Sense module can be utilised to detect error conditions |
| kevin1990 | 19:a6d4bdcffb84 | 108 | such as disconnected or mis-wired sensors. |
| kevin1990 | 19:a6d4bdcffb84 | 109 |