Issue with Configuring MAX30101 with nRF Connect SDK

Hi, all,

I am new to nRF Connect SDK and am currently facing some configuration issues with the MAX30101 driver in a Zephyr project. Here is the example program and source code for the driver. My main question is: how do you configure sensors like the MAX30101 without directly editing the auto-generated .config file?

I successfully got the example code to work on the nRF52 DK using nRF Connect SDK v2.5.2, but it only retrieves readings from the green LED. I would like to get readings from the red and IR LEDs as well. The Kconfig file in the source code shows different configuration options for the sensor, but when I try to open the Kconfig GUI in VS Code, the section for the MAX30101 is blacked out. It states that I haven't set DT_HAS_MAXIM_MAX30101_ENABLED to y. However, when I check the auto-generated .config file in the output, I can see that DT_HAS_MAXIM_MAX30101_ENABLED=y is already set.

After some trial and error, I discovered that it is possible to directly edit the .config file to configure the MAX30101, and I was able to turn on the red and IR LEDs and obtain some readings. However, this approach is quite cumbersome since the .config file is re-generated every time I modify the prj.conf file in my project. I'm wondering if there is a way to configure the MAX30101 so that the settings are automatically registered in the .config file without manual editing.

Thank you in advance

Jack

Parents
  • Hi Jack, 
    Could you show your device tree board configuration  ? 

    If you set a node with compatible = "maxim,max30101" then DT_HAS_MAXIM_MAX30101_ENABLED  will be set. 

    Have you tried to set CONFIG_MAX30101_LED2_PA=0x33 in your prj.conf ? 
    Editing the .config file directly is not the best way to do configuration. 

  • Hi, Hung,

    Thanks for the reply. Here is the device tree overlay.

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
    
    // You can also use the buttons in the sidebar to perform actions on nodes.
    // Actions currently available include:
    
    // * Enabling / disabling the node
    // * Adding the bus to a bus
    // * Removing the node
    // * Connecting ADC channels
    
    // For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
    // You can also visit the nRF DeviceTree extension documentation at https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/ncs_configure_app.html#devicetree-support-in-the-extension
    &i2c0 {  
        max30101: max30101@57{
            status = "okay";
            compatible = "maxim,max30101";
            reg = < 0x57 >;
        };
    };
    
    &gpio0 {
    	status = "okay";
    };

    When I attempt to set any MAX30101-related configuration, I receive a warning message. Interestingly, despite the warning, I still see the configuration changes from prj.conf reflected in the .config file.

Reply
  • Hi, Hung,

    Thanks for the reply. Here is the device tree overlay.

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.
    
    // You can also use the buttons in the sidebar to perform actions on nodes.
    // Actions currently available include:
    
    // * Enabling / disabling the node
    // * Adding the bus to a bus
    // * Removing the node
    // * Connecting ADC channels
    
    // For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
    // You can also visit the nRF DeviceTree extension documentation at https://docs.nordicsemi.com/bundle/nrf-connect-vscode/page/guides/ncs_configure_app.html#devicetree-support-in-the-extension
    &i2c0 {  
        max30101: max30101@57{
            status = "okay";
            compatible = "maxim,max30101";
            reg = < 0x57 >;
        };
    };
    
    &gpio0 {
    	status = "okay";
    };

    When I attempt to set any MAX30101-related configuration, I receive a warning message. Interestingly, despite the warning, I still see the configuration changes from prj.conf reflected in the .config file.

Children
Related