Hello,
I am using the nPM1300 IC on a custom PCB with the nRF5340 + nRF7002 + nPM1300 configuration. sdk v2.8.0
I am trying to read the battery status (ADC value) via TWI, but I am unable to retrieve the battery information.
I have a few questions:
- When using the nPM1300, is it necessary to export the configuration from the nPM PowerUP app as an overlay and include it in the project during development?
- If so, where should this overlay be placed in VS Code? (Is the part shown in the image correct?)
- Can you check if there are any issues with my DTS and code?
nrf7002dk_nrf5340_cpuapp.dts
- Fullscreen123456789101112131415161718192021/** Copyright (c) 2024 Nordic Semiconductor ASA** SPDX-License-Identifier: Apache-2.0*//dts-v1/;#include <nordic/nrf5340_cpuapp_qkaa.dtsi>#include "nrf5340_cpuapp_common.dtsi"#include "nrf7002dk_nrf5340_cpuapp_pinctrl.dtsi"/ {model = "Nordic NRF7002 DK NRF5340 Application";compatible = "nordic,nrf7002-dk-nrf5340-cpuapp";chosen {zephyr,sram = &sram0_image;zephyr,flash = &flash0;zephyr,code-partition = &slot0_partition;zephyr,sram-secure-partition = &sram0_s;zephyr,sram-non-secure-partition = &sram0_ns;
- main.c
- Fullscreen123456789101112131415161718192021#include <zephyr/logging/log.h>LOG_MODULE_REGISTER(Provisioning, CONFIG_LOG_DEFAULT_LEVEL);#include <zephyr/kernel.h>#include <zephyr/drivers/i2c.h>#include "Algo/TCP_Client.h"#include "Algo/Provisioning.h"#include "Algo/ADC.h"#include "Algo/deviceInformation.h"// nPM1300 I2C 주소 및 I2C 버스 노드 (보드에 따라 DT_NODELABEL 수정)#define NPM1300_I2C_ADDR 0x6B#define I2C_BUS_NODE DT_NODELABEL(i2c1)// 레지스터 오프셋 (데이터 시트 참조; 여기서는 단일샷 VBAT 측정에 해당하는 레지스터들)#define REG_TASKVBATMEASURE 0x00 // VBAT 측정 트리거#define REG_ADCVBATRESULTMSB 0x11 // VBAT ADC 결과 MSB (상위 8비트)#define REG_ADCGP0RESULTLSBS 0x15 // 하위 2비트 (LSB)
Currently, the battery level is not being read.
In this state, when the VBUS (USB charging cable) is connected, no voltage is output.
However, when only the battery is connected, approximately 2.7V is output.