|
| 1 | +.. zephyr:code-sample:: npm2100_ek |
| 2 | + :name: nPM2100 EK |
| 3 | + |
| 4 | + Interact with the nPM2100 PMIC using the EK buttons and the shell interface. |
| 5 | + |
| 6 | +Overview |
| 7 | +******** |
| 8 | + |
| 9 | +This sample is provided for evaluation of the :ref:`npm2100_ek`. |
| 10 | +It is an example of how the nPM2100 GPIO pins and the shell |
| 11 | +interface can be used to control the following features: |
| 12 | + |
| 13 | + - Regulators (BOOST, LDOSW) |
| 14 | + - GPIO |
| 15 | + |
| 16 | +Requirements |
| 17 | +************ |
| 18 | + |
| 19 | +The sample supports the following boards: :zephyr:board:`nrf52840dk`, :zephyr:board:`nrf5340dk` |
| 20 | + |
| 21 | +The sample also requires an nPM2100 Evaluation Kit (EK) that you need to connect to the |
| 22 | +development kit as described in `Wiring`_. |
| 23 | + |
| 24 | +Wiring |
| 25 | +****** |
| 26 | + |
| 27 | +With this configuration, the nPM2100 EK is wired to supply power to the DK. |
| 28 | +This ensures that the TWI communication is at compatible voltage level, and represents a realistic use case for the nPM2100 PMIC. |
| 29 | + |
| 30 | +.. note:: |
| 31 | + |
| 32 | + To prevent leakage currents and program the DK, do not remove the USB connection. |
| 33 | + |
| 34 | + Unplug the battery from the nPM2100 EK and set the DK power switch to "OFF" while |
| 35 | + applying the wiring. |
| 36 | + If you have issues communicating with the DK or programming it after applying the wiring, try to power cycle the DK and EK. |
| 37 | + |
| 38 | +To connect your DK to the nPM2100 EK, complete the following steps: |
| 39 | + |
| 40 | +#. Prepare the DK for being powered by the nPM2100 EK: |
| 41 | + |
| 42 | + - Set switch **SW9** ("nRF power source") to position "VDD". |
| 43 | + - Set switch **SW10** ("VEXT -> VnRF") to position "ON". |
| 44 | + |
| 45 | +#. Connect the TWI interface and power supply between the chosen DK and the nPM2100 EK |
| 46 | + as described in the following table: |
| 47 | + |
| 48 | + +------------------+-------+-------+-----------------------+-----+ |
| 49 | + | nPM2100 EK pins | SDA | SCL | VOUT | GND | |
| 50 | + +------------------+-------+-------+-----------------------+-----+ |
| 51 | + | nRF52840 DK pins | P0.26 | P0.27 | P21 External supply + | GND | |
| 52 | + +------------------+-------+-------+-----------------------+-----+ |
| 53 | + | nRF5340 DK pins | P1.02 | P1.03 | P21 External supply + | GND | |
| 54 | + +------------------+-------+-------+-----------------------+-----+ |
| 55 | + |
| 56 | +#. Make the following connections on the nPM2100 EK: |
| 57 | + |
| 58 | + - Remove the USB power supply from the **J4** connector. |
| 59 | + - On the **P6** pin header, connect pins 1 and 2 with a jumper. |
| 60 | + - On the **BOOTMON** pin header, select **OFF** with a jumper. |
| 61 | + - On the **VSET** pin header, select **3.0V** with a jumper. |
| 62 | + - On the **VBAT SEL** switch, select **VBAT** position. |
| 63 | + - Connect a battery board to the **BATTERY INPUT** connector. |
| 64 | + |
| 65 | +Building and Running |
| 66 | +******************** |
| 67 | + |
| 68 | +To build the sample use the following command: |
| 69 | + |
| 70 | +.. zephyr-app-commands:: |
| 71 | + :zephyr-app: samples/shields/npm2100_ek |
| 72 | + :board: nrf52840dk/nrf52840 |
| 73 | + :goals: build |
| 74 | + :compact: |
| 75 | + |
| 76 | +.. note:: |
| 77 | + This sample automatically sets the ``SHIELD`` to ``npm2100_ek``. |
| 78 | + Once you have flashed the software to your device, boot into the shell interface. |
| 79 | + Use the ``regulator`` command to test the PMIC. |
| 80 | + See the following section for details on the subcommands. |
| 81 | + |
| 82 | +Regulator control |
| 83 | +***************** |
| 84 | + |
| 85 | +If the initialization was successful, the terminal displays the following message |
| 86 | +with status information: |
| 87 | + |
| 88 | +.. code-block:: console |
| 89 | +
|
| 90 | + PMIC device ok |
| 91 | +
|
| 92 | +The sample also reports the battery and boost output voltages as well as the die |
| 93 | +temperature measured every two seconds. |
| 94 | + |
| 95 | +Use the buttons on the EK to control the regulators as follows: |
| 96 | + |
| 97 | ++---------------------------+----------------------------------+ |
| 98 | +| Operation | Outcome | |
| 99 | ++---------------------------+----------------------------------+ |
| 100 | +| Button **GPIO0** pressed | BOOST output forced into HP mode | |
| 101 | ++---------------------------+----------------------------------+ |
| 102 | +| Button **GPIO0** released | BOOST output operates in LP mode | |
| 103 | ++---------------------------+----------------------------------+ |
| 104 | +| Button **GPIO1** pressed | Load Switch on | |
| 105 | ++---------------------------+----------------------------------+ |
| 106 | +| Button **GPIO1** released | Load Switch off | |
| 107 | ++---------------------------+----------------------------------+ |
| 108 | + |
| 109 | +The ``regulator`` shell interface provides several subcommand to test |
| 110 | +the regulators embedded in the PMIC. |
| 111 | + |
| 112 | +To list all supported voltages for a regulator, run the following command: |
| 113 | + |
| 114 | +.. code-block:: console |
| 115 | +
|
| 116 | + uart:~$ regulator vlist BOOST |
| 117 | + 1.800000 V |
| 118 | + 1.850000 V |
| 119 | + ... |
| 120 | +
|
| 121 | +To enable or disable a regulator, run the following commands: |
| 122 | + |
| 123 | +.. code-block:: console |
| 124 | +
|
| 125 | + uart:~$ regulator enable LDOSW |
| 126 | + uart:~$ regulator disable LDOSW |
| 127 | +
|
| 128 | +.. note:: |
| 129 | + The BOOST regulator is always enabled. |
| 130 | + |
| 131 | +To set the output voltage of a regulator, run the following command: |
| 132 | + |
| 133 | +.. code-block:: console |
| 134 | +
|
| 135 | + uart:~$ regulator vset BOOST 2.5v |
| 136 | + uart:~$ regulator vget BOOST |
| 137 | + 2.500000 V |
| 138 | +
|
| 139 | +.. note:: |
| 140 | + The BOOST regulator cannot provide a voltage lower than the battery voltage. |
| 141 | + |
| 142 | +To get the GPIO status, run the following command: |
| 143 | + |
| 144 | +.. code-block:: console |
| 145 | +
|
| 146 | + uart:~$ gpio get npm2100_gpio 0 |
| 147 | + 0 |
0 commit comments