How to set an interrupt on LDSW via GPIO in the NPM1300 using the nRF Connect SDK.

I am using NCS v2.5.1 and working on a project where I need to turn off the system using a button that triggers an interrupt on a GPIO. I want this GPIO to control a load switch to turn it on and off. Where both the GPIO and the load switch are part of the NPM1300. How can I achieve this using the nRF Connect SDK?

Is there any configuration available in overlay file? 

Parents Reply
  • Hi, yes this is possible.

    You have to add
    enable-gpios = <&npm1300_ek_gpio 0 GPIO_ACTIVE_HIGH>; 
    to the load swtich/LDO settings portion of your overlay.

    You also have to add the gpio controller in the i2c configuration portion of the overlay. 

    example:

    &arduino_i2c {
       npm1300_ek_pmic: pmic@6b {
           compatible = "nordic,npm1300";
           reg = <0x6b>;
    
           npm1300_ek_gpio: gpio-controller {
               compatible = "nordic,npm1300-gpio";
               gpio-controller;
               #gpio-cells = <2>;
               ngpios = <5>;
           };
    
    };
    
    npm1300_ek_ldo1: LDO1 {
        regulator-initial-mode = <NPM1300_LDSW_MODE_LDSW>;
        // soft-start-microamp = <20000>;
        enable-gpios = <&npm1300_ek_gpio 0 GPIO_ACTIVE_HIGH>;
        
    };

Children
  • Hi,

    I tried the approach you suggested by adding enable-gpios = <&npm1300_ek_gpio 0 GPIO_ACTIVE_HIGH>; to the load switch/LDO settings portion of my overlay. I also included the GPIO controller in the I2C configuration section as you advised.

    However, it didn't work as expected. Below is the code I tried:

    &i2c0_default {
    	group1 {
    		bias-pull-up;
    	};
    };
    
    &arduino_i2c {
        npm1300_ek_pmic: pmic@6b {
            compatible = "nordic,npm1300";
            reg = <0x6b>;
     
            npm1300_ek_gpio: gpio-controller {
                compatible = "nordic,npm1300-gpio";
                gpio-controller;
                #gpio-cells = <2>;
                ngpios = <5>;
            };
    
    
    		npm1300_ek_regulators: regulators {
    			compatible = "nordic,npm1300-regulator";
    
                npm1300_ek_ldo1: LDO1 {
    				regulator-init-microvolt = <3300000>;
    				regulator-allowed-modes = <NPM1300_LDSW_MODE_LDSW>;
                    regulator-initial-mode = <NPM1300_LDSW_MODE_LDSW>;
                    // soft-start-microamp = <20000>;
                    enable-gpios = <&npm1300_ek_gpio 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;             
                };
    		};
             
        };    
     };
    

    Additionally, I found in one of the DT binding files that to make the enable-gpios property work, we might need to set the DVS (Dynamic Voltage Scaling) mode first.

    Could you please advise on the next steps? Should we configure the DVS mode before enabling the GPIO, or is there something else that might be missing?

    Thanks for your help!

  • I see that the nPM1300 One Button sample has not been mentioned in this ticket yet.

    Maybe this sample does what you need?

  • The code snippet I provided earlier is actually from that same sample, but unfortunately, it's not working as expected in my case.

    I want to configure one of the nPM1300 GPIOs to trigger the load switch. 

  • I am talking with our experts here, and they ask:

    "
    Can you confirm customer has connected something at LSIN* inputs? Also it seems they want to use the LDO mode, but they are configuring it as LDSW ( regulator-initial-mode = <NPM1300_LDSW_MODE_LDSW>; )."

  • We are using the buck converter's output at the LSIN* input, and in this ticket, I was advised to use LDSW mode.


    You have to add
    enable-gpios = <&npm1300_ek_gpio 0 GPIO_ACTIVE_HIGH>; 
    to the load swtich/LDO settings portion of your overlay.

    You also have to add the gpio controller in the i2c configuration portion of the overlay. 

    example:

    look into the code snippet provided in the conversation above.

Related