Skip to content

Changed MKRGSM1400 variant to increase the reliability #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions variants/mkrgsm1400/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ SERCOM sercom5(SERCOM5);
#define PMIC_REG01 0x01
#define PMIC_REG07 0x07

#define PMIC_REG00 0x00

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); // input voltage limit = 3.88V, input current limit = 2A
PERIPH_WIRE.prepareCommandBitsWire(WIRE_MASTER_ACT_STOP);

PERIPH_WIRE.disableWIRE();
}

static inline void enable_battery_charging() {
PERIPH_WIRE.initMasterWIRE(100000);
PERIPH_WIRE.enableWIRE();
Expand Down Expand Up @@ -230,6 +246,7 @@ void initVariant() {
enable_battery_charging();
}
disable_battery_fet(!batteryPresent);
set_voltage_current_thresholds();
#endif

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