nPM1300 LEDs not recognized by CAF LED module - "No LEDs defined" error

I'm encountering an issue while trying to use the CAF LED module with the nPM1300 PMIC. Despite configuring the Device Tree, prj.conf, and led_state_def.h, I'm still getting a "No LEDs defined" error during compilation. I'd appreciate any help or insights from the community.
Error message:
C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c: In function 'leds_init':
C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "No LEDs defined"
 87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
 | ^~~~~~~~~~~~~~
C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c:182:9: note: in expansion of macro 'BUILD_ASSERT'
 182 | BUILD_ASSERT(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) > 0, "No LEDs defined");
My setup:
  1. Device Tree Configuration (excerpt):
&i2c1 {
    npm1300_ek_pmic: pmic@6b {
    compatible = "nordic,npm1300";
    reg = <0x6b>;
   
    npm1300_ek_leds: leds {
        compatible = "nordic,npm1300-led";
        nordic,led0-mode = "host";
        nordic,led1-mode = "host";
        nordic,led2-mode = "host";
        };
    };
};
  1. prj.conf Configuration:
# CAF LEDs Configuration
CONFIG_CAF_LEDS=y
CONFIG_LED=y
 
# nPM1300 specific LED configuration
CONFIG_LED_NPM1300=y
 
# Necessary drivers for nPM1300
CONFIG_I2C=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_NPM1300=y
CONFIG_GPIO_NPM1300=y
 
# Other nPM1300 related configurations
CONFIG_GPIO=y
CONFIG_INPUT=y
  1. led_state_def.h Configuration:
tatic const uint8_t led_map[LED_ID_COUNT] = {
    [LED_ID_SYSTEM_STATE] = 0,
    [LED_ID_PEER_STATE] = 1
};


static const struct led_effect led_system_state_effect[LED_SYSTEM_STATE_COUNT] = {
    [LED_SYSTEM_STATE_IDLE]     = LED_EFFECT_LED_ON(LED_COLOR(255, 0, 0)),
    [LED_SYSTEM_STATE_CHARGING] = LED_EFFECT_LED_ON(LED_COLOR(0, 255, 0)),
    [LED_SYSTEM_STATE_ERROR]    = LED_EFFECT_LED_BLINK(200, LED_COLOR(255, 0, 0)),
};

static const struct led_effect led_peer_state_effect[LED_PEER_COUNT][LED_PEER_STATE_COUNT] = {
    {
        [LED_PEER_STATE_DISCONNECTED]   = LED_EFFECT_LED_OFF(),
        [LED_PEER_STATE_CONNECTED]      = LED_EFFECT_LED_ON(LED_COLOR(0, 0, 255)),
        [LED_PEER_STATE_PEER_SEARCH]    = LED_EFFECT_LED_BLINK(50, LED_COLOR(0, 0, 255)),
    }
};
I've tried the following:
  1. Adjusted the Device Tree configuration for nPM1300 LEDs.
  2. Updated prj.conf with the required configurations for CAF LEDs and nPM1300.
  3. Adapted led_state_def.h to the limitations of the nPM1300 (no PWM, only on/off states).
  4. Multiple reviews and cleanups of the configurations to avoid conflicts.
Despite these adjustments, I'm still getting the "No LEDs defined" error. It seems that the system is not recognizing the LED definitions.
Has anyone encountered a similar issue or can provide guidance on what I might be missing? Any help would be greatly appreciated!
Thank you in advance for your assistance.

Parents
  • Hi,
    the version of ncs is v2.8.0.

    Yes there are the pull ups at SDA/SCL. The nPM1300 is working great.

    I can use the LEDs connected to the nPM1300 by using Zephyr's LED driver.
    But with the CAF LED driver it seems not to work. I've just modified the nRF Desktop App. 

    .........
    from C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c:7:
    C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c: In function 'leds_init':
    C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "No LEDs defined"
       87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
          |                                    ^~~~~~~~~~~~~~
    C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c:182:9: note: in expansion of macro 'BUILD_ASSERT'
      182 |         BUILD_ASSERT(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) > 0, "No LEDs defined");
          |         ^~~~~~~~~~~~
    [288/368] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.8.0/modules/hal/nordic/nrfx/drivers/src/nrfx_gpiote.c.obj
    ninja: build stopped: subcommand failed.

Reply
  • Hi,
    the version of ncs is v2.8.0.

    Yes there are the pull ups at SDA/SCL. The nPM1300 is working great.

    I can use the LEDs connected to the nPM1300 by using Zephyr's LED driver.
    But with the CAF LED driver it seems not to work. I've just modified the nRF Desktop App. 

    .........
    from C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c:7:
    C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c: In function 'leds_init':
    C:/ncs/v2.8.0/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "No LEDs defined"
       87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
          |                                    ^~~~~~~~~~~~~~
    C:/ncs/v2.8.0/nrf/subsys/caf/modules/leds.c:182:9: note: in expansion of macro 'BUILD_ASSERT'
      182 |         BUILD_ASSERT(DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) > 0, "No LEDs defined");
          |         ^~~~~~~~~~~~
    [288/368] Building C object modules/hal_nordic/nrfx/CMakeFiles/modules__hal_nordic__nrfx.dir/C_/ncs/v2.8.0/modules/hal/nordic/nrfx/drivers/src/nrfx_gpiote.c.obj
    ninja: build stopped: subcommand failed.

Children
Related