Skip to content

Commit 578ec1e

Browse files
committed
drivers: sensor: Add driver for MAX32664C
- Add example project for MAX32664C Closes #93473 Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
1 parent 1f69b91 commit 578ec1e

File tree

6 files changed

+412
-0
lines changed

6 files changed

+412
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
cmake_minimum_required(VERSION 3.20.0)
4+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
5+
project(veml6031)
6+
7+
target_sources(app PRIVATE src/main.c)

samples/sensor/max32664/README.rst

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
.. zephyr:code-sample:: max32664c
2+
:name: MAX32664C + MAX86141 Sensor Hub
3+
:relevant-api: sensor_interface
4+
5+
Get health data from a MAX32664C and a MAX86141 sensor (polling mode) and publish them via Bluetooth.
6+
7+
NOTE: This example requires sensor hub firmware 30.13.31!
8+
9+
Overview
10+
********
11+
12+
This sample measures the heart rate and the blood oxygen saturation on a wrist and use the Zephyr
13+
Heartrate service to publish them via Bluetooth. It uses the MAX32664C sensor to control the MAX86141 sensor.
14+
15+
Requirements
16+
************
17+
18+
This sample uses the MAX32664 sensor controlled using the I2C30 interface at
19+
the nRF54L15-DK board.
20+
21+
References
22+
**********
23+
24+
- MAX32664C: https://www.analog.com/en/products/max32664.html
25+
26+
Building and Running
27+
********************
28+
29+
This project outputs sensor data to the console. It requires a MAX32664C
30+
sensor to be connected to the desired board. An additional MAX86141 sensor
31+
must be connected to the MAX32664C to provide the sensor data for the algorithms.
32+
33+
.. zephyr-app-commands::
34+
:zephyr-app: samples/sensor/max32664/
35+
:goals: build flash
36+
37+
38+
Sample Output
39+
=============
40+
41+
.. code-block:: console
42+
43+
Test all attributes for a good guess of attribute usage away of saturation.
44+
Light (lux): 6179 ALS (raw): 7100 IR (raw): 27 it: 0 div4: 0 gain: 0 --
45+
Light (lux): 1500 ALS (raw): 3447 IR (raw): 34 it: 0 div4: 0 gain: 1 --
46+
Light (lux): 4664 ALS (raw): 3537 IR (raw): 17 it: 0 div4: 0 gain: 2 --
47+
Light (lux): 5601 ALS (raw): 3218 IR (raw): 13 it: 0 div4: 0 gain: 3 --
48+
Light (lux): 1302 ALS (raw): 374 IR (raw): 5 it: 0 div4: 1 gain: 0 --
49+
Light (lux): 5584 ALS (raw): 3208 IR (raw): 11 it: 0 div4: 1 gain: 1 --
50+
Light (lux): 5285 ALS (raw): 1002 IR (raw): 3 it: 0 div4: 1 gain: 2 --
51+
Light (lux): 1455 ALS (raw): 209 IR (raw): 2 it: 0 div4: 1 gain: 3 --
52+
Light (lux): 4925 ALS (raw): 11317 IR (raw): 50 it: 1 div4: 0 gain: 0 --
53+
Light (lux): 3916 ALS (raw): 17999 IR (raw): 90 it: 1 div4: 0 gain: 1 --
54+
Light (lux): 2796 ALS (raw): 4299 IR (raw): 28 it: 1 div4: 0 gain: 2 --
55+
Light (lux): 5178 ALS (raw): 5950 IR (raw): 26 it: 1 div4: 0 gain: 3 --
56+
Light (lux): 4339 ALS (raw): 2493 IR (raw): 12 it: 1 div4: 1 gain: 0 --
57+
Light (lux): 2186 ALS (raw): 2512 IR (raw): 19 it: 1 div4: 1 gain: 1 --
58+
Light (lux): 5578 ALS (raw): 2115 IR (raw): 8 it: 1 div4: 1 gain: 2 --
59+
Light (lux): 4494 ALS (raw): 1291 IR (raw): 6 it: 1 div4: 1 gain: 3 --
60+
Light (lux): 3675 ALS (raw): 16892 IR (raw): 93 it: 2 div4: 0 gain: 0 --
61+
Light (lux): 3209 ALS (raw): 29495 IR (raw): 172 it: 2 div4: 0 gain: 1 --
62+
Light (lux): 4520 ALS (raw): 13710 IR (raw): 66 it: 2 div4: 0 gain: 2 --
63+
Light (lux): 4215 ALS (raw): 9687 IR (raw): 49 it: 2 div4: 0 gain: 3 --
64+
Light (lux): 3492 ALS (raw): 4013 IR (raw): 22 it: 2 div4: 1 gain: 0 --
65+
Light (lux): 3786 ALS (raw): 8700 IR (raw): 43 it: 2 div4: 1 gain: 1 --
66+
Light (lux): 4735 ALS (raw): 3591 IR (raw): 15 it: 2 div4: 1 gain: 2 --
67+
Light (lux): 3779 ALS (raw): 2171 IR (raw): 11 it: 2 div4: 1 gain: 3 --
68+
Light (lux): 3848 ALS (raw): 35376 IR (raw): 188 it: 3 div4: 0 gain: 0 --
69+
Light (lux): 3565 ALS (raw): 65535 IR (raw): 359 it: 3 div4: 0 gain: 1 -- OVERFLOW
70+
Light (lux): 4333 ALS (raw): 26297 IR (raw): 130 it: 3 div4: 0 gain: 2 --
71+
Light (lux): 3576 ALS (raw): 16435 IR (raw): 93 it: 3 div4: 0 gain: 3 --
72+
Light (lux): 4409 ALS (raw): 10133 IR (raw): 47 it: 3 div4: 1 gain: 0 --
73+
Light (lux): 3395 ALS (raw): 15606 IR (raw): 85 it: 3 div4: 1 gain: 1 --
74+
Light (lux): 4519 ALS (raw): 6854 IR (raw): 31 it: 3 div4: 1 gain: 2 --
75+
Light (lux): 3694 ALS (raw): 4245 IR (raw): 23 it: 3 div4: 1 gain: 3 --
76+
Light (lux): 3565 ALS (raw): 65535 IR (raw): 376 it: 4 div4: 0 gain: 0 -- OVERFLOW
77+
Light (lux): 1782 ALS (raw): 65535 IR (raw): 723 it: 4 div4: 0 gain: 1 -- OVERFLOW
78+
Light (lux): 3992 ALS (raw): 48450 IR (raw): 253 it: 4 div4: 0 gain: 2 --
79+
Light (lux): 3943 ALS (raw): 36247 IR (raw): 191 it: 4 div4: 0 gain: 3 --
80+
Light (lux): 3970 ALS (raw): 18248 IR (raw): 92 it: 4 div4: 1 gain: 0 --
81+
Light (lux): 3814 ALS (raw): 35064 IR (raw): 176 it: 4 div4: 1 gain: 1 --
82+
Light (lux): 4082 ALS (raw): 12381 IR (raw): 62 it: 4 div4: 1 gain: 2 --
83+
Light (lux): 4052 ALS (raw): 9311 IR (raw): 47 it: 4 div4: 1 gain: 3 --
84+
[...]
85+
Test finished.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
&pinctrl {
2+
i2c30_default: i2c30_default {
3+
group1 {
4+
psels = <NRF_PSEL(TWIM_SDA, 0, 4)>,
5+
<NRF_PSEL(TWIM_SCL, 0, 3)>;
6+
bias-pull-up;
7+
};
8+
};
9+
10+
i2c30_sleep: i2c30_sleep {
11+
group1 {
12+
psels = <NRF_PSEL(TWIM_SDA, 0, 4)>,
13+
<NRF_PSEL(TWIM_SCL, 0, 3)>;
14+
low-power-enable;
15+
};
16+
};
17+
};
18+
19+
20+
/ {
21+
aliases {
22+
sensor = &biometric_hub;
23+
};
24+
};
25+
26+
&led0 {
27+
gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
28+
label = "Green LED 0";
29+
};
30+
31+
32+
&i2c30 {
33+
compatible = "nordic,nrf-twim";
34+
status = "okay";
35+
clock-frequency = <I2C_BITRATE_FAST>;
36+
zephyr,flash-buf-max-size = <8250>;
37+
pinctrl-0 = <&i2c30_default>;
38+
pinctrl-1 = <&i2c30_sleep>;
39+
pinctrl-names = "default", "sleep";
40+
biometric_hub: max32664c@55 {
41+
compatible = "maxim,max32664c";
42+
reg = <0x55>;
43+
status = "okay";
44+
reset-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>;
45+
mfio-gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
46+
motion-time = <200>;
47+
motion-threshold = <500>;
48+
hr-config = [00 11];
49+
spo2-config = [30 20];
50+
};
51+
};
52+
53+
&gpio2 {
54+
status = "okay";
55+
56+
vled {
57+
gpio-hog;
58+
gpios = <6 GPIO_ACTIVE_HIGH>;
59+
/* low output to select on-board codec control */
60+
output-high;
61+
};
62+
};
63+
64+
&dppic10 {
65+
status = "okay";
66+
};
67+
68+
&ppib11 {
69+
status = "okay";
70+
};
71+
72+
&ppib21 {
73+
status = "okay";
74+
};
75+
76+
&dppic20 {
77+
status = "okay";
78+
};
79+
80+
&ppib22 {
81+
status = "okay";
82+
};
83+
84+
&ppib30 {
85+
status = "okay";
86+
};
87+
88+
&dppic30 {
89+
status = "okay";
90+
};

samples/sensor/max32664/prj.conf

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
CONFIG_CLOCK_CONTROL=y
2+
3+
CONFIG_SENSOR=y
4+
5+
CONFIG_LOG=y
6+
CONFIG_LOG_PRINTK=y
7+
CONFIG_I2C=y
8+
9+
CONFIG_HEAP_MEM_POOL_SIZE=16384
10+
11+
CONFIG_BT=y
12+
CONFIG_BT_SMP=y
13+
CONFIG_BT_PERIPHERAL=y
14+
CONFIG_BT_DIS=y
15+
CONFIG_BT_DIS_PNP=n
16+
CONFIG_BT_BAS=y
17+
CONFIG_BT_HRS=y
18+
CONFIG_BT_DEVICE_NAME="Zephyr Heartrate Sensor"
19+
CONFIG_BT_DEVICE_APPEARANCE=833
20+
21+
CONFIG_DEBUG_OPTIMIZATIONS=y
22+
CONFIG_USE_SEGGER_RTT=y
23+
CONFIG_LOG_BACKEND_RTT=y
24+
CONFIG_LOG_BACKEND_RTT_MODE_BLOCK=y
25+
CONFIG_LOG_BUFFER_SIZE=4096
26+
CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE=128
27+
CONFIG_LOG_BLOCK_IN_THREAD=y
28+
29+
CONFIG_MAXIM_MAX32664C_LOG_LEVEL_DBG=y
30+
CONFIG_MAX32664C_USE_MAX86141=y
31+
CONFIG_MAX32664C_ACC_ID=0x43

samples/sensor/max32664/sample.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
sample:
2+
name: MAX32664C + MAX86141 Sensor Hub Sample
3+
tests:
4+
sample.sensor.max32664c:
5+
harness: sensor
6+
platform_allow: nrf54l15dk/nrf54l15/cpuapp
7+
integration_platforms:
8+
- nrf54l15dk/nrf54l15/cpuapp
9+
tags: sensors
10+
filter: dt_compat_enabled("maxim,max32664c")

0 commit comments

Comments
 (0)