changeset 327:d7b25dca1266

.../drv_core/abb/abb.c: don't set backup battery bits in BCICONF
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 08 Dec 2017 03:05:19 +0000
parents 919b44c991fc
children daddb933047d
files src/cs/drivers/drv_core/abb/abb.c
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cs/drivers/drv_core/abb/abb.c	Tue Dec 05 05:04:09 2017 +0000
+++ b/src/cs/drivers/drv_core/abb/abb.c	Fri Dec 08 03:05:19 2017 +0000
@@ -75,6 +75,23 @@
   #include "l1_rf2.h"
 #endif
 
+/*
+ * The following conditional compilation control is a FreeCalypso addition.
+ * TI's original code always configured the BCICONF register with
+ * MESBB and BBCHGEN bits set, enabling both charging and the measurement
+ * resistive divider for the backup battery.  However, on our primary
+ * hw targets (Openmoko GTA02 and our own FCDEV3B) Iota's VBACKUP pin
+ * is unconnected, whereas on Mot C139 and Pirelli DP-L10 "alien" hw
+ * the VBACKUP situation is unclear.  But at least on our known hw
+ * with VBACKUP unconnected, it is better to leave backup battery charging
+ * and measurement OFF - TI's original config seems to be a drain on
+ * the main battery.  Therefore, we are going to leave MESBB and BBCHGEN
+ * off until and unless we have a hw target where backup battery charging
+ * and measurement are appropriate.
+ */
+
+#define	ENABLE_BACKUP_BATTERY	0
+
 #if (ABB_SEMAPHORE_PROTECTION)   
 
 static NU_SEMAPHORE abb_sem;
@@ -507,7 +524,11 @@
 
     // enable BB battery charge BCICONF register, enable test mode to track BDLEN and BULEN windows
     // This transmission enables BB charge and BB bridge connection for BB measurements.
-    ABB_WriteRegister(BCICONF, 0x060);  
+#if ENABLE_BACKUP_BATTERY
+    ABB_WriteRegister(BCICONF, 0x060);
+#else
+    ABB_WriteRegister(BCICONF, 0x000);
+#endif
 
      /* ************************  SELECTION OF BBCFG CONFIG FOR ABB 3 PG2_0 *******************************/
       #if (ANLG_FAM == 3)
@@ -790,10 +811,12 @@
       // Set AFCOUT to 0.
       ABB_WriteRegister(AFCOUT, 0x00);  
 
+#if ENABLE_BACKUP_BATTERY
       // Read BCICONF value	and cut the measurement bridge of BB cut the BB charge.
       reg_val = ABB_ReadRegister(BCICONF) & 0x039f;
 
       ABB_WriteRegister(BCICONF, reg_val);  
+#endif
     
       // Disable the ABB test mode
       ABB_WriteRegister(TAPCTRL, 0x00);  
@@ -956,10 +979,12 @@
 
       ABB_WriteRegister(AFCCTLADD, reg_val);  
 
+#if ENABLE_BACKUP_BATTERY
       // Read BCICONF register value and enable BB measurement bridge enable BB charge.  
       reg_val = ABB_ReadRegister(BCICONF) | 0x0060;
 
       ABB_WriteRegister(BCICONF, reg_val);  
+#endif
 
 
       /* *************************************************************************************************** */