nPM1300 TWI not working without J4 (nPM controller) connected

Per (+) Trouble with nPM1300EK - Nordic Q&A - Nordic DevZone - Nordic DevZone, I've disconnected TWI from the board while doing the battery profiling and that worked successfully (thanks!).  Unfortunately, this has given me a new problem:  Without J4 (the nPM controller USB) connected, the TWI bus doesn't seem to work properly.  Disconnecting J4 causes my nRF54l15 to think the TWI bus isn't ready.  My firmware prints:

[00:00:00.533,869] <inf> main: twi30 bus device is ready
[00:00:00.533,881] <dbg> pmic_npm1300: pmic_npm1300_init: pmic_dev=0x3b0e8, charger_dev=0x3b1e4, pmic_gpio_dev=0x3b10c
[00:00:00.533,899] <dbg> pmic_npm1300: pmic_npm1300_init: pmic_dev->name=pmic@6b, ready=0
[00:00:00.533,914] <dbg> pmic_npm1300: pmic_npm1300_init: charger_dev->name=NPM1300_CHARGER, ready=0
[00:00:00.533,929] <dbg> pmic_npm1300: pmic_npm1300_init: pmic_gpio_dev->name=gpio, ready=0
[00:00:00.533,945] <wrn> pmic_npm1300: PMIC core device not ready (attempt 1/3)
[00:00:00.533,950] <wrn> pmic_npm1300: PMIC charger device not ready (attempt 1/3)
[00:00:00.533,954] <wrn> pmic_npm1300: PMIC GPIO device not ready (attempt 1/3)
[00:00:00.584,022] <wrn> pmic_npm1300: PMIC core device not ready (attempt 2/3)
[00:00:00.584,027] <wrn> pmic_npm1300: PMIC charger device not ready (attempt 2/3)
[00:00:00.584,031] <wrn> pmic_npm1300: PMIC GPIO device not ready (attempt 2/3)
[00:00:00.634,100] <wrn> pmic_npm1300: PMIC core device not ready (attempt 3/3)
[00:00:00.634,105] <wrn> pmic_npm1300: PMIC charger device not ready (attempt 3/3)
[00:00:00.634,109] <wrn> pmic_npm1300: PMIC GPIO device not ready (attempt 3/3)
[00:00:00.634,113] <err> pmic_npm1300: PMIC core device is not ready after retries
[00:00:00.634,118] <wrn> main: PMIC init failed (-19)
[00:00:01.134,214] <err> main: Raw I2C probe failed (-5) reading PMIC @0x6b:0x00

The related code is just:

    for (int attempt = 0; attempt < PMIC_INIT_RETRIES; attempt++) {
        if (!device_is_ready(pmic_dev)) {
            LOG_WRN("PMIC core device not ready (attempt %d/%d)", attempt + 1, PMIC_INIT_RETRIES);
        }
        if (!device_is_ready(charger_dev)) {
            LOG_WRN("PMIC charger device not ready (attempt %d/%d)", attempt + 1, PMIC_INIT_RETRIES);
        }
        if (!device_is_ready(pmic_gpio_dev)) {
            LOG_WRN("PMIC GPIO device not ready (attempt %d/%d)", attempt + 1, PMIC_INIT_RETRIES);
        }
        if (device_is_ready(pmic_dev) && device_is_ready(charger_dev) && device_is_ready(pmic_gpio_dev)) {
            break;
        }
        if (attempt < PMIC_INIT_RETRIES - 1) {
            k_msleep(PMIC_INIT_RETRY_DELAY_MS);
        }
    }

If I connect J4, it works as expected, with or without PowerUP running.  I can even connect it between retries and it will start working.  If I disconnect J4, it will stop working (getting fuel gauging info fails).

The block diagram for the nPM1300EK indicates that the TWI bus connects directly to the nPM1300, so it doesn't seem like the controller should be needed.  I'm currently running off of battery power, but it doesn't matter if J3 is connected or not.  When I check the voltages of various lines, everything seems as I'd expect:

  • nRF54l15DK VDDIO lines = 3.3V
  • nPM1300EK VDDIO = 3.3V
  • nPM1300EK buck1 and buck2 = 3.3V
  • nPM1300EK VSYS = ~4.1V (battery is charged)

FWIW, here are pictures of the boards:

The nRF54l15 is powered from buck2 of the nPM1300EK.  TWI is using P0.3 and P0.4.  The other wires are for other peripherals.

Here's the section from the device overlay:

// Use I2C to talk to the PMIC
&i2c30 {
    compatible = "nordic,nrf-twim";
    status = "okay";
    clock-frequency = <I2C_BITRATE_STANDARD>;
    pinctrl-0 = <&i2c30_default>;
    pinctrl-1 = <&i2c30_sleep>;
    pinctrl-names = "default", "sleep";
    npm1300: pmic@6b {
        compatible = "nordic,npm1300";
        reg = <0x6b>;
        npm1300_gpio: gpio {
            compatible = "nordic,npm1300-gpio";
            gpio-controller;
            #gpio-cells = <2>;
            ngpios = <5>;
        };
        npm1300_charger: charger {
            compatible = "nordic,npm1300-charger";
            label = "NPM1300_CHARGER";
            term-microvolt = <4200000>;
            term-warm-microvolt = <4100000>;
            current-microamp = <200000>;
            dischg-limit-microamp = <1000000>;
            vbus-limit-microamp = <500000>;
            thermistor-ohms = <10000>;
            thermistor-beta = <3380>;
            charging-enable;
        };
        regulators {
            compatible = "nordic,npm1300-regulator";
            npm1300_buck1: BUCK1 {
                regulator-min-microvolt = <600000>;
                regulator-max-microvolt = <3300000>;
                regulator-init-microvolt = <3300000>;
                regulator-boot-on;
                regulator-always-on;
                status = "okay";
            };
            npm1300_buck2: BUCK2 {
                regulator-min-microvolt = <600000>;
                regulator-max-microvolt = <3300000>;
                regulator-init-microvolt = <3300000>;
                regulator-boot-on;
                regulator-always-on;
                status = "okay";
            };
        };
    };
};

How can I get the TWI bus working successfully without J4 connected? Does the controller chip do some configuration to the nPM1300 that is making it work?  I'm pretty stumped.

Parents
  • "Not sure about my wiring" as in you think it's wrong/bad or that you can't make sense of my pictures/overlay?  I admit that I'm trying to put as much relevant info in as I can to help diagnostics, which may be making things more complicated.

    I re-wired and ran the sample and it seems to work with or without J4 plugged in, which is another interesting data point.  The main problem for me is that pins P1.11 and P1.12 are already in use by a different peripheral.  I'm actually running pretty low on usable pins, which is why I'm using P0.03 and P0.04.  I'm also already using spi21 and spi22 and spi00 is used for external memory on the DK and uart20 is used by the debugger. i2c30 is the only one still available.

    I updated the sample to use i2c30 and P0.03 and P0.04 and it still worked with and without J4 plugged in, so it doesn't seem specific to that configuration.  I'd expect it to work:  According to clock pins, TWIM's SCL (unsurprisingly) needs to be a clock pin.  P0.03 and P0.04 are both clock pins according to Pin assignments, so that should be fine.  According to TWIM configuration TWIM30 needs to use port 0, so that lines up.  AFAIK, I'm not using any other peripherals with ID 30.  I can't think of anything else that I need to check.

    If nothing else, the fact that it works when J4 is connected indicates to me that the wiring itself is OK, at least to some degree.  It definitely worked with the sample code.  That said, I don't know what the problem is, so I'm open to any ideas.

  • Might be that I am misunderstanding something here, but is the FG board connected to the EK? I am not sure about the reason for that.

    First thing to try is disconnecting the FG board and checking then the connection between EK and DK.

    Regards,

    Elfving

  • Yes, the fuel gauge board is connected.  I had previously profiled the battery that I'm now using and I had never disconnected it.  Disconnecting the fuel gauge board doesn't fix it.  As soon as I disconnect the plug from J4, the nRF54l15DK immediately stops being able to talk to the nPM1300EK.

    [00:29:36.433,129] <inf> pmic_npm1300: V: 4.101, I: 0.000, T: 25.10, SoC: 95.03, TTE: 11355182, TTF: nan
    [00:30:06.438,149] <inf> pmic_npm1300: V: 4.106, I: 0.000, T: 25.10, SoC: 95.03, TTE: 11446964, TTF: nan
    [00:30:36.443,173] <inf> pmic_npm1300: V: 4.101, I: 0.000, T: 25.10, SoC: 95.03, TTE: 11469531, TTF: nan
    [00:31:06.943,402] <wrn> pmic_npm1300: Transient charger read error (err -5), retry 0/2
    [00:31:07.453,578] <wrn> pmic_npm1300: Transient charger read error (err -5), retry 1/2
    [00:31:07.963,752] <wrn> pmic_npm1300: Transient charger read error (err -5), retry 2/2
    [00:31:07.973,822] <err> pmic_npm1300: Could not read from charger device (-5)
    [00:31:07.973,827] <wrn> ble_services: Battery sample failed (-5)
    [00:31:18.473,994] <wrn> pmic_npm1300: Transient charger read error (err -5), retry 0/2
    [00:31:18.984,170] <wrn> pmic_npm1300: Transient charger read error (err -5), retry 1/2
    [00:31:19.494,372] <wrn> pmic_npm1300: Transient charger read error (err -5), retry 2/2
    [00:31:19.504,452] <err> pmic_npm1300: Could not read from charger device (-5)
    [00:31:19.504,458] <wrn> ble_services: Battery sample failed (-5)

    I was wrong about just reconnecting J4 for it to recover... I need to reconnect and reset the nRF54l15 for communication to resume.

  • There shouldn't be a need to keep the FG board connected while attempting to connect an external DK atleast. Though if that doesn't help, try to check whether the pull up is enabled on the bus lines. (in DTS this is done by adding bias-pull-up to the i2c30_default config)

    And disconnecting the TWI while the SoC is powered up may require a power cycle to get the TWI working again.

    Regards,

    Elfving

Reply
  • There shouldn't be a need to keep the FG board connected while attempting to connect an external DK atleast. Though if that doesn't help, try to check whether the pull up is enabled on the bus lines. (in DTS this is done by adding bias-pull-up to the i2c30_default config)

    And disconnecting the TWI while the SoC is powered up may require a power cycle to get the TWI working again.

    Regards,

    Elfving

Children
Related