From f78eeaa085e6da05f4a79ea8c4cb5bd8bc77bbab Mon Sep 17 00:00:00 2001
From: Uros Majstorovic <majstor@majstor.org>
Date: Fri, 27 Aug 2021 02:30:19 +0200
Subject: fixed bq25895 initial regs

---
 fw/fe310/eos/i2c/bq25895.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'fw/fe310')

diff --git a/fw/fe310/eos/i2c/bq25895.c b/fw/fe310/eos/i2c/bq25895.c
index ab56904..934b5e7 100644
--- a/fw/fe310/eos/i2c/bq25895.c
+++ b/fw/fe310/eos/i2c/bq25895.c
@@ -10,10 +10,13 @@ void eos_bq25895_init(void) {
     uint8_t data = 0;
     int i, ret = EOS_OK;
 
-    eos_i2c_start(400000);
-    eos_i2c_write8(BQ25895_ADDR, 0, 0x26);  // input current: 2.0 A
-    eos_i2c_write8(BQ25895_ADDR, 2, 0x28);
-    eos_i2c_write8(BQ25895_ADDR, 7, 0x8d);
+    eos_i2c_start(100000);
+    ret = eos_i2c_write8(BQ25895_ADDR, 0x07, 0x8d);   // disable watchdog
+    if (ret) printf("I2C ERROR 0x07\n");
+    ret = eos_i2c_write8(BQ25895_ADDR, 0x00, 0x28);   // 2.1A input current
+    if (ret) printf("I2C ERROR 0x00\n");
+    ret = eos_i2c_write8(BQ25895_ADDR, 0x03, 0x1e);   // sysmin 3.7, disable otg
+    if (ret) printf("I2C ERROR 0x03\n");
 
     printf("BQ25895:\n");
     for (i=0; i<0x15; i++) {
-- 
cgit v1.2.3