npm1300 zephyr driver documentation

Hi,

I'm developing now on a custom board with the npm1300. I see that there are two examples in NCS based on zephyr's drivers. Moreover, the nPM powerUP desktop application only exports an overlay file for use in the device tree with the zephyr driver.

However, I could not find detailed documentation of the Zephyr API's implementation of the driver, which callbacks are implemented and which ones are not etc.

For example, I can turn the LEDs on and off with the led driver, but `led_blink` doesn't do anything. I'm basically looking for documentation describing this stuff, since trial and error takes way too long for a chip with so many functionalities.

On a similar note, are these functions even thread-safe? I'm happy to use these drivers but only if I can trust them :D

Thank you!

Parents
  • I'm currently on the same "mission".

    For the LED there is a sample:

    nrf/samples/pmic/native/npm1300_one_button

    and for the charger as well.

    nrf/samples/pmic/native/npm1300_fuel_gauge

    Not sure, why Nordic decided to not implement the charger API and used that more or less proprietary one.

    I currently stuck in decoding the

    sensor_channel_get(charger, SENSOR_CHAN_NPM1300_CHARGER_STATUS, &value);

    for now it seems to be a rather incomplete API.

  • fuel gauge is not the charger, The Fuel gauge sample demonstrates how to calculate the state of charge of a battery.

    The nPM1300's charger uses standard Zephyr API, and can be used in any sample by using the correct settings in the overlay.  

  • Does this apply for ncs 2.6.1 or only newer ncs?

    Do you have an example of the "correct settings in the overlay"?

    That's from the overlay I'm using:

        npm1300_pmic: pmic@6b {
            compatible = "nordic,npm1300";
            reg = <0x6b>;

            npm1300_gpio: gpio-controller {
                compatible = "nordic,npm1300-gpio";
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <5>;
            };

            npm1300_leds: leds {
                compatible = "nordic,npm1300-led";
                nordic,led0-mode = "error";
                nordic,led1-mode = "charging";
                nordic,led2-mode = "host";
            };

            npm1300_charger: charger {
                compatible = "nordic,npm1300-charger";
                term-microvolt = <4150000>;
                term-warm-microvolt = <4000000>;
                current-microamp = <800000>;
                dischg-limit-microamp = <1000000>;
                vbus-limit-microamp = <1000000>;
                thermistor-ohms = <10000>;
                thermistor-beta = <3380>;
                charging-enable;
            };

            npm1300_regulators: regulators {
                compatible = "nordic,npm1300-regulator";

                npm1300_buck1: BUCK1 {
                    regulator-min-microvolt = <2700000>;
                    regulator-max-microvolt = <3300000>;
                    regulator-always-on;
                };

                npm1300_buck2: BUCK2 {
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                };


            };
        };

Reply
  • Does this apply for ncs 2.6.1 or only newer ncs?

    Do you have an example of the "correct settings in the overlay"?

    That's from the overlay I'm using:

        npm1300_pmic: pmic@6b {
            compatible = "nordic,npm1300";
            reg = <0x6b>;

            npm1300_gpio: gpio-controller {
                compatible = "nordic,npm1300-gpio";
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <5>;
            };

            npm1300_leds: leds {
                compatible = "nordic,npm1300-led";
                nordic,led0-mode = "error";
                nordic,led1-mode = "charging";
                nordic,led2-mode = "host";
            };

            npm1300_charger: charger {
                compatible = "nordic,npm1300-charger";
                term-microvolt = <4150000>;
                term-warm-microvolt = <4000000>;
                current-microamp = <800000>;
                dischg-limit-microamp = <1000000>;
                vbus-limit-microamp = <1000000>;
                thermistor-ohms = <10000>;
                thermistor-beta = <3380>;
                charging-enable;
            };

            npm1300_regulators: regulators {
                compatible = "nordic,npm1300-regulator";

                npm1300_buck1: BUCK1 {
                    regulator-min-microvolt = <2700000>;
                    regulator-max-microvolt = <3300000>;
                    regulator-always-on;
                };

                npm1300_buck2: BUCK2 {
                    regulator-min-microvolt = <3300000>;
                    regulator-max-microvolt = <3300000>;
                };


            };
        };

Children
Related