Skip to content

Commit 284bc5a

Browse files
authored
Merge pull request #416 from Rocketct/master
Changed MKRGSM1400 variant to increase the reliability
2 parents 5c4d667 + 45163fa commit 284bc5a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

variants/mkrgsm1400/variant.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,22 @@ SERCOM sercom5(SERCOM5);
185185
#define PMIC_REG01 0x01
186186
#define PMIC_REG07 0x07
187187

188+
#define PMIC_REG00 0x00
189+
190+
static inline void set_voltage_current_thresholds() {
191+
PERIPH_WIRE.initMasterWIRE(100000);
192+
PERIPH_WIRE.enableWIRE();
193+
pinPeripheral(PIN_WIRE_SDA, g_APinDescription[PIN_WIRE_SDA].ulPinType);
194+
pinPeripheral(PIN_WIRE_SCL, g_APinDescription[PIN_WIRE_SCL].ulPinType);
195+
196+
PERIPH_WIRE.startTransmissionWIRE( PMIC_ADDRESS, WIRE_WRITE_FLAG );
197+
PERIPH_WIRE.sendDataMasterWIRE(PMIC_REG00);
198+
PERIPH_WIRE.sendDataMasterWIRE(0x06); // input voltage limit = 3.88V, input current limit = 2A
199+
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);
200+
201+
PERIPH_WIRE.disableWIRE();
202+
}
203+
188204
static inline void enable_battery_charging() {
189205
PERIPH_WIRE.initMasterWIRE(100000);
190206
PERIPH_WIRE.enableWIRE();
@@ -230,6 +246,7 @@ void initVariant() {
230246
enable_battery_charging();
231247
}
232248
disable_battery_fet(!batteryPresent);
249+
set_voltage_current_thresholds();
233250
#endif
234251

235252
// put GSM modem in reset on start to conserve power if it's not used

0 commit comments

Comments
 (0)