Skip to content

rroels/nPM1300_Arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nPM1300 Arduino Driver

Warning

The information and material (code, designs, files, ...) are provided "AS IS". We make no representation or warranty of any kind, express or implied, regarding the accuracy, adequacy, validity, reliability, availability, or completeness of any information or material. Use this at your own risk.

Warning

At the time of writing this driver is under active development, and is nowhere near ready for real-world usage

Introduction

This an Arduino driver for Nordic's nPM1300 PMIC.

Driver Development Status

  • Soft Reset (RESET)
  • LED Driver (LEDDRV)
  • System monitor
  • System regulator (SYSREG)
  • Battery Charger (CHARGER)
  • Load switches (LOADSW)
  • LDO (LDO)
  • GPIO (GPIO)
  • Events / Interupts

Getting Started

void setup() {
    Wire.begin();
    
    npm1300.led_set_mode(nPM1300::LED::LED0, nPM1300::LEDMode::ERROR);
    npm1300.led_set_mode(nPM1300::LED::LED1, nPM1300::LEDMode::CHARGING);
    npm1300.led_set_mode(nPM1300::LED::LED2, nPM1300::LEDMode::HOST);

    npm1300.set_vterm(nPM1300::V4_15);
    npm1300.ignore_ntc(true); // mandatory, if you don't have a ntc connected!
    npm1300.set_charge_current(400);

    npm1300.charger_on();
}

Development Instructions

Clean

pio run -t clean

Build

pio run

Upload

pio run -t upload

Run Unit Tests

Run all tests:

pio test

Run specific suite:

pio test --filter "test_monitor"

Hardware

This library is being developed and tested for my custom nPM1300 breakout board:

https://github.com/rroels/nPM1300-breakout

However, There is nothing in this driver that would prevent it from working with the nPM1300 EK Evaluation Kit or other boards.

Troubleshooting

  • Battery charging is not working.

    • By default, the nPM1300 expects an NTC to be present to measure battery temperature. If the battery does not have an NTC, you need to call ignore_ntc(). Without this hardware setting, the nPM1300 charging will not work if there is no NTC!
  • The nPM1300 is not communicating over I2C when powered by battery.

Sources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published