Skip to content

Commit 2b8150c

Browse files
committed
[MKRNBV3] Reduce USB voltage limit to 3880mV
On module powerup there can be current spikes that make the USB voltage drop under 4.36V. This results in PGOOD fault and module lockup. Only V3 seems affected, and FW A.02.01 even more.
1 parent eab09b4 commit 2b8150c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

variants/mkrnb1500/variant.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ SERCOM sercom5(SERCOM5);
182182
#include "wiring_private.h"
183183

184184
#define PMIC_ADDRESS 0x6B
185+
#define PMIC_REG00 0x00
185186
#define PMIC_REG01 0x01
186187
#define PMIC_REG07 0x07
187188

@@ -199,6 +200,20 @@ static inline void enable_battery_charging() {
199200
PERIPH_WIRE.disableWIRE();
200201
}
201202

203+
static inline void set_voltage_current_thresholds() {
204+
PERIPH_WIRE.initMasterWIRE(100000);
205+
PERIPH_WIRE.enableWIRE();
206+
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
207+
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
208+
209+
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
210+
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG00);
211+
PERIPH_WIRE.sendDataMasterWIRE(0x06); // 3.880 V + 2A ILIM
212+
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
213+
214+
PERIPH_WIRE.disableWIRE();
215+
}
216+
202217
static inline void disable_battery_fet(bool disabled) {
203218
PERIPH_WIRE.initMasterWIRE(100000);
204219
PERIPH_WIRE.enableWIRE();
@@ -230,6 +245,7 @@ void initVariant() {
230245
enable_battery_charging();
231246
}
232247
disable_battery_fet(!batteryPresent);
248+
set_voltage_current_thresholds();
233249
#endif
234250

235251
// power off the module

0 commit comments

Comments
 (0)