Power.L.1N
Power.L.1N tile driver — Nordic nPM1300 PMIC.
Battery charger + 2 buck regulators + system supply (VSYS) + 3 indicator LEDs. Platform-agnostic: all bus access goes through tiles_pal_t.
The bucks come up at fixed boot voltages chosen by the tile's VSET pulldown resistors (no I2C needed): VSET1 = 47 kΩ → VOUT1 = 1.8 V, VSET2 = 330 kΩ → VOUT2 = 3.3 V. buck_set_mv() switches a buck to software control to override its VSET default at runtime.
Tile LEDs (physical colours, per the tile schematic): LED0 = GREEN → driven in HOST mode (firmware "ready"/status) LED1 = YELLOW → driven in CHARGING mode (auto, on while charging) LED2 = RED → driven in ERROR mode (auto, on for charger faults)
Examples
Quick start
#include "core_tiles.h"
tile_t pmic;
tile_power_l_1n_init(core_tiles_pal(&core_i2c1), 0, &pmic, NULL);
if (tile_is_ready(&pmic)) {
tile_power_l_1n_set_charge_current_ma(&pmic, 200);
tile_power_l_1n_charger_enable(&pmic, 1);
uint16_t vbat = tile_power_l_1n_get_vbat_mv(&pmic);
(void)vbat;
}API reference
Initialization
tile_power_l_1n_find
uint8_t tile_power_l_1n_find(tiles_pal_t* hal, uint8_t instance)Check whether an nPM1300 is present on the I2C bus.
- hal
- Platform HAL handle
- instance
- Instance index (0 = default, see mapping table)
Returns 1 if the device ACKs, 0 otherwise
tile_power_l_1n_init
void tile_power_l_1n_init(tiles_pal_t* hal, uint8_t instance, tile_t* tile, const power_l_1n_cfg_t* cfg)Sets the indicator LED modes (LED0=HOST, LED1=CHARGING, LED2=ERROR), disables NTC monitoring (no thermistor on this tile), and applies the charger settings. The buck regulators are left at their boot voltages (1.8 V / 3.3 V, fixed by the VSET resistors) — they are already up. Pass cfg=NULL for defaults (100 mA, 4.20 V, charging enabled).
- hal
- Platform HAL handle
- instance
- Instance index (0 = default, see mapping table)
- tile
- Pointer to tile handle (populated by this function)
- cfg
- Optional config, or NULL for defaults
Runtime
tile_power_l_1n_get_charge_status
Studiouint8_t tile_power_l_1n_get_charge_status(tile_t* tile)Read the raw charge-status register.
Returns BCHGCHARGESTATUS bits (NPM1300_CHG_* mask).
tile_power_l_1n_get_charge_error
Studiouint8_t tile_power_l_1n_get_charge_error(tile_t* tile)Read the charger error-reason register.
Returns BCHGERRREASON bits (0 = no error).
tile_power_l_1n_is_charging
Studiouint8_t tile_power_l_1n_is_charging(tile_t* tile)Whether the charger is actively charging (trickle / CC / CV).
Returns 1 if charging, 0 otherwise.
tile_power_l_1n_is_charge_complete
Studiouint8_t tile_power_l_1n_is_charge_complete(tile_t* tile)Whether charging has completed (battery full).
Returns 1 if charge complete, 0 otherwise.
tile_power_l_1n_battery_present
Studiouint8_t tile_power_l_1n_battery_present(tile_t* tile)Whether a battery is detected.
Returns 1 if a battery is present, 0 otherwise.
tile_power_l_1n_get_vbat_mv
Studiouint16_t tile_power_l_1n_get_vbat_mv(tile_t* tile)Measure the battery voltage.
Returns VBAT in millivolts (0-5000).
tile_power_l_1n_get_vsys_mv
Studiouint16_t tile_power_l_1n_get_vsys_mv(tile_t* tile)Measure the system (VSYS) voltage.
Returns VSYS in millivolts (0-6375).
tile_power_l_1n_get_die_temp_c
Studioint16_t tile_power_l_1n_get_die_temp_c(tile_t* tile)Measure the PMIC die temperature.
Returns Die temperature in degrees Celsius.
tile_power_l_1n_led_set
Studiovoid tile_power_l_1n_led_set(tile_t* tile, uint8_t led, uint8_t on)Only effective when the LED is in HOST mode (see led_set_mode).
- led
- 0, 1 or 2.
- on
- 1 = on, 0 = off.
Config
tile_power_l_1n_charger_enable
Studiovoid tile_power_l_1n_charger_enable(tile_t* tile, uint8_t on)Enable or disable battery charging.
- on
- 1 = enable charging, 0 = disable.
tile_power_l_1n_set_charge_current_ma
Studiovoid tile_power_l_1n_set_charge_current_ma(tile_t* tile, uint16_t ma)Programmable 32-800 mA in 2 mA steps; out-of-range values clamp.
- ma
- [32..800] Charge current in milliamps.
tile_power_l_1n_set_term_mv
Studiovoid tile_power_l_1n_set_term_mv(tile_t* tile, uint16_t mv)Selectable 3.50-3.65 V or 4.00-4.45 V in 50 mV steps; the 3.70-3.95 V gap is not supported and clamps to 3.65 V.
- mv
- Termination voltage in millivolts (e.g. 4200).
tile_power_l_1n_buck_enable
Studiovoid tile_power_l_1n_buck_enable(tile_t* tile, uint8_t buck, uint8_t on)Enable or disable a buck regulator.
- buck
- 1 (VOUT1) or 2 (VOUT2).
- on
- 1 = enable, 0 = disable.
tile_power_l_1n_buck_set_mv
Studiovoid tile_power_l_1n_buck_set_mv(tile_t* tile, uint8_t buck, uint16_t mv)Selects software voltage control for that buck (overriding its VSET resistor) and applies the new target.
- buck
- 1 (VOUT1) or 2 (VOUT2).
- mv
- [1000..3300] Output voltage in mV, 100 mV steps.
tile_power_l_1n_led_set_mode
Studiovoid tile_power_l_1n_led_set_mode(tile_t* tile, uint8_t led, power_l_1n_led_mode_t mode)LED0 is green, LED1 yellow, LED2 red. In auto modes (ERROR/CHARGING) the charger drives the LED directly; HOST mode hands control to led_set().
- led
- 0, 1 or 2.
- mode
- power_l_1n_led_mode_t.
Advanced
tile_power_l_1n_get_reset_cause
Studiouint8_t tile_power_l_1n_get_reset_cause(tile_t* tile)Read the reset-cause register (why the PMIC last reset).
Returns RSTCAUSE bits.
Driver gaps · 5
Chip capabilities this driver doesn’t expose yet.
Events
- charge_complete
- charging
Enums
power_l_1n_led_mode_t
LED indicator mode (LEDDRVxMODESEL).
- NPM1300_LED_ERROR
- auto: on for charger error
- NPM1300_LED_CHARGING
- auto: on while charging
- NPM1300_LED_HOST
- software-controlled via led_set()
- NPM1300_LED_NOTUSED
- disabled
Constants
| TILE_POWER_L_1N_VERSION_MAJOR | 1 | |
| TILE_POWER_L_1N_VERSION_MINOR | 0 | |
| TILE_POWER_L_1N_VERSION_PATCH | 0 | |
| NPM1300_I2C_ADDR | 0x6B |

