Looking for example of Max30102/5 with nrf52840

I saw several posts on this issue, but no complete example that works

If there is one that works - it would be great

Parents Reply Children
  • Hi,

     

    Avi said:

    So I need some help on how to modify this example 

    Or if there is another example which will have complete code?

    I also tried to compile the the Max30101 example under Zyphyr 1.9

    There is an error if I build in VS Code, but it compiles under Segger with Run_Cmake (as described in:

    https://devzone.nordicsemi.com/f/nordic-q-a/75193/build-error-for-example-code-of-max30101-with-nrf-sdk-v1-5-0

    If you get an error, please share more details in the future.

    What you need to do is to define your board overlay in the "boards/nrf52840dk_nrf52840.overlay" (assuming you're using the DK) and then compile and run the sample.

    The change that was introduced last year is the change from "max" to "maxim":

    https://github.com/zephyrproject-rtos/zephyr/commit/98f43ba0be94d010207235b19e0cbb2ed059c46e

    Here's an example overlay that shall work for newer NCS versions:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    &i2c0 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    sda-pin = <3>;
    scl-pin = <4>;
    clock-frequency = <I2C_BITRATE_FAST>;
    max30101@57 {
    status = "okay";
    compatible = "maxim,max30101";
    reg = <0x57>;
    label = "MAX30101";
    };
    };
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Kind regards,

    Håkon

  • Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    Building max30101
    west build --build-dir c:\Users\avipa\Nordic\max30101\build c:\Users\avipa\Nordic\max30101 --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT:STRING="c:/Users/avipa/Nordic/max30101"
    -- west build: generating a build system
    Including boilerplate (Zephyr base): C:/Users/avipa/ncs/v1.9.0/zephyr/cmake/app/boilerplate.cmake
    -- Application: C:/Users/avipa/Nordic/max30101
    -- Zephyr version: 2.7.99 (C:/Users/avipa/ncs/v1.9.0/zephyr), build: v2.7.99-ncs1
    -- Found Python3: C:/Users/avipa/ncs/v1.9.0/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: C:/Users/avipa/ncs/v1.9.0/zephyr/.cache
    -- Found dtc: C:/Users/avipa/ncs/v1.9.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (c:/Users/avipa/ncs/v1.9.0/toolchain/opt)
    -- Found BOARD.dts: C:/Users/avipa/ncs/v1.9.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: C:/Users/avipa/Nordic/max30101/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Users/avipa/Nordic/max30101/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Users/avipa/Nordic/max30101/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Users/avipa/Nordic/max30101/build/zephyr/dts.cmake
    Parsing C:/Users/avipa/ncs/v1.9.0/zephyr/Kconfig
    Loaded configuration 'C:/Users/avipa/ncs/v1.9.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration 'C:/Users/avipa/Nordic/max30101/prj.conf'
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Attached is the error I get when I tried to compile via VS code in NRF Connect 1.9

    I didn't understand your answer about " board overlay in the "boards/nrf52840dk_nrf52840.overlay"

    What should I do?

  • Hi,

     

    Thank you for posting the build log. The log that you provide states that the DT definition is not matching.

    Avi said:
    What should I do?

    create the file boards\nrf52840dk_nrf52840.overlay containing the example definition that I posted, then re-import your project and build again.

    Feel free to change the pin definition to match your own setup.

     

    Kind regards,

    Håkon

  • I followed up with the boards/nrf52840dk_nrf52840.overlay and I am getting now aan error:

    undefined reference to `init_I2C'

    In my prj.conf, I have this:

    CONFIG_BT=y
    CONFIG_BT_DEBUG_LOG=y

    CONFIG_I2C=y
    CONFIG_NRFX_TWI=y
    CONFIG_NRFX_TWI0=y
    CONFIG_NRFX_TWI1=y
    CONFIG_I2C_NRFX=y
    What can be the problem of the Init_I2C?