I have a device with 3 major components:
- Fanstel nrf52840
- PMIC1300
- spi display (Waveshare 2.13inch E-Ink Display)
PMIC:
- BUCK1: power Fanstel
- BUCK2: power display
- I'm not using the LDO's
I would like to control power to the display. Normally I would put a MOSFET on the ground line of the display and control the gate with a gpio.
Instead of a MOSFET, can I turn BUCK2 on and off in firmware to control power to the display? Any examples?
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/ {
/* The timer instance to use. */
chosen {
ncs,dm-timer = &timer2;
};
/* The selected pins will be used by Distance Measurement module for debug purposes. */
dm_gpio {
compatible = "gpio-leds";
dm_ranging: dm-ranging {
gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
label = "DM Ranging Pin";
};
dm_add_request: dm-add-request {
gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
label = "DM Add request Pin";
};
};
// &gpio0 10 (and &gpio0 9) causes ASSERTION FAIL???
dm_leds {
compatible = "gpio-leds";
dm_led0: dm-led0 {
gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
label = "GDM Test LED";
};
};
};
/*
* Copyright (C) 2023 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/regulator/npm1300.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
&arduino_i2c {
npm1300_ek_pmic: pmic@6b {
compatible = "nordic,npm1300";
reg = <0x6b>;
// long-press-reset = "one_button";
// ship-to-active-time = <96>;
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_buck1: BUCK1 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
// regulator-init-microvolt = <3000000>;
regulator-init-microvolt = <3300000>;
retention-microvolt = <3300000>;
};
npm1300_ek_buck2: BUCK2 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3400000>;
// regulator-init-microvolt = <1800000>;
regulator-init-microvolt = <3300000>;
retention-microvolt = <3300000>;
};
// npm1300_ek_ldo1: LDO1 {
// regulator-min-microvolt = <1000000>;
// regulator-max-microvolt = <3300000>;
// regulator-initial-mode = <NPM1300_LDSW_MODE_LDSW>;
// // soft-start-microamp = <20000>;
// };
// npm1300_ek_ldo2: LDO2 {
// regulator-min-microvolt = <1000000>;
// regulator-max-microvolt = <3300000>;
// regulator-initial-mode = <NPM1300_LDSW_MODE_LDSW>;
// // soft-start-microamp = <20000>;
// };
};
npm1300_ek_charger: charger {
compatible = "nordic,npm1300-charger";
term-microvolt = <4100000>;
term-warm-microvolt = <4200000>;
// term-current-percent = <10>;
current-microamp = <100000>;
// trickle-microvolt = <2500000>;
dischg-limit-microamp = <1340000>;
vbus-limit-microamp = <500000>;
thermistor-ohms = <10000>;
thermistor-beta = <3380>;
// disable-recharge;
charging-enable;
};
npm1300_ek_leds: leds {
compatible = "nordic,npm1300-led";
nordic,led0-mode = "error";
nordic,led1-mode = "charging";
nordic,led2-mode = "host";
};
};
};
&arduino_header {
gpio-map = <0 0 &gpio0 3 0>,
<1 0 &gpio0 4 0>,
<2 0 &gpio0 28 0>,
<3 0 &gpio0 29 0>,
<4 0 &gpio0 30 0>,
<5 0 &gpio0 31 0>,
<6 0 &gpio1 1 0>,
<7 0 &gpio1 2 0>,
<8 0 &gpio1 3 0>,
<9 0 &gpio1 4 0>,
<10 0 &gpio1 5 0>,
<11 0 &gpio1 6 0>,
<12 0 &gpio1 7 0>,
<13 0 &gpio1 8 0>,
<14 0 &gpio1 10 0>,
<15 0 &gpio1 11 0>,
<16 0 &gpio1 12 0>,
<17 0 &gpio1 13 0>,
<18 0 &gpio1 14 0>,
<19 0 &gpio1 15 0>,
<20 0 &gpio0 26 0>,
<21 0 &gpio0 27 0>;
};
/* npm1300_fule_guage */
&i2c0_default {
group1 {
bias-pull-up;
};
};