nPM1300 one button example on custom board

Hi.

I'm testing the "nPM1300 One Button" example, but I'm having some problems. 

When setting up the npm1300_ek.overlay file, I specify that pin P0.15 is the interrupt pin on my custom board (nRF52840) and GPIO3 is the interrupt initiator pin on the PMIC, but I keep getting a warning that pin 3 is already in use in the device tree.

npm1300_ek.overlay -->

custom_board_nrf52840.dts -->

When I start an application, the LED connected to pin P0.03 on my board lights up (although it shouldn't). The interrupt does not work and the board does not respond to button presses on the nPM1300 EK.

Can you please advise me why this is happening and how to fix it?

Also by default there are problems in the overlay file related to pin 2 on the EK. Is there any way to fix them or will they not affect correct operation?

Thanks.

  • Hi. 

    Here is the part of the code associated with PMIC in the zephyr.dts file in the build folder. 

    zephyr.dts -->

    i2c1: i2c@40004000 {
    			compatible = "nordic,nrf-twi";
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x0 >;
    			reg = < 0x40004000 0x1000 >;
    			clock-frequency = < 0x186a0 >;
    			interrupts = < 0x4 0x1 >;
    			easydma-maxcnt-bits = < 0x10 >;
    			status = "okay";
    			pinctrl-0 = < &i2c1_default >;
    			pinctrl-1 = < &i2c1_sleep >;
    			pinctrl-names = "default", "sleep";
    			npm1300_ek_pmic: pmic@6b {
    				compatible = "nordic,npm1300";
    				reg = < 0x6b >;
    				host-int-gpios = < &gpio0 0xf 0x0 >;
    				pmic-int-pin = < 0x3 >;
    				npm1300_ek_gpio: gpio-controller {
    					compatible = "nordic,npm1300-gpio";
    					gpio-controller;
    					#gpio-cells = < 0x2 >;
    					ngpios = < 0x5 >;
    					phandle = < 0xb >;
    				};
    				npm1300_ek_regulators: regulators {
    					compatible = "nordic,npm1300-regulator";
    					npm1300_ek_buck1: BUCK1 {
    						regulator-min-microvolt = < 0x1b7740 >;
    						regulator-max-microvolt = < 0x325aa0 >;
    					};
    					npm1300_ek_buck2: BUCK2 {
    						regulator-min-microvolt = < 0xf4240 >;
    						regulator-max-microvolt = < 0x325aa0 >;
    						regulator-init-microvolt = < 0x325aa0 >;
    						retention-microvolt = < 0x2625a0 >;
    						enable-gpios = < &npm1300_ek_gpio 0x1 0x1 >;
    						retention-gpios = < &npm1300_ek_gpio 0x2 0x0 >;
    						pwm-gpios = < &npm1300_ek_gpio 0x2 0x1 >;
    					};
    					npm1300_ek_ldo1: LDO1 {
    						regulator-min-microvolt = < 0xf4240 >;
    						regulator-max-microvolt = < 0x325aa0 >;
    						regulator-initial-mode = < 0x3 >;
    						enable-gpios = < &npm1300_ek_gpio 0x2 0x1 >;
    					};
    					npm1300_ek_ldo2: LDO2 {
    						regulator-min-microvolt = < 0xf4240 >;
    						regulator-max-microvolt = < 0x325aa0 >;
    						regulator-initial-mode = < 0x3 >;
    						enable-gpios = < &npm1300_ek_gpio 0x2 0x1 >;
    					};
    				};
    				npm1300_ek_charger: charger {
    					compatible = "nordic,npm1300-charger";
    					term-microvolt = < 0x401640 >;
    					current-microamp = < 0x1d4c0 >;
    					dischg-limit-microamp = < 0x927c0 >;
    					vbus-limit-microamp = < 0x7a120 >;
    					thermistor-ohms = < 0x2710 >;
    					thermistor-beta = < 0xd34 >;
    					charging-enable;
    				};
    				npm1300_ek_buttons: buttons {
    					compatible = "gpio-keys";
    					pmic_button0: pmic_button_0 {
    						gpios = < &npm1300_ek_gpio 0x0 0x0 >;
    						label = "Pmic button switch 0";
    						zephyr,code = < 0xb >;
    					};
    				};
    				npm1300_ek_leds: leds {
    					compatible = "nordic,npm1300-led";
    					nordic,led0-mode = "error";
    					nordic,led1-mode = "charging";
    					nordic,led2-mode = "host";
    				};
    			};
    		};

    Interruptions still don't work. Here is a screenshot from the logic analyzer (GPIO3 and SHPHLD button behavior). It might be of some help to you.

    Thanks.

  • Hi, from your logic analyser trace the rising edge on GPIO3 shows that the interrupt from the PMIC is being generated as expected by the falling edge on SHIPHOLD (NPM1300_EVENT_SHIPHOLD_PRESS).

    The interrupt will only be cleared once it is detected by the host and the event registers are cleared by I2C.

    Do you see the event detected on the console?

    If not, can you check the state of P0.15 when the interrupt is active?
    You should be able to so this by reading the pin state with code or a shell command.

  • Hi, Andy. Thanks for answering.

    I will check the status of P0.15 and give an answer shortly.

    Do you happen to know why the pmic-int-pin property affects not only the pmic pin, but also the nRF52 pin?  The zephyr website says this property only applies to pmic.

    Thanks.

  • I do wonder if it is a intellisense error, I can replicate the same warning on a DK by switching the pin number

    Regards

    Runar

  • I think you are correct.
    It can't possibly affect anything else as that parameter is only used in a single place in the Zephyr codebase.

Related