Is there any way to use MKR NB 1500 without battery? E.g. with power supply capable of delivering the necessary power and feeding the battery + terminal via two Scottky diode drops (5 - 1.2 = 3.8V)?
I am also confused why the modem won't work properly without the battery... From the BQ24195L manual:
"The power path management regulates the system slightly above battery voltage but does not drop below 3.5-V
minimum system voltage (programmable). With this feature, the system maintains operation even when the
battery is completely depleted or removed. When the input current limit or voltage limit is reached, the power
path management automatically reduces the charge current to zero. As the system load continues to increase,
the power path discharges the battery until the system power requirement is met. This supplement mode
operation prevents overloading the input source."
From the BQ24195L data sheet, 8.3.1.2.1 BATFET Turn Off:
When battery is not attached, the BATFET should be turned off by setting REG07[5] to 1 to disable charging and
supplement mode.
It looks like it can be used without battery. However, VBUS current limitation is not clear. There are many different values in the data sheet.
Have someone tested this?
This is the area of variant.cpp that sets up the charger:
#if defined(USE_BQ24195L_PMIC)
#include "wiring_private.h"
#define PMIC_ADDRESS 0x6B
#define PMIC_REG00 0x00
#define PMIC_REG01 0x01
#define PMIC_REG07 0x07
static inline void enable_battery_charging() {
PERIPH_WIRE.initMasterWIRE(100000);
PERIPH_WIRE.enableWIRE();
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG01);
PERIPH_WIRE.sendDataMasterWIRE(0x1B); // Charge Battery + Minimum System Voltage 3.5V
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
PERIPH_WIRE.disableWIRE();
}
static inline void set_voltage_current_thresholds() {
PERIPH_WIRE.initMasterWIRE(100000);
PERIPH_WIRE.enableWIRE();
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG00);
PERIPH_WIRE.sendDataMasterWIRE(0x06); // 3.880 V + 2A ILIM
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
PERIPH_WIRE.disableWIRE();
}
static inline void disable_battery_fet(bool disabled) {
PERIPH_WIRE.initMasterWIRE(100000);
PERIPH_WIRE.enableWIRE();
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG07);
// No D+/D– detection + Safety timer not slowed by 2X during input DPM or thermal regulation +
// BAT fet disabled/enabled + charge and bat fault INT
PERIPH_WIRE.sendDataMasterWIRE(0x0B | (disabled ? 0x20 : 0x00));
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
PERIPH_WIRE.disableWIRE();
}
#endif
void initVariant() {
#if defined(USE_BQ24195L_PMIC)
pinMode(ADC_BATTERY, OUTPUT);
digitalWrite(ADC_BATTERY, LOW);
delay(10);
pinMode(ADC_BATTERY, INPUT);
delay(100);
bool batteryPresent = analogRead(ADC_BATTERY) > 600;
if (batteryPresent) {
enable_battery_charging();
}
disable_battery_fet(!batteryPresent);
set_voltage_current_thresholds();
#endif
PERIPH_WIRE.sendDataMasterWIRE(0x06); // 3.880 V + 2A ILIM
Something does not seem right here... I agree withe the 2A limit, but how are they setting 3.880V min input voltage?
Page 27 of the bq24195l.pdf.
I was wrong. The above configuration looks right to me.
It looks like variant.cpp is already disabling BATFET if the battery in not connected.
I'm yet to find it but I believe there is another section of code that runs each time the PMIC Interrupt triggers that changes some of the PMIC settings or resets it back to factory defaults. I was having lots of issues with power stability until I wrote my own PMIC config routine that I run 1 second after each PMIC interrupt.
I believe you are right on this. I see that the PMIC Interrupt is PA27. Do you use pin # 30 or # 15 to catch the interrupt?
jscott293:
I'm yet to find it but I believe there is another section of code that runs each time the PMIC Interrupt triggers that changes some of the PMIC settings or resets it back to factory defaults. I was having lots of issues with power stability until I wrote my own PMIC config routine that I run 1 second after each PMIC interrupt.
Pin 30 is the PMIC Interrupt
jscott293:
Pin 30 is the PMIC Interrupt
Did you ever find where the arduino core was handling this interrupt and configuring the charger?
Did you use falling or low for the interrupt?