|
| 1 | +MAXM86161 no-OS Example Project |
| 2 | +=============================== |
| 3 | + |
| 4 | +.. no-os-doxygen:: |
| 5 | + |
| 6 | +.. contents:: Table of Contents |
| 7 | + :depth: 3 |
| 8 | + |
| 9 | +Supported Evaluation Boards |
| 10 | +--------------------------- |
| 11 | + |
| 12 | +* `MAXM86161EVSYS <https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/maxm86161evsys.html>`_ |
| 13 | + |
| 14 | +Overview |
| 15 | +-------- |
| 16 | + |
| 17 | +This project demonstrates the MAXM86161 integrated optical sensor module and its |
| 18 | +integration with the no-OS framework. The MAXM86161 is a complete, |
| 19 | +ultra-low-power, integrated optical data acquisition system, ideal for optical |
| 20 | +pulse-oximetry (SpO2) and heart-rate (HR) monitoring in wearable applications. |
| 21 | + |
| 22 | +The module combines three programmable LEDs (green, red, and IR), a low-noise |
| 23 | +photodiode signal path, an ambient-light-cancellation (ALC) 19-bit ADC, and a |
| 24 | +128-word FIFO into a single package. Key characteristics: |
| 25 | + |
| 26 | +* Three on-chip LED drivers (green, red, IR), programmable pulse amplitude and |
| 27 | + current range |
| 28 | +* 19-bit optical ADC with programmable integration time and ADC range |
| 29 | +* Programmable sample rate and sample averaging |
| 30 | +* 128-word (32-bit) FIFO with configurable watermark, roll-over, and interrupt |
| 31 | +* Programmable LED exposure sequence (up to six slots) |
| 32 | +* On-chip die temperature sensor |
| 33 | +* Low-power (shutdown) mode for battery-powered wearables |
| 34 | +* I2C interface (7-bit address 0x62) with an INTB interrupt output |
| 35 | + |
| 36 | +Applications |
| 37 | +------------ |
| 38 | + |
| 39 | +* Optical heart-rate monitoring |
| 40 | +* Pulse oximetry (SpO2) |
| 41 | +* Wearable and fitness health devices |
| 42 | +* Proximity detection |
| 43 | + |
| 44 | +Hardware Specifications |
| 45 | +----------------------- |
| 46 | + |
| 47 | +Power Supply Requirements |
| 48 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 49 | + |
| 50 | +The MAXM86161 operates from a 1.8 V analog/digital supply and a separate LED |
| 51 | +supply. On the evaluation system these rails are provided by the EV board; the |
| 52 | +I2C and INTB logic levels are 1.8 V. When wiring to a carrier, make sure the |
| 53 | +carrier's I2C bus and interrupt pin operate at the same logic level (the Maxim |
| 54 | +platform configures its I/O for the ``VDDIO`` rail). |
| 55 | + |
| 56 | +I2C Interface |
| 57 | +~~~~~~~~~~~~~ |
| 58 | + |
| 59 | +* 7-bit device address: 0x62 |
| 60 | +* Supported speeds: Standard (100 kHz), Fast (400 kHz); the examples use 400 kHz |
| 61 | +* INTB: active-low interrupt output (FIFO watermark / data-ready) |
| 62 | + |
| 63 | +No-OS Supported Examples |
| 64 | +------------------------ |
| 65 | + |
| 66 | +This project is organized around the no-OS variant based build flow. Selecting a |
| 67 | +variant at build time (``--variant <name>``) chooses which application is |
| 68 | +compiled. The platform ``main()`` is a thin dispatcher that calls |
| 69 | +``example_main()``, provided by the selected example. Shared initialization data |
| 70 | +is defined in |
| 71 | +`src/common <https://github.com/analogdevicesinc/no-OS/tree/main/projects/maxm86161/src/common>`__, |
| 72 | +and platform-specific macros and extra init parameters are in |
| 73 | +`src/platform <https://github.com/analogdevicesinc/no-OS/tree/main/projects/maxm86161/src/platform>`__. |
| 74 | + |
| 75 | +Basic Example |
| 76 | +~~~~~~~~~~~~~ |
| 77 | + |
| 78 | +The basic example (``--variant basic``) initializes the MAXM86161 and |
| 79 | +demonstrates fundamental functionality without any host tooling: |
| 80 | + |
| 81 | +- Device initialization and part/revision ID read-back |
| 82 | +- PPG configuration: integration time, ADC range, sample averaging, sample rate |
| 83 | +- LED configuration: settling time, PD bias, per-LED current range and pulse |
| 84 | + amplitude, and the six-slot LED exposure sequence (green / red / IR / ambient) |
| 85 | +- FIFO configuration: watermark and roll-over |
| 86 | +- Low-power mode enable and exit-shutdown to start sampling |
| 87 | +- Continuous polling loop that reads the die temperature and drains the FIFO, |
| 88 | + decoding each sample and printing it grouped by tag over the UART console |
| 89 | + |
| 90 | +The tunable acquisition parameters live at the top of |
| 91 | +`src/examples/basic/basic_example.c <https://github.com/analogdevicesinc/no-OS/tree/main/projects/maxm86161/src/examples/basic/basic_example.c>`__. |
| 92 | + |
| 93 | +IIO Example |
| 94 | +~~~~~~~~~~~ |
| 95 | + |
| 96 | +The IIO example (``--variant iio``) exposes the MAXM86161 as an IIO device over |
| 97 | +the UART transport, so the FIFO data stream and device attributes can be read by |
| 98 | +a host IIO client (libiio / IIO Oscilloscope). It configures the INTB GPIO |
| 99 | +interrupt, sets a FIFO watermark, and streams decoded samples through a circular |
| 100 | +buffer into the IIO buffer. A small in-code drain self-test |
| 101 | +(``MAXM86161_SELFTEST``) can be toggled at the top of |
| 102 | +`src/examples/iio_example/iio_example.c <https://github.com/analogdevicesinc/no-OS/tree/main/projects/maxm86161/src/examples/iio_example/iio_example.c>`__ |
| 103 | +to exercise the ISR → circular buffer → decode path over the console when no |
| 104 | +libiio host is available. |
| 105 | + |
| 106 | +If you are not familiar with ADI IIO Application, please take a look at: |
| 107 | +:dokuwiki:`IIO No-OS </resources/tools-software/no-os-software/iio>` |
| 108 | + |
| 109 | +If you are not familiar with ADI IIO-Oscilloscope Client, please take a look at: |
| 110 | +:dokuwiki:`IIO Oscilloscope </resources/tools-software/linux-software/iio_oscilloscope>` |
| 111 | + |
| 112 | +Attribute Test Example |
| 113 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 114 | + |
| 115 | +The attribute test example (``--variant attribute_test``) is a |
| 116 | +hardware-in-the-loop (HIL) integration test that runs against a real device over |
| 117 | +the live I2C bus. It mirrors the offline unit-test suite: every setter is |
| 118 | +followed by its matching getter to confirm the value reached the silicon and |
| 119 | +reads back unchanged, and it re-checks parameter validation and FIFO-decode |
| 120 | +logic plus a short live-acquisition sanity check. A compact Unity-style |
| 121 | +assertion layer prints a PASS/FAIL line per check and a summary over the UART |
| 122 | +console. The run is non-destructive but does not restore the original device |
| 123 | +state, so re-flash or power-cycle before switching to a measurement example. |
| 124 | + |
| 125 | +No-OS Supported Platforms |
| 126 | +------------------------- |
| 127 | + |
| 128 | +Maxim Platform |
| 129 | +~~~~~~~~~~~~~~ |
| 130 | + |
| 131 | +Used Hardware |
| 132 | +^^^^^^^^^^^^^ |
| 133 | + |
| 134 | +* `MAXM86161EVSYS <https://www.analog.com/en/resources/evaluation-hardware-and-software/evaluation-boards-kits/maxm86161evsys.html>`_ |
| 135 | +* `MAX32655FTHR <https://www.analog.com/MAX32655FTHR>`_ |
| 136 | + |
| 137 | +Connections |
| 138 | +^^^^^^^^^^^ |
| 139 | + |
| 140 | +The MAXM86161 communicates over I2C. The examples use the MAX32655's ``I2C2`` |
| 141 | +peripheral and take the INTB interrupt on ``P2_7``. The UART console appears on |
| 142 | +the MAX32655FTHR USB serial port at **230400 baud** (8N1). |
| 143 | + |
| 144 | ++-------------+------------------+--------------------------------------------------+ |
| 145 | +| MAXM86161 | MAX32655FTHR | Function | |
| 146 | ++=============+==================+==================================================+ |
| 147 | +| VDD / VLED | 1V8 | Power supply (see EV board) | |
| 148 | ++-------------+------------------+--------------------------------------------------+ |
| 149 | +| GND | GND | Ground | |
| 150 | ++-------------+------------------+--------------------------------------------------+ |
| 151 | +| SCL | P0_30 | I2C clock (I2C2) | |
| 152 | ++-------------+------------------+--------------------------------------------------+ |
| 153 | +| SDA | P0_31 | I2C data (I2C2) | |
| 154 | ++-------------+------------------+--------------------------------------------------+ |
| 155 | +| INTB | P2_7 | Interrupt (FIFO watermark / data ready) | |
| 156 | ++-------------+------------------+--------------------------------------------------+ |
| 157 | + |
| 158 | +The I2C pins, INTB pin, UART device, and baud rate are defined in |
| 159 | +`src/platform/maxim/parameters.h <https://github.com/analogdevicesinc/no-OS/tree/main/projects/maxm86161/src/platform/maxim/parameters.h>`__. |
| 160 | + |
| 161 | +Build Command |
| 162 | +^^^^^^^^^^^^^ |
| 163 | + |
| 164 | +The Maxim platform uses the CMake/Ninja build system via the ``no_os_build.py`` |
| 165 | +helper script. Available variants: ``basic``, ``iio``, ``attribute_test``. |
| 166 | +Available boards: ``max32655fthr``. |
| 167 | + |
| 168 | +For toolchain setup and prerequisites, see the |
| 169 | +:doc:`Maxim CMake build guide </build_guides/build_maxim_cmake>`. |
| 170 | + |
| 171 | +.. code-block:: bash |
| 172 | +
|
| 173 | + # point at your MaximSDK Libraries directory |
| 174 | + export MAXIM_LIBRARIES=/path/to/MaximSDK/Libraries |
| 175 | + # PowerShell (Windows) equivalent: |
| 176 | + # $env:MAXIM_LIBRARIES = "C:\MaximSDK\Libraries" |
| 177 | +
|
| 178 | + cd no-OS |
| 179 | +
|
| 180 | + # build a variant on the max32655fthr board (basic | iio | attribute_test) |
| 181 | + python tools/scripts/no_os_build.py build \ |
| 182 | + --project maxm86161 --variant basic --board max32655fthr |
| 183 | +
|
| 184 | + # build and flash (requires a connected debug probe) |
| 185 | + python tools/scripts/no_os_build.py build \ |
| 186 | + --project maxm86161 --variant basic --board max32655fthr \ |
| 187 | + --probe openocd --flash |
| 188 | +
|
| 189 | +To build the IIO or attribute-test applications instead, swap the ``--variant`` |
| 190 | +value: |
| 191 | + |
| 192 | +.. code-block:: bash |
| 193 | +
|
| 194 | + # IIO application (host libiio / IIO Oscilloscope over UART) |
| 195 | + python tools/scripts/no_os_build.py build \ |
| 196 | + --project maxm86161 --variant iio --board max32655fthr |
| 197 | +
|
| 198 | + # hardware-in-the-loop attribute/register test |
| 199 | + python tools/scripts/no_os_build.py build \ |
| 200 | + --project maxm86161 --variant attribute_test --board max32655fthr |
0 commit comments